// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef TRACE_AFTER_DISPATCH_IMPL_H_ #define TRACE_AFTER_DISPATCH_IMPL_H_ #include "heap/stubs.h" namespace blink { class X : public GarbageCollected { public: void Trace(Visitor*) {} }; enum ClassTag { BASE, DERIVED }; class TraceAfterDispatchInlinedBase : public GarbageCollected { public: explicit TraceAfterDispatchInlinedBase(ClassTag tag) : tag_(tag) {} void Trace(Visitor*); void TraceAfterDispatch(Visitor* visitor) const { visitor->Trace(x_base_); } private: ClassTag tag_; Member x_base_; }; class TraceAfterDispatchInlinedDerived : public TraceAfterDispatchInlinedBase { public: TraceAfterDispatchInlinedDerived() : TraceAfterDispatchInlinedBase(DERIVED) {} void TraceAfterDispatch(Visitor* visitor) const { visitor->Trace(x_derived_); TraceAfterDispatchInlinedBase::TraceAfterDispatch(visitor); } private: Member x_derived_; }; class TraceAfterDispatchExternBase : public GarbageCollected { public: explicit TraceAfterDispatchExternBase(ClassTag tag) : tag_(tag) {} void Trace(Visitor* visitor); void TraceAfterDispatch(Visitor* visitor) const; private: ClassTag tag_; Member x_base_; }; class TraceAfterDispatchExternDerived : public TraceAfterDispatchExternBase { public: TraceAfterDispatchExternDerived() : TraceAfterDispatchExternBase(DERIVED) {} void TraceAfterDispatch(Visitor* visitor) const; private: Member x_derived_; }; } #endif // TRACE_AFTER_DISPATCH_IMPL_H_