Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / tools / clang / blink_gc_plugin / tests / traceimpl.h
blob64fae26be8649690bce7ce70da103cc34da7c706
1 // Copyright 2014 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_H_
6 #define TRACEIMPL_H_
8 #include "heap/stubs.h"
10 namespace blink {
12 class X : public GarbageCollected<X> {
13 public:
14 virtual void trace(Visitor*) {}
17 class TraceImplInlined : public GarbageCollected<TraceImplInlined> {
18 public:
19 void trace(Visitor* visitor) { traceImpl(visitor); }
21 template <typename VisitorDispatcher>
22 void traceImpl(VisitorDispatcher visitor) {
23 visitor->trace(x_);
26 private:
27 Member<X> x_;
30 class TraceImplExtern : public GarbageCollected<TraceImplExtern> {
31 public:
32 void trace(Visitor* visitor);
33 template <typename VisitorDispatcher>
34 inline void traceImpl(VisitorDispatcher);
36 private:
37 Member<X> x_;
40 class Base : public GarbageCollected<Base> {
41 public:
42 virtual void trace(Visitor* visitor) {}
45 class TraceImplBaseInlined : public Base {
46 public:
47 void trace(Visitor* visitor) override { traceImpl(visitor); }
49 template <typename VisitorDispatcher>
50 void traceImpl(VisitorDispatcher visitor) {
51 Base::trace(visitor);
55 class TraceImplBaseExtern : public Base {
56 public:
57 void trace(Visitor* visitor) override;
59 template <typename VisitorDispatcher>
60 void traceImpl(VisitorDispatcher);
62 private:
63 Member<X> x_;
68 #endif