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.
5 #ifndef TRACEIMPL_OVERLOADED_H_
6 #define TRACEIMPL_OVERLOADED_H_
8 #include "heap/stubs.h"
12 class X
: public GarbageCollected
<X
> {
14 void trace(Visitor
*) {}
15 void trace(InlinedGlobalMarkingVisitor
) {}
18 class InlinedBase
: public GarbageCollected
<InlinedBase
> {
20 virtual void trace(Visitor
* visitor
) { traceImpl(visitor
); }
21 virtual void trace(InlinedGlobalMarkingVisitor visitor
) {
26 template <typename VisitorDispatcher
>
27 void traceImpl(VisitorDispatcher visitor
) { visitor
->trace(x_base_
); }
32 class InlinedDerived
: public InlinedBase
{
34 void trace(Visitor
* visitor
) override
{ traceImpl(visitor
); }
35 void trace(InlinedGlobalMarkingVisitor visitor
) override
{
40 template <typename VisitorDispatcher
>
41 void traceImpl(VisitorDispatcher visitor
) {
42 visitor
->trace(x_derived_
);
43 InlinedBase::trace(visitor
);
49 class ExternBase
: public GarbageCollected
<ExternBase
> {
51 virtual void trace(Visitor
*);
52 virtual void trace(InlinedGlobalMarkingVisitor
);
55 template <typename VisitorDispatcher
>
56 void traceImpl(VisitorDispatcher
);
61 class ExternDerived
: public ExternBase
{
63 void trace(Visitor
*) override
;
64 void trace(InlinedGlobalMarkingVisitor
) override
;
67 template <typename VisitorDispatcher
>
68 void traceImpl(VisitorDispatcher
);
75 #endif // TRACEIMPL_OVERLOADED_H_