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

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

Issue 968633002: Simplify lifecycle notifiers and observers. (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
Index: Source/core/dom/DocumentLifecycleNotifier.cpp
diff --git a/Source/core/dom/DocumentLifecycleNotifier.cpp b/Source/core/dom/DocumentLifecycleNotifier.cpp
index 39a4c2d47d9d424537556e26fefb62763bf9358c..7a6fbde93ed8cc165888963ea39b93e2914e49a6 100644
--- a/Source/core/dom/DocumentLifecycleNotifier.cpp
+++ b/Source/core/dom/DocumentLifecycleNotifier.cpp
@@ -28,47 +28,36 @@
#include "core/dom/DocumentLifecycleNotifier.h"
#include "core/dom/DocumentLifecycleObserver.h"
-#include "wtf/Assertions.h"
namespace blink {
DocumentLifecycleNotifier::DocumentLifecycleNotifier(Document* document)
- : LifecycleNotifier<Document>(document)
+ : LifecycleNotifier<Document, DocumentLifecycleObserver>(document)
{
}
-void DocumentLifecycleNotifier::addObserver(DocumentLifecycleNotifier::Observer* observer)
+void DocumentLifecycleNotifier::addObserver(DocumentLifecycleObserver* observer)
{
- if (observer->observerType() == Observer::DocumentLifecycleObserverType) {
- RELEASE_ASSERT(m_iterating != IteratingOverDocumentObservers);
- m_documentObservers.add(static_cast<DocumentLifecycleObserver*>(observer));
- }
-
- LifecycleNotifier<Document>::addObserver(observer);
+ LifecycleNotifier<Document, DocumentLifecycleObserver>::addObserver(observer);
}
-void DocumentLifecycleNotifier::removeObserver(DocumentLifecycleNotifier::Observer* observer)
+void DocumentLifecycleNotifier::removeObserver(DocumentLifecycleObserver* observer)
{
- if (observer->observerType() == Observer::DocumentLifecycleObserverType) {
- RELEASE_ASSERT(m_iterating != IteratingOverDocumentObservers);
- m_documentObservers.remove(static_cast<DocumentLifecycleObserver*>(observer));
- }
-
- LifecycleNotifier<Document>::removeObserver(observer);
+ LifecycleNotifier<Document, DocumentLifecycleObserver>::removeObserver(observer);
}
void DocumentLifecycleNotifier::notifyDocumentWasDetached()
{
- TemporaryChange<IterationType> scope(m_iterating, IteratingOverDocumentObservers);
- for (DocumentLifecycleObserver* observer : m_documentObservers)
+ TemporaryChange<IterationType> scope(m_iterating, IteratingOverAll);
+ for (DocumentLifecycleObserver* observer : m_observers)
observer->documentWasDetached();
}
#if !ENABLE(OILPAN)
void DocumentLifecycleNotifier::notifyDocumentWasDisposed()
{
- TemporaryChange<IterationType> scope(m_iterating, IteratingOverDocumentObservers);
- for (DocumentLifecycleObserver* observer : m_documentObservers)
+ TemporaryChange<IterationType> scope(m_iterating, IteratingOverAll);
+ for (DocumentLifecycleObserver* observer : m_observers)
observer->documentWasDisposed();
}
#endif

Powered by Google App Engine
This is Rietveld 408576698