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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 1052993006: Refactor frame navigation/detach state cleanup to be more sane. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Minor test cleanup Created 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/ActiveDOMObjectTest.cpp ('k') | Source/core/frame/FrameView.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 // notifyContextDestroyed() for a document that doesn't get detached. 2159 // notifyContextDestroyed() for a document that doesn't get detached.
2160 // If such a document has any observer, the observer won't get 2160 // If such a document has any observer, the observer won't get
2161 // a contextDestroyed() notification. This can happen for a document 2161 // a contextDestroyed() notification. This can happen for a document
2162 // created by DOMImplementation::createDocument(). 2162 // created by DOMImplementation::createDocument().
2163 DocumentLifecycleNotifier::notifyContextDestroyed(); 2163 DocumentLifecycleNotifier::notifyContextDestroyed();
2164 ExecutionContext::notifyContextDestroyed(); 2164 ExecutionContext::notifyContextDestroyed();
2165 } 2165 }
2166 2166
2167 void Document::prepareForDestruction() 2167 void Document::prepareForDestruction()
2168 { 2168 {
2169 m_markers->prepareForDestruction(); 2169 ASSERT(!m_frame || m_frame->tree().childCount() == 0);
2170 disconnectDescendantFrames();
2171 2170
2172 // The process of disconnecting descendant frames could have already detache d us.
2173 if (!isActive()) 2171 if (!isActive())
2174 return; 2172 return;
2175 2173
2174 ScriptForbiddenScope forbidScript;
2175 // We detach the FrameView's custom scroll bars as early as
2176 // possible to prevent detach() from messing with the view
2177 // such that its scroll bars won't be torn down.
2178 //
2179 // FIXME: We should revisit this.
2180 view()->prepareForDetach();
2181 m_markers->prepareForDestruction();
2176 if (LocalDOMWindow* window = this->domWindow()) 2182 if (LocalDOMWindow* window = this->domWindow())
2177 window->willDetachDocumentFromFrame(); 2183 window->willDetachDocumentFromFrame();
2178 detach(); 2184 detach();
2179 } 2185 }
2180 2186
2181 void Document::removeAllEventListeners() 2187 void Document::removeAllEventListeners()
2182 { 2188 {
2183 ContainerNode::removeAllEventListeners(); 2189 ContainerNode::removeAllEventListeners();
2184 2190
2185 if (LocalDOMWindow* domWindow = this->domWindow()) 2191 if (LocalDOMWindow* domWindow = this->domWindow())
(...skipping 3518 matching lines...) Expand 10 before | Expand all | Expand 10 after
5704 #ifndef NDEBUG 5710 #ifndef NDEBUG
5705 using namespace blink; 5711 using namespace blink;
5706 void showLiveDocumentInstances() 5712 void showLiveDocumentInstances()
5707 { 5713 {
5708 WeakDocumentSet& set = liveDocumentSet(); 5714 WeakDocumentSet& set = liveDocumentSet();
5709 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5715 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5710 for (Document* document : set) 5716 for (Document* document : set)
5711 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5717 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5712 } 5718 }
5713 #endif 5719 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/ActiveDOMObjectTest.cpp ('k') | Source/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698