Roll src/third_party/WebKit d10c917:a1123a1 (svn 198729:198730)
[chromium-blink-merge.git] / tools / clang / blink_gc_plugin / tests / trace_after_dispatch.cpp
blobc246aaaf0c8bea7b039516e1a2620d07f15c3b66
1 // Copyright 2014 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.h"
7 namespace blink {
9 static B* toB(A* a) { return static_cast<B*>(a); }
11 void A::trace(Visitor* visitor)
13 switch (m_type) {
14 case TB:
15 toB(this)->traceAfterDispatch(visitor);
16 break;
17 case TC:
18 static_cast<C*>(this)->traceAfterDispatch(visitor);
19 break;
20 case TD:
21 // Missing static_cast<D*>(this)->traceAfterDispatch(visitor);
22 break;
26 void A::traceAfterDispatch(Visitor* visitor)
30 void B::traceAfterDispatch(Visitor* visitor)
32 visitor->trace(m_a);
33 // Missing A::traceAfterDispatch(visitor);
34 // Also check that calling trace does not count.
35 A::trace(visitor);
38 void C::traceAfterDispatch(Visitor* visitor)
40 // Missing visitor->trace(m_a);
41 A::traceAfterDispatch(visitor);
44 void D::traceAfterDispatch(Visitor* visitor)
46 visitor->trace(m_a);
47 Abstract::traceAfterDispatch(visitor);