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

Unified Diff: Source/core/frame/LocalFrame.cpp

Issue 551973005: Streamline frame detach (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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/frame/LocalFrame.h ('k') | Source/core/frame/RemoteFrame.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/LocalFrame.cpp
diff --git a/Source/core/frame/LocalFrame.cpp b/Source/core/frame/LocalFrame.cpp
index 34698bdd1486c398a563d46c2803a8c97185bd94..14c5bd1102963df17813ca6523fb5cdffd14eff3 100644
--- a/Source/core/frame/LocalFrame.cpp
+++ b/Source/core/frame/LocalFrame.cpp
@@ -174,7 +174,16 @@ void LocalFrame::detach()
// will trigger the unload event handlers of any child frames, and those event
// handlers might start a new subresource load in this frame.
m_loader.stopAllLoaders();
- m_loader.detachFromParent();
+ if (!client())
+ return;
+ m_loader.detach();
+ setView(nullptr);
+ willDetachFrameHost();
+ // Notify ScriptController that the frame is closing, since its cleanup ends up calling
+ // back to FrameLoaderClient via WindowProxy.
+ script().clearForClose();
+ InspectorInstrumentation::frameDetachedFromParent(this);
+ Frame::detach();
}
bool LocalFrame::inScope(TreeScope* scope) const
@@ -315,12 +324,6 @@ void LocalFrame::removeDestructionObserver(FrameDestructionObserver* observer)
void LocalFrame::willDetachFrameHost()
{
- // We should never be detatching the page during a Layout.
- RELEASE_ASSERT(!m_view || !m_view->isInPerformLayout());
-
- Frame* parent = tree().parent();
- if (parent && parent->isLocalFrame())
- toLocalFrame(parent)->loader().checkLoadComplete();
WillBeHeapHashSet<RawPtrWillBeWeakMember<FrameDestructionObserver> >::iterator stop = m_destructionObservers.end();
for (WillBeHeapHashSet<RawPtrWillBeWeakMember<FrameDestructionObserver> >::iterator it = m_destructionObservers.begin(); it != stop; ++it)
@@ -337,13 +340,6 @@ void LocalFrame::willDetachFrameHost()
page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get());
}
-void LocalFrame::detachFromFrameHost()
-{
- // We should never be detaching the page during a Layout.
- RELEASE_ASSERT(!m_view || !m_view->isInPerformLayout());
- m_host = nullptr;
-}
-
String LocalFrame::documentTypeString() const
{
if (DocumentType* doctype = document()->doctype())
@@ -580,7 +576,7 @@ bool LocalFrame::isURLAllowed(const KURL& url) const
{
// We allow one level of self-reference because some sites depend on that,
// but we don't allow more than one.
- if (page()->subframeCount() >= Page::maxNumberOfFrames)
+ if (host()->frameCount() >= FrameHost::maxNumberOfFrames)
return false;
bool foundSelfReference = false;
for (const Frame* frame = this; frame; frame = frame->tree().parent()) {
« no previous file with comments | « Source/core/frame/LocalFrame.h ('k') | Source/core/frame/RemoteFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698