Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / tools / clang / blink_gc_plugin / tests / trace_after_dispatch_impl.cpp
blob53a68553200345ea29d87536c3dadf22dddb93db
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 #include "trace_after_dispatch_impl.h"
7 namespace blink {
9 template <typename VisitorDispatcher>
10 inline void TraceAfterDispatchInlinedBase::traceImpl(
11 VisitorDispatcher visitor) {
12 // Implement a simple form of manual dispatching, because BlinkGCPlugin
13 // checks if the tracing is dispatched to all derived classes.
15 // This function has to be implemented out-of-line, since we need to know the
16 // definition of derived classes here.
17 if (tag_ == DERIVED) {
18 static_cast<TraceAfterDispatchInlinedDerived*>(this)->traceAfterDispatch(
19 visitor);
20 } else {
21 traceAfterDispatch(visitor);
25 void TraceAfterDispatchExternBase::trace(Visitor* visitor) {
26 traceImpl(visitor);
29 void TraceAfterDispatchExternBase::trace(InlinedGlobalMarkingVisitor visitor) {
30 traceImpl(visitor);
33 template <typename VisitorDispatcher>
34 inline void TraceAfterDispatchExternBase::traceImpl(VisitorDispatcher visitor) {
35 if (tag_ == DERIVED) {
36 static_cast<TraceAfterDispatchExternDerived*>(this)->traceAfterDispatch(
37 visitor);
38 } else {
39 traceAfterDispatch(visitor);
43 void TraceAfterDispatchExternBase::traceAfterDispatch(Visitor* visitor) {
44 traceAfterDispatchImpl(visitor);
47 void TraceAfterDispatchExternBase::traceAfterDispatch(
48 InlinedGlobalMarkingVisitor visitor) {
49 traceAfterDispatchImpl(visitor);
52 template <typename VisitorDispatcher>
53 inline void TraceAfterDispatchExternBase::traceAfterDispatchImpl(
54 VisitorDispatcher visitor) {
55 visitor->trace(x_base_);
58 void TraceAfterDispatchExternDerived::traceAfterDispatch(Visitor* visitor) {
59 traceAfterDispatchImpl(visitor);
62 void TraceAfterDispatchExternDerived::traceAfterDispatch(
63 InlinedGlobalMarkingVisitor visitor) {
64 traceAfterDispatchImpl(visitor);
67 template <typename VisitorDispatcher>
68 inline void TraceAfterDispatchExternDerived::traceAfterDispatchImpl(
69 VisitorDispatcher visitor) {
70 visitor->trace(x_derived_);
71 TraceAfterDispatchExternBase::traceAfterDispatch(visitor);