Chromium Code Reviews| Index: Source/core/dom/ContextLifecycleNotifier.cpp |
| diff --git a/Source/core/dom/ContextLifecycleNotifier.cpp b/Source/core/dom/ContextLifecycleNotifier.cpp |
| index 7ce7a1e25bbee4d0b8d054840842f8dc41271571..bada199cd7a8304de9f2f8f80fef36f8de7831e5 100644 |
| --- a/Source/core/dom/ContextLifecycleNotifier.cpp |
| +++ b/Source/core/dom/ContextLifecycleNotifier.cpp |
| @@ -39,6 +39,10 @@ void ContextLifecycleNotifier::notifyResumingActiveDOMObjects() |
| Vector<ContextLifecycleObserver*> snapshotOfObservers; |
| copyToVector(m_observers, snapshotOfObservers); |
| for (ContextLifecycleObserver* observer : snapshotOfObservers) { |
| +#if !ENABLE(OILPAN) |
| + if (!isObserverAlive(observer)) |
| + continue; |
| +#endif |
| // FIXME: Oilpan: At the moment, it's possible that a ActiveDOMObject |
|
haraken
2015/05/09 14:50:33
Not related to this CL, I think this FIXME is vali
|
| // 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 |
| @@ -62,6 +66,10 @@ void ContextLifecycleNotifier::notifySuspendingActiveDOMObjects() |
| Vector<ContextLifecycleObserver*> snapshotOfObservers; |
| copyToVector(m_observers, snapshotOfObservers); |
| for (ContextLifecycleObserver* observer : snapshotOfObservers) { |
| +#if !ENABLE(OILPAN) |
| + if (!isObserverAlive(observer)) |
| + continue; |
| +#endif |
| // It's possible that the ActiveDOMObject is already destructed. |
| // See a FIXME above. |
| if (m_observers.contains(observer)) { |
| @@ -81,6 +89,10 @@ void ContextLifecycleNotifier::notifyStoppingActiveDOMObjects() |
| Vector<ContextLifecycleObserver*> snapshotOfObservers; |
| copyToVector(m_observers, snapshotOfObservers); |
| for (ContextLifecycleObserver* observer : snapshotOfObservers) { |
| +#if !ENABLE(OILPAN) |
| + if (!isObserverAlive(observer)) |
| + continue; |
| +#endif |
| // It's possible that the ActiveDOMObject is already destructed. |
| // See a FIXME above. |
| if (m_observers.contains(observer)) { |
| @@ -98,6 +110,10 @@ unsigned ContextLifecycleNotifier::activeDOMObjectCount() const |
| { |
| unsigned activeDOMObjects = 0; |
| for (ContextLifecycleObserver* observer : m_observers) { |
| +#if !ENABLE(OILPAN) |
| + if (!isObserverAlive(observer)) |
| + continue; |
| +#endif |
| if (observer->observerType() != ContextLifecycleObserver::ActiveDOMObjectType) |
| continue; |
| activeDOMObjects++; |
| @@ -108,6 +124,10 @@ unsigned ContextLifecycleNotifier::activeDOMObjectCount() const |
| bool ContextLifecycleNotifier::hasPendingActivity() const |
| { |
| for (ContextLifecycleObserver* observer : m_observers) { |
| +#if !ENABLE(OILPAN) |
| + if (!isObserverAlive(observer)) |
| + continue; |
| +#endif |
| if (observer->observerType() != ContextLifecycleObserver::ActiveDOMObjectType) |
| continue; |
| ActiveDOMObject* activeDOMObject = static_cast<ActiveDOMObject*>(observer); |
| @@ -121,6 +141,10 @@ bool ContextLifecycleNotifier::hasPendingActivity() const |
| bool ContextLifecycleNotifier::contains(ActiveDOMObject* object) const |
| { |
| for (ContextLifecycleObserver* observer : m_observers) { |
| +#if !ENABLE(OILPAN) |
| + if (!isObserverAlive(observer)) |
| + continue; |
| +#endif |
| if (observer->observerType() != ContextLifecycleObserver::ActiveDOMObjectType) |
| continue; |
| ActiveDOMObject* activeDOMObject = static_cast<ActiveDOMObject*>(observer); |