Index: Source/core/dom/ContextLifecycleNotifier.cpp |
diff --git a/Source/core/dom/ContextLifecycleNotifier.cpp b/Source/core/dom/ContextLifecycleNotifier.cpp |
index b62bcbd30eb5ca4300855815120f456070192196..7f7f029d4d67720344467e994d64606f3ee0abd7 100644 |
--- a/Source/core/dom/ContextLifecycleNotifier.cpp |
+++ b/Source/core/dom/ContextLifecycleNotifier.cpp |
@@ -53,6 +53,9 @@ void ContextLifecycleNotifier::removeObserver(ContextLifecycleNotifier::Observer |
LifecycleNotifier<ExecutionContext>::removeObserver(observer); |
if (observer->observerType() == Observer::ActiveDOMObjectType) { |
+#if ENABLE(OILPAN) |
+ RELEASE_ASSERT(m_iterating != IteratingOverActiveDOMObjects); |
+#endif |
m_activeDOMObjects.remove(static_cast<ActiveDOMObject*>(observer)); |
} |
} |
@@ -60,6 +63,13 @@ void ContextLifecycleNotifier::removeObserver(ContextLifecycleNotifier::Observer |
void ContextLifecycleNotifier::notifyResumingActiveDOMObjects() |
{ |
TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverActiveDOMObjects); |
+#if ENABLE(OILPAN) |
+ for (ActiveDOMObject* obj : m_activeDOMObjects) { |
+ ASSERT(obj->executionContext() == context()); |
+ ASSERT(obj->suspendIfNeededCalled()); |
+ obj->resume(); |
+ } |
+#else |
Vector<ActiveDOMObject*> snapshotOfActiveDOMObjects; |
copyToVector(m_activeDOMObjects, snapshotOfActiveDOMObjects); |
for (ActiveDOMObject* obj : snapshotOfActiveDOMObjects) { |
@@ -76,11 +86,19 @@ void ContextLifecycleNotifier::notifyResumingActiveDOMObjects() |
obj->resume(); |
} |
} |
+#endif |
} |
void ContextLifecycleNotifier::notifySuspendingActiveDOMObjects() |
{ |
TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverActiveDOMObjects); |
+#if ENABLE(OILPAN) |
+ for (ActiveDOMObject* obj : m_activeDOMObjects) { |
+ ASSERT(obj->executionContext() == context()); |
+ ASSERT(obj->suspendIfNeededCalled()); |
+ obj->suspend(); |
+ } |
+#else |
Vector<ActiveDOMObject*> snapshotOfActiveDOMObjects; |
copyToVector(m_activeDOMObjects, snapshotOfActiveDOMObjects); |
for (ActiveDOMObject* obj : snapshotOfActiveDOMObjects) { |
@@ -92,11 +110,19 @@ void ContextLifecycleNotifier::notifySuspendingActiveDOMObjects() |
obj->suspend(); |
} |
} |
+#endif |
} |
void ContextLifecycleNotifier::notifyStoppingActiveDOMObjects() |
{ |
TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverActiveDOMObjects); |
+#if ENABLE(OILPAN) |
+ for (ActiveDOMObject* obj : m_activeDOMObjects) { |
+ ASSERT(obj->executionContext() == context()); |
+ ASSERT(obj->suspendIfNeededCalled()); |
+ obj->stop(); |
+ } |
+#else |
Vector<ActiveDOMObject*> snapshotOfActiveDOMObjects; |
copyToVector(m_activeDOMObjects, snapshotOfActiveDOMObjects); |
for (ActiveDOMObject* obj : snapshotOfActiveDOMObjects) { |
@@ -108,6 +134,7 @@ void ContextLifecycleNotifier::notifyStoppingActiveDOMObjects() |
obj->stop(); |
} |
} |
+#endif |
} |
bool ContextLifecycleNotifier::hasPendingActivity() const |
@@ -119,4 +146,10 @@ bool ContextLifecycleNotifier::hasPendingActivity() const |
return false; |
} |
+void ContextLifecycleNotifier::trace(Visitor* visitor) |
+{ |
+ visitor->trace(m_activeDOMObjects); |
+ LifecycleNotifier<ExecutionContext>::trace(visitor); |
+} |
+ |
} // namespace blink |