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

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: Consolidate ScriptForbiddenScope 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
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 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after
2154 // notifyContextDestroyed() for a document that doesn't get detached. 2154 // notifyContextDestroyed() for a document that doesn't get detached.
2155 // If such a document has any observer, the observer won't get 2155 // If such a document has any observer, the observer won't get
2156 // a contextDestroyed() notification. This can happen for a document 2156 // a contextDestroyed() notification. This can happen for a document
2157 // created by DOMImplementation::createDocument(). 2157 // created by DOMImplementation::createDocument().
2158 DocumentLifecycleNotifier::notifyContextDestroyed(); 2158 DocumentLifecycleNotifier::notifyContextDestroyed();
2159 ExecutionContext::notifyContextDestroyed(); 2159 ExecutionContext::notifyContextDestroyed();
2160 } 2160 }
2161 2161
2162 void Document::prepareForDestruction() 2162 void Document::prepareForDestruction()
2163 { 2163 {
2164 m_markers->prepareForDestruction(); 2164 ASSERT(!m_frame || m_frame->tree().childCount() == 0);
2165 disconnectDescendantFrames();
2166 2165
2167 // The process of disconnecting descendant frames could have already detache d us.
2168 if (!isActive()) 2166 if (!isActive())
2169 return; 2167 return;
2170 2168
2169 ScriptForbiddenScope forbidScript;
2170
2171 m_markers->prepareForDestruction();
2171 if (LocalDOMWindow* window = this->domWindow()) 2172 if (LocalDOMWindow* window = this->domWindow())
2172 window->willDetachDocumentFromFrame(); 2173 window->willDetachDocumentFromFrame();
2173 detach(); 2174 detach();
2174 } 2175 }
2175 2176
2176 void Document::removeAllEventListeners() 2177 void Document::removeAllEventListeners()
2177 { 2178 {
2178 ContainerNode::removeAllEventListeners(); 2179 ContainerNode::removeAllEventListeners();
2179 2180
2180 if (LocalDOMWindow* domWindow = this->domWindow()) 2181 if (LocalDOMWindow* domWindow = this->domWindow())
(...skipping 3516 matching lines...) Expand 10 before | Expand all | Expand 10 after
5697 #ifndef NDEBUG 5698 #ifndef NDEBUG
5698 using namespace blink; 5699 using namespace blink;
5699 void showLiveDocumentInstances() 5700 void showLiveDocumentInstances()
5700 { 5701 {
5701 WeakDocumentSet& set = liveDocumentSet(); 5702 WeakDocumentSet& set = liveDocumentSet();
5702 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5703 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5703 for (Document* document : set) 5704 for (Document* document : set)
5704 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5705 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5705 } 5706 }
5706 #endif 5707 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698