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

Unified Diff: Source/core/loader/FrameLoader.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
Index: Source/core/loader/FrameLoader.cpp
diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp
index eb5fe8016d1a199937124a0a3f56c5cfba52a134..b28ad2da575e43a9a14ba3b1650b9ac6bc3e44d2 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -1075,10 +1075,9 @@ void FrameLoader::restoreScrollPositionAndViewState()
void FrameLoader::checkLoadComplete()
{
ASSERT(client()->hasWebView());
- if (Page* page = m_frame->page()) {
- if (page->mainFrame()->isLocalFrame())
- page->deprecatedLocalMainFrame()->loader().checkLoadCompleteForThisFrame();
- }
+ Frame* top = m_frame->tree().top();
+ if (top->isLocalFrame())
+ toLocalFrame(top)->loader().checkLoadCompleteForThisFrame();
}
String FrameLoader::userAgent(const KURL& url) const
@@ -1088,58 +1087,17 @@ String FrameLoader::userAgent(const KURL& url) const
return userAgent;
}
-void FrameLoader::detachFromParent()
+void FrameLoader::detach()
{
- // The caller must protect a reference to m_frame.
- ASSERT(m_frame->refCount() > 1);
-
- InspectorInstrumentation::frameDetachedFromParent(m_frame);
-
if (m_documentLoader)
m_documentLoader->detachFromFrame();
m_documentLoader = nullptr;
- if (!client())
- return;
-
- // FIXME: All this code belongs up in Page.
Frame* parent = m_frame->tree().parent();
- if (parent && parent->isLocalFrame()) {
- m_frame->setView(nullptr);
- // FIXME: Shouldn't need to check if page() is null here.
- if (m_frame->owner() && m_frame->page())
- m_frame->page()->decrementSubframeCount();
- m_frame->willDetachFrameHost();
- detachClient();
+ if (parent && parent->isLocalFrame())
toLocalFrame(parent)->loader().scheduleCheckCompleted();
- } else {
- m_frame->setView(nullptr);
- m_frame->willDetachFrameHost();
- detachClient();
- }
- m_frame->detachFromFrameHost();
-}
-
-void FrameLoader::detachClient()
-{
- ASSERT(client());
-
- // Finish all cleanup work that might require talking to the embedder.
m_progressTracker.clear();
setOpener(0);
- // Notify ScriptController that the frame is closing, since its cleanup ends up calling
- // back to FrameLoaderClient via WindowProxy.
- m_frame->script().clearForClose();
-
- // client() should never be null because that means we somehow re-entered
- // the frame detach code... but it is sometimes.
- // FIXME: Understand why this is happening so we can document this insanity.
- if (client()) {
- // After this, we must no longer talk to the client since this clears
- // its owning reference back to our owning LocalFrame.
- client()->detachedFromParent();
- m_frame->clearClient();
- }
}
void FrameLoader::receivedMainResourceError(const ResourceError& error)

Powered by Google App Engine
This is Rietveld 408576698