RootObject* findRootObject(JSGlobalObject* globalObject) { RootObjectSet::const_iterator end = rootObjectSet()->end(); for (RootObjectSet::const_iterator it = rootObjectSet()->begin(); it != end; ++it) { if ((*it)->globalObject() == globalObject) return *it; } return 0; }
RootObject* findProtectingRootObject(JSObject* jsObject) { RootObjectSet::const_iterator end = rootObjectSet()->end(); for (RootObjectSet::const_iterator it = rootObjectSet()->begin(); it != end; ++it) { if ((*it)->gcIsProtected(jsObject)) return *it; } return 0; }
void RootObject::invalidate() { if (!m_isValid) return; { HashSet<RuntimeObjectImp*>::iterator end = m_runtimeObjects.end(); for (HashSet<RuntimeObjectImp*>::iterator it = m_runtimeObjects.begin(); it != end; ++it) (*it)->invalidate(); m_runtimeObjects.clear(); } m_isValid = false; m_nativeHandle = 0; m_globalObject = 0; ProtectCountSet::iterator end = m_protectCountSet.end(); for (ProtectCountSet::iterator it = m_protectCountSet.begin(); it != end; ++it) JSC::gcUnprotect(it->first); m_protectCountSet.clear(); rootObjectSet()->remove(this); }
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) { it->second.get()->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->first); m_protectCountSet.clear(); rootObjectSet()->remove(this); }
void RootObject::invalidate() { if (!m_isValid) return; { // Get the objects from the keys; the values might be nulled. // Safe because finalized runtime objects are removed from m_runtimeObjects by RootObject::finalize. for (RuntimeObject* runtimeObject : m_runtimeObjects.keys()) 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); }
RootObject::RootObject(const void* nativeHandle, JSGlobalObject* globalObject) : m_isValid(true) , m_nativeHandle(nativeHandle) , m_globalObject(globalObject->vm(), globalObject) { ASSERT(globalObject); rootObjectSet()->add(this); }