| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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_OVERLOADED_ERROR_H_ | 5 #ifndef TRACEIMPL_OVERLOADED_ERROR_H_ |
| 6 #define TRACEIMPL_OVERLOADED_ERROR_H_ | 6 #define TRACEIMPL_OVERLOADED_ERROR_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 void Trace(Visitor*) {} | 14 void Trace(Visitor*) {} |
| 15 void Trace(InlinedGlobalMarkingVisitor) {} | |
| 16 }; | 15 }; |
| 17 | 16 |
| 18 class InlinedBase : public GarbageCollected<InlinedBase> { | 17 class InlinedBase : public GarbageCollected<InlinedBase> { |
| 19 public: | 18 public: |
| 20 virtual void Trace(Visitor* visitor) { TraceImpl(visitor); } | 19 virtual void Trace(Visitor* visitor) { |
| 21 virtual void Trace(InlinedGlobalMarkingVisitor visitor) { | 20 // Missing visitor->Trace(x_base_). |
| 22 TraceImpl(visitor); | |
| 23 } | 21 } |
| 24 | 22 |
| 25 private: | 23 private: |
| 26 template <typename VisitorDispatcher> | |
| 27 void TraceImpl(VisitorDispatcher visitor) { | |
| 28 // Missing visitor->Trace(x_base_). | |
| 29 } | |
| 30 | |
| 31 Member<X> x_base_; | 24 Member<X> x_base_; |
| 32 }; | 25 }; |
| 33 | 26 |
| 34 class InlinedDerived : public InlinedBase { | 27 class InlinedDerived : public InlinedBase { |
| 35 public: | 28 public: |
| 36 void Trace(Visitor* visitor) override { TraceImpl(visitor); } | 29 void Trace(Visitor* visitor) override { |
| 37 void Trace(InlinedGlobalMarkingVisitor visitor) override { | 30 // Missing visitor->Trace(x_derived_) and InlinedBase::Trace(visitor). |
| 38 TraceImpl(visitor); | |
| 39 } | 31 } |
| 40 | 32 |
| 41 private: | 33 private: |
| 42 template <typename VisitorDispatcher> | |
| 43 void TraceImpl(VisitorDispatcher visitor) { | |
| 44 // Missing visitor->Trace(x_derived_) and InlinedBase::Trace(visitor). | |
| 45 } | |
| 46 | |
| 47 Member<X> x_derived_; | 34 Member<X> x_derived_; |
| 48 }; | 35 }; |
| 49 | 36 |
| 50 class ExternBase : public GarbageCollected<ExternBase> { | 37 class ExternBase : public GarbageCollected<ExternBase> { |
| 51 public: | 38 public: |
| 52 virtual void Trace(Visitor*); | 39 virtual void Trace(Visitor*); |
| 53 virtual void Trace(InlinedGlobalMarkingVisitor); | |
| 54 | 40 |
| 55 private: | 41 private: |
| 56 template <typename VisitorDispatcher> | |
| 57 void TraceImpl(VisitorDispatcher); | |
| 58 | |
| 59 Member<X> x_base_; | 42 Member<X> x_base_; |
| 60 }; | 43 }; |
| 61 | 44 |
| 62 class ExternDerived : public ExternBase { | 45 class ExternDerived : public ExternBase { |
| 63 public: | 46 public: |
| 64 void Trace(Visitor*) override; | 47 void Trace(Visitor*) override; |
| 65 void Trace(InlinedGlobalMarkingVisitor) override; | |
| 66 | 48 |
| 67 private: | 49 private: |
| 68 template <typename VisitorDispatcher> | |
| 69 void TraceImpl(VisitorDispatcher); | |
| 70 | |
| 71 Member<X> x_derived_; | 50 Member<X> x_derived_; |
| 72 }; | 51 }; |
| 73 | 52 |
| 74 } | 53 } |
| 75 | 54 |
| 76 #endif // TRACEIMPL_OVERLOADED_ERROR_H_ | 55 #endif // TRACEIMPL_OVERLOADED_ERROR_H_ |
| OLD | NEW |