Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / tools / clang / blink_gc_plugin / tests / traceimpl_overloaded.h
blob808821df452625706d5c9b23549a9fd0b7244b1a
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef TRACEIMPL_OVERLOADED_H_
6 #define TRACEIMPL_OVERLOADED_H_
8 #include "heap/stubs.h"
10 namespace blink {
12 class X : public GarbageCollected<X> {
13 public:
14 void trace(Visitor*) {}
15 void trace(InlinedGlobalMarkingVisitor) {}
18 class InlinedBase : public GarbageCollected<InlinedBase> {
19 public:
20 virtual void trace(Visitor* visitor) { traceImpl(visitor); }
21 virtual void trace(InlinedGlobalMarkingVisitor visitor) {
22 traceImpl(visitor);
25 private:
26 template <typename VisitorDispatcher>
27 void traceImpl(VisitorDispatcher visitor) { visitor->trace(x_base_); }
29 Member<X> x_base_;
32 class InlinedDerived : public InlinedBase {
33 public:
34 void trace(Visitor* visitor) override { traceImpl(visitor); }
35 void trace(InlinedGlobalMarkingVisitor visitor) override {
36 traceImpl(visitor);
39 private:
40 template <typename VisitorDispatcher>
41 void traceImpl(VisitorDispatcher visitor) {
42 visitor->trace(x_derived_);
43 InlinedBase::trace(visitor);
46 Member<X> x_derived_;
49 class ExternBase : public GarbageCollected<ExternBase> {
50 public:
51 virtual void trace(Visitor*);
52 virtual void trace(InlinedGlobalMarkingVisitor);
54 private:
55 template <typename VisitorDispatcher>
56 void traceImpl(VisitorDispatcher);
58 Member<X> x_base_;
61 class ExternDerived : public ExternBase {
62 public:
63 void trace(Visitor*) override;
64 void trace(InlinedGlobalMarkingVisitor) override;
66 private:
67 template <typename VisitorDispatcher>
68 void traceImpl(VisitorDispatcher);
70 Member<X> x_derived_;
75 #endif // TRACEIMPL_OVERLOADED_H_