virtual_and_trace_after_dispatch.cpp revision 23730a6e56a168d1879203e4b3819bb36e3d8f1f
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.
4
5#include "virtual_and_trace_after_dispatch.h"
6
7namespace WebCore {
8
9static B* toB(A* a) { return static_cast<B*>(a); }
10
11void A::trace(Visitor* visitor)
12{
13    switch (m_type) {
14    case TB:
15        toB(this)->traceAfterDispatch(visitor);
16        break;
17    }
18}
19
20void A::traceAfterDispatch(Visitor* visitor)
21{
22}
23
24void B::traceAfterDispatch(Visitor* visitor)
25{
26    visitor->trace(m_a);
27    A::trace(visitor);
28}
29
30}
31