| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef TRACEIMPL_H_ | 5 #ifndef TRACEIMPL_H_ |
| 6 #define TRACEIMPL_H_ | 6 #define TRACEIMPL_H_ |
| 7 | 7 |
| 8 #include "heap/stubs.h" | 8 #include "heap/stubs.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 class X : public GarbageCollected<X> { | 12 class X : public GarbageCollected<X> { |
| 13 public: | 13 public: |
| 14 virtual void Trace(Visitor*) {} | 14 virtual void Trace(Visitor*) {} |
| 15 }; | 15 }; |
| 16 | 16 |
| 17 class TraceImplInlined : public GarbageCollected<TraceImplInlined> { | 17 class TraceImplInlined : public GarbageCollected<TraceImplInlined> { |
| 18 public: | 18 public: |
| 19 void Trace(Visitor* visitor) { TraceImpl(visitor); } | 19 void Trace(Visitor* visitor) { visitor->Trace(x_); } |
| 20 | |
| 21 template <typename VisitorDispatcher> | |
| 22 void TraceImpl(VisitorDispatcher visitor) { | |
| 23 visitor->Trace(x_); | |
| 24 } | |
| 25 | 20 |
| 26 private: | 21 private: |
| 27 Member<X> x_; | 22 Member<X> x_; |
| 28 }; | 23 }; |
| 29 | 24 |
| 30 class TraceImplExtern : public GarbageCollected<TraceImplExtern> { | 25 class TraceImplExtern : public GarbageCollected<TraceImplExtern> { |
| 31 public: | 26 public: |
| 32 void Trace(Visitor* visitor); | 27 void Trace(Visitor* visitor); |
| 33 template <typename VisitorDispatcher> | |
| 34 inline void TraceImpl(VisitorDispatcher); | |
| 35 | 28 |
| 36 private: | 29 private: |
| 37 Member<X> x_; | 30 Member<X> x_; |
| 38 }; | 31 }; |
| 39 | 32 |
| 40 class Base : public GarbageCollected<Base> { | 33 class Base : public GarbageCollected<Base> { |
| 41 public: | 34 public: |
| 42 virtual void Trace(Visitor* visitor) {} | 35 virtual void Trace(Visitor* visitor) {} |
| 43 }; | 36 }; |
| 44 | 37 |
| 45 class TraceImplBaseInlined : public Base { | 38 class TraceImplBaseInlined : public Base { |
| 46 public: | 39 public: |
| 47 void Trace(Visitor* visitor) override { TraceImpl(visitor); } | 40 void Trace(Visitor* visitor) override { Base::Trace(visitor); } |
| 48 | |
| 49 template <typename VisitorDispatcher> | |
| 50 void TraceImpl(VisitorDispatcher visitor) { | |
| 51 Base::Trace(visitor); | |
| 52 } | |
| 53 }; | 41 }; |
| 54 | 42 |
| 55 class TraceImplBaseExtern : public Base { | 43 class TraceImplBaseExtern : public Base { |
| 56 public: | 44 public: |
| 57 void Trace(Visitor* visitor) override; | 45 void Trace(Visitor* visitor) override; |
| 58 | 46 |
| 59 template <typename VisitorDispatcher> | |
| 60 void TraceImpl(VisitorDispatcher); | |
| 61 | |
| 62 private: | 47 private: |
| 63 Member<X> x_; | 48 Member<X> x_; |
| 64 }; | 49 }; |
| 65 | 50 |
| 66 } | 51 } |
| 67 | 52 |
| 68 #endif | 53 #endif |
| OLD | NEW |