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

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

Issue 25036004: Add a lifecycle state machine for Document (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 7 years, 3 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/DocumentLifecycle.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 3403d2c4e064d5f3d383cfda2ba3f842b73ebaa2..d4a2633257d41efc872950b525099bca20a8d8a5 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -490,6 +490,8 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
m_nodeListCounts[i] = 0;
InspectorCounters::incrementCounter(InspectorCounters::DocumentCounter);
+
+ m_lifecyle.advanceTo(DocumentLifecycle::Inactive);
}
static bool isAttributeOnAllOwners(const WebCore::QualifiedName& attribute, const WebCore::QualifiedName& prefixedAttribute, const HTMLFrameOwnerElement* owner)
@@ -613,6 +615,7 @@ void Document::dispose()
if (svgExtensions())
accessSVGExtensions()->pauseAnimations();
+ m_lifecyle.advanceTo(DocumentLifecycle::Disposed);
lifecycleNotifier()->notifyDocumentWasDisposed();
}
@@ -1982,10 +1985,14 @@ void Document::attach(const AttachContext& context)
m_styleResolverThrowawayTimer.startRepeating(60);
ContainerNode::attach(context);
+
+ m_lifecyle.advanceTo(DocumentLifecycle::Active);
}
void Document::detach(const AttachContext& context)
{
+ m_lifecyle.advanceTo(DocumentLifecycle::Stopping);
+
ASSERT(confusingAndOftenMisusedAttached());
if (page())
@@ -2049,6 +2056,7 @@ void Document::detach(const AttachContext& context)
m_mediaQueryMatcher->documentDestroyed();
lifecycleNotifier()->notifyDocumentWasDetached();
+ m_lifecyle.advanceTo(DocumentLifecycle::Stopped);
}
void Document::prepareForDestruction()
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/DocumentLifecycle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698