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

Unified Diff: Source/core/loader/FrameLoader.cpp

Issue 618253002: Revert of 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/loader/FrameLoader.h ('k') | Source/core/loader/FrameLoaderClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/FrameLoader.cpp
diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp
index 8a28b7aab61452c14c8493867c31ef6d10040a4d..37d3db67ca3ef6d3766955301d8b4fe4d2314454 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -1105,22 +1105,61 @@
return userAgent;
}
-void FrameLoader::detach()
+void FrameLoader::detachFromParent()
{
#if !ENABLE(OILPAN)
// The caller must protect a reference to m_frame.
ASSERT(m_frame->refCount() > 1);
#endif
+
+ 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())
+ 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();
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->dispose();
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)
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/loader/FrameLoaderClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698