예제 #1
0
void RootObject::finalize(JSC::Handle<JSC::Unknown> handle, void*)
{
    RuntimeObject* object = static_cast<RuntimeObject*>(handle.get().asCell());

    Ref<RootObject> protect(*this);
    object->invalidate();
    weakRemove(m_runtimeObjects, object, object);
}
예제 #2
0
void RootObject::finalize(JSC::Handle<JSC::Unknown> handle, void*)
{
    RuntimeObject* object = static_cast<RuntimeObject*>(asObject(handle.get()));
    ASSERT(m_runtimeObjects.contains(object));

    object->invalidate();
    m_runtimeObjects.remove(object);
}
예제 #3
0
void RootObject::invalidate()
{
    if (!m_isValid)
        return;

    {
        HashMap<RuntimeObject*, JSC::Weak<RuntimeObject> >::iterator end = m_runtimeObjects.end();
        for (HashMap<RuntimeObject*, JSC::Weak<RuntimeObject> >::iterator it = m_runtimeObjects.begin(); it != end; ++it) {
            RuntimeObject* runtimeObject = it->value.get();
            if (!runtimeObject) // Skip zombies.
                continue;
            runtimeObject->invalidate();
        }

        m_runtimeObjects.clear();
    }

    m_isValid = false;

    m_nativeHandle = 0;
    m_globalObject.clear();

    {
        HashSet<InvalidationCallback*>::iterator end = m_invalidationCallbacks.end();
        for (HashSet<InvalidationCallback*>::iterator iter = m_invalidationCallbacks.begin(); iter != end; ++iter)
            (**iter)(this);

        m_invalidationCallbacks.clear();
    }

    ProtectCountSet::iterator end = m_protectCountSet.end();
    for (ProtectCountSet::iterator it = m_protectCountSet.begin(); it != end; ++it)
        JSC::gcUnprotect(it->key);
    m_protectCountSet.clear();

    rootObjectSet()->remove(this);
}