コード例 #1
0
V8ObjectEventListener::~V8ObjectEventListener()
{
    if (m_frame) {
        ASSERT(!m_listener.IsEmpty());
        V8Proxy* proxy = V8Proxy::retrieve(m_frame);
        if (proxy)
            proxy->objectListeners()->remove(this);
    }

    disposeListenerObject();
}
コード例 #2
0
static void weakObjectEventListenerCallback(v8::Persistent<v8::Value>, void* parameter)
{
    V8ObjectEventListener* listener = static_cast<V8ObjectEventListener*>(parameter);

    // Remove the wrapper
    Frame* frame = listener->frame();
    if (frame) {
        V8Proxy* proxy = V8Proxy::retrieve(frame);
        if (proxy)
            proxy->objectListeners()->remove(listener);

        // Because the listener is no longer in the list, it must be disconnected from the frame to avoid dangling frame pointer
        // in the destructor.
        listener->disconnectFrame();
    }
    listener->disposeListenerObject();
}