// Copyright 2014 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. #include "trace_after_dispatch.h" namespace blink { static const B* toB(const A* a) { return static_cast(a); } void A::Trace(Visitor* visitor) const { switch (m_type) { case TB: toB(this)->TraceAfterDispatch(visitor); break; case TC: static_cast(this)->TraceAfterDispatch(visitor); break; case TD: // Missing static_cast(this)->TraceAfterDispatch(visitor); break; } } void A::TraceAfterDispatch(Visitor* visitor) const {} void B::TraceAfterDispatch(Visitor* visitor) const { visitor->Trace(m_a); // Missing A::TraceAfterDispatch(visitor); // Also check that calling Trace does not count. A::Trace(visitor); } void C::TraceAfterDispatch(Visitor* visitor) const { // Missing visitor->Trace(m_a); A::TraceAfterDispatch(visitor); } void D::TraceAfterDispatch(Visitor* visitor) const { visitor->Trace(m_a); Abstract::TraceAfterDispatch(visitor); } }