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

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

Issue 16988003: Revert "Extract ContextLifecycleNotifier from ScriptExecutionContext." (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 | « Source/core/dom/Document.h ('k') | Source/core/dom/DocumentLifecycleObserver.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 7073875267392515110e8cff1de548c71d8c69af..6f0e65b65d5f8070dafac6d173eb755a75ec4c26 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -643,7 +643,8 @@ void Document::dispose()
m_scriptedAnimationController->clearDocumentPointer();
m_scriptedAnimationController.clear();
- lifecycleNotifier()->notifyDocumentWasDisposed();
+ if (m_lifecycleNotifier)
+ m_lifecycleNotifier->notifyDocumentWasDisposed();
}
Element* Document::getElementById(const AtomicString& id) const
@@ -2001,7 +2002,8 @@ void Document::detach(const AttachContext& context)
if (m_mediaQueryMatcher)
m_mediaQueryMatcher->documentDestroyed();
- lifecycleNotifier()->notifyDocumentWasDetached();
+ if (m_lifecycleNotifier)
+ m_lifecycleNotifier->notifyDocumentWasDetached();
}
void Document::prepareForDestruction()
@@ -5224,14 +5226,11 @@ void Document::didAssociateFormControlsTimerFired(Timer<Document>* timer)
m_associatedFormControls.clear();
}
-PassOwnPtr<ContextLifecycleNotifier> Document::createLifecycleNotifier()
+void Document::addLifecycleObserver(DocumentLifecycleObserver* observer)
{
- return DocumentLifecycleNotifier::create(this);
-}
-
-DocumentLifecycleNotifier* Document::lifecycleNotifier()
-{
- return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifecycleNotifier());
+ if (!m_lifecycleNotifier)
+ m_lifecycleNotifier = DocumentLifecycleNotifier::create();
+ m_lifecycleNotifier->addObserver(observer);
}
} // namespace WebCore
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/DocumentLifecycleObserver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698