summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/bridge/runtime_root.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/bridge/runtime_root.cpp')
-rw-r--r--Source/WebCore/bridge/runtime_root.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/Source/WebCore/bridge/runtime_root.cpp b/Source/WebCore/bridge/runtime_root.cpp
index 515636d..5496e55 100644
--- a/Source/WebCore/bridge/runtime_root.cpp
+++ b/Source/WebCore/bridge/runtime_root.cpp
@@ -101,13 +101,15 @@ void RootObject::invalidate()
return;
{
- HashSet<RuntimeObject*>::iterator end = m_runtimeObjects.end();
- for (HashSet<RuntimeObject*>::iterator it = m_runtimeObjects.begin(); it != end; ++it)
- (*it)->invalidate();
-
+ WeakGCMap<RuntimeObject*, RuntimeObject>::iterator end = m_runtimeObjects.uncheckedEnd();
+ for (WeakGCMap<RuntimeObject*, RuntimeObject>::iterator it = m_runtimeObjects.uncheckedBegin(); it != end; ++it) {
+ if (m_runtimeObjects.isValid(it))
+ it->second->invalidate();
+ }
+
m_runtimeObjects.clear();
}
-
+
m_isValid = false;
m_nativeHandle = 0;
@@ -176,17 +178,19 @@ void RootObject::updateGlobalObject(JSGlobalObject* globalObject)
void RootObject::addRuntimeObject(RuntimeObject* object)
{
ASSERT(m_isValid);
- ASSERT(!m_runtimeObjects.contains(object));
-
- m_runtimeObjects.add(object);
-}
-
+ ASSERT(!m_runtimeObjects.get(object));
+
+ m_runtimeObjects.set(object, object);
+}
+
void RootObject::removeRuntimeObject(RuntimeObject* object)
{
- ASSERT(m_isValid);
- ASSERT(m_runtimeObjects.contains(object));
-
- m_runtimeObjects.remove(object);
+ if (!m_isValid)
+ return;
+
+ ASSERT(m_runtimeObjects.uncheckedGet(object));
+
+ m_runtimeObjects.take(object);
}
} } // namespace JSC::Bindings