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. 4 5 #ifndef TRACEIMPL_OVERLOADED_H_ 6 #define TRACEIMPL_OVERLOADED_H_ 7 8 #include "heap/stubs.h" 9 10 namespace blink { 11 12 class X : public GarbageCollected<X> { 13 public: 14 void Trace(Visitor*) {} 15 }; 16 17 class InlinedBase : public GarbageCollected<InlinedBase> { 18 public: 19 virtual void Trace(Visitor* visitor) { visitor->Trace(x_base_); } 20 21 private: 22 Member<X> x_base_; 23 }; 24 25 class InlinedDerived : public InlinedBase { 26 public: 27 void Trace(Visitor* visitor) override { 28 visitor->Trace(x_derived_); 29 InlinedBase::Trace(visitor); 30 } 31 32 Member<X> x_derived_; 33 }; 34 35 class ExternBase : public GarbageCollected<ExternBase> { 36 public: 37 virtual void Trace(Visitor*); 38 39 private: 40 Member<X> x_base_; 41 }; 42 43 class ExternDerived : public ExternBase { 44 public: 45 void Trace(Visitor*) override; 46 47 private: 48 Member<X> x_derived_; 49 }; 50 51 } 52 53 #endif // TRACEIMPL_OVERLOADED_H_ 54