root/tools/clang/blink_gc_plugin/tests/finalize_after_dispatch.cpp

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. toB
  2. trace
  3. traceAfterDispatch
  4. finalizeGarbageCollectedObject
  5. traceAfterDispatch
  6. traceAfterDispatch
  7. traceAfterDispatch

// 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 "finalize_after_dispatch.h"

namespace WebCore {

static B* toB(A* a) { return static_cast<B*>(a); }

void A::trace(Visitor* visitor)
{
    switch (m_type) {
    case TB:
        toB(this)->traceAfterDispatch(visitor);
        break;
    case TC:
        static_cast<C*>(this)->traceAfterDispatch(visitor);
        break;
    case TD:
        static_cast<D*>(this)->traceAfterDispatch(visitor);
        break;
    }
}

void A::traceAfterDispatch(Visitor* visitor)
{
}

void A::finalizeGarbageCollectedObject()
{
    switch (m_type) {
    case TB:
        toB(this)->~B();
        break;
    case TC:
        static_cast<C*>(this)->~C();
        break;
    case TD:
        // Missing static_cast<D*>(this)->~D();
        break;
    }
}

void B::traceAfterDispatch(Visitor* visitor)
{
    visitor->trace(m_a);
    A::trace(visitor);
}

void C::traceAfterDispatch(Visitor* visitor)
{
    visitor->trace(m_a);
    A::trace(visitor);
}

void D::traceAfterDispatch(Visitor* visitor)
{
    visitor->trace(m_a);
    Abstract::trace(visitor);
}

}

/* [<][>][^][v][top][bottom][index][help] */