Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Unified Diff: Source/core/dom/ContextLifecycleNotifier.cpp

Issue 983713004: Delay testing lifecycle observers until known to be alive. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ContextLifecycleNotifier.cpp
diff --git a/Source/core/dom/ContextLifecycleNotifier.cpp b/Source/core/dom/ContextLifecycleNotifier.cpp
index b288ad46f764884ccb149356284f804c5a725dee..131bdbc1e0673a5a313778b5d204c2e031e025e1 100644
--- a/Source/core/dom/ContextLifecycleNotifier.cpp
+++ b/Source/core/dom/ContextLifecycleNotifier.cpp
@@ -56,8 +56,6 @@ void ContextLifecycleNotifier::notifyResumingActiveDOMObjects()
Vector<ContextLifecycleObserver*> snapshotOfObservers;
copyToVector(m_observers, snapshotOfObservers);
for (ContextLifecycleObserver* observer : snapshotOfObservers) {
- if (observer->observerType() != ContextLifecycleObserver::ActiveDOMObjectType)
- continue;
// FIXME: Oilpan: At the moment, it's possible that a ActiveDOMObject
// observer is destructed while iterating. Once we enable Oilpan by default
// for all LifecycleObserver<T>s, we can remove the hack by making m_observers
@@ -65,6 +63,8 @@ void ContextLifecycleNotifier::notifyResumingActiveDOMObjects()
// (i.e., we can just iterate m_observers without taking a snapshot).
// For more details, see https://codereview.chromium.org/247253002/.
if (m_observers.contains(observer)) {
+ if (observer->observerType() != ContextLifecycleObserver::ActiveDOMObjectType)
+ continue;
ActiveDOMObject* activeDOMObject = static_cast<ActiveDOMObject*>(observer);
ASSERT(activeDOMObject->executionContext() == context());
ASSERT(activeDOMObject->suspendIfNeededCalled());
@@ -79,11 +79,11 @@ void ContextLifecycleNotifier::notifySuspendingActiveDOMObjects()
Vector<ContextLifecycleObserver*> snapshotOfObservers;
copyToVector(m_observers, snapshotOfObservers);
for (ContextLifecycleObserver* observer : snapshotOfObservers) {
- if (observer->observerType() != ContextLifecycleObserver::ActiveDOMObjectType)
- continue;
// It's possible that the ActiveDOMObject is already destructed.
// See a FIXME above.
if (m_observers.contains(observer)) {
+ if (observer->observerType() != ContextLifecycleObserver::ActiveDOMObjectType)
+ continue;
ActiveDOMObject* activeDOMObject = static_cast<ActiveDOMObject*>(observer);
ASSERT(activeDOMObject->executionContext() == context());
ASSERT(activeDOMObject->suspendIfNeededCalled());
@@ -98,11 +98,11 @@ void ContextLifecycleNotifier::notifyStoppingActiveDOMObjects()
Vector<ContextLifecycleObserver*> snapshotOfObservers;
copyToVector(m_observers, snapshotOfObservers);
for (ContextLifecycleObserver* observer : snapshotOfObservers) {
- if (observer->observerType() != ContextLifecycleObserver::ActiveDOMObjectType)
- continue;
// It's possible that the ActiveDOMObject is already destructed.
// See a FIXME above.
if (m_observers.contains(observer)) {
+ if (observer->observerType() != ContextLifecycleObserver::ActiveDOMObjectType)
+ continue;
ActiveDOMObject* activeDOMObject = static_cast<ActiveDOMObject*>(observer);
ASSERT(activeDOMObject->executionContext() == context());
ASSERT(activeDOMObject->suspendIfNeededCalled());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698