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

Unified Diff: third_party/WebKit/Source/platform/LifecycleNotifier.h

Issue 1858583002: Simplify LifecycleNotifier and Observer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more removals Created 4 years, 8 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
Index: third_party/WebKit/Source/platform/LifecycleNotifier.h
diff --git a/third_party/WebKit/Source/platform/LifecycleNotifier.h b/third_party/WebKit/Source/platform/LifecycleNotifier.h
index 7e654cf12b6e6b4a5c4ca81f74af825e6d8f2bba..79710d9b19bc5b80cbefc3a16e2101a5859e24cd 100644
--- a/third_party/WebKit/Source/platform/LifecycleNotifier.h
+++ b/third_party/WebKit/Source/platform/LifecycleNotifier.h
@@ -50,9 +50,7 @@ public:
DEFINE_INLINE_VIRTUAL_TRACE()
{
-#if ENABLE(OILPAN)
visitor->trace(m_observers);
-#endif
}
bool isIteratingOverObservers() const { return m_iterating != IteratingNone; }
@@ -89,13 +87,6 @@ inline LifecycleNotifier<T, Observer>::~LifecycleNotifier()
{
// FIXME: Enable the following ASSERT. Also see a FIXME in Document::detach().
// ASSERT(!m_observers.size() || m_didCallContextDestroyed);
-
-#if !ENABLE(OILPAN)
- TemporaryChange<IterationType> scope(m_iterating, IteratingOverAll);
- for (Observer* observer : m_observers) {
- observer->clearLifecycleContext();
- }
-#endif
}
template<typename T, typename Observer>
@@ -109,17 +100,11 @@ inline void LifecycleNotifier<T, Observer>::notifyContextDestroyed()
Vector<UntracedMember<Observer>> snapshotOfObservers;
copyToVector(m_observers, snapshotOfObservers);
for (Observer* observer : snapshotOfObservers) {
- // FIXME: Oilpan: At the moment, it's possible that the Observer is
sof 2016/04/04 09:47:32 Removed this FIXME as it doesn't hold (&something
- // destructed during the iteration.
- // Once we enable Oilpan by default for Observers *and*
- // Observer::contextDestroyed() does not call removeObserver(),
- // we can remove the hack by making m_observers
- // a HeapHashSet<WeakMember<Observers>>. (i.e., we can just iterate
- // m_observers without taking a snapshot).
- if (m_observers.contains(observer)) {
- ASSERT(observer->lifecycleContext() == context());
- observer->contextDestroyed();
- }
+ if (!m_observers.contains(observer))
+ continue;
+
+ ASSERT(observer->lifecycleContext() == context());
+ observer->contextDestroyed();
}
m_didCallContextDestroyed = true;
« no previous file with comments | « third_party/WebKit/Source/platform/LifecycleContextTest.cpp ('k') | third_party/WebKit/Source/platform/LifecycleObserver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698