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

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

Issue 419863004: Refactor frame detach to work for both local and remote frames. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix comment typo Created 6 years, 5 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/page/Page.cpp » ('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 dc8c56e0ed192e4c9933178cf0656e5e4aed3a04..1df2634ae639196d71389ec41fed72212fd19a9f 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -934,7 +934,7 @@ void FrameLoader::commitProvisionalLoad()
client()->dispatchWillClose();
closeURL();
}
- detachChildren();
+ m_frame->detachChildren();
if (pdl != m_provisionalDocumentLoader)
return;
if (m_documentLoader)
@@ -1104,20 +1104,6 @@ void FrameLoader::restoreScrollPositionAndViewState()
}
}
-void FrameLoader::detachChildren()
-{
- typedef Vector<RefPtr<LocalFrame> > FrameVector;
- FrameVector childrenToDetach;
- childrenToDetach.reserveCapacity(m_frame->tree().childCount());
- for (Frame* child = m_frame->tree().lastChild(); child; child = child->tree().previousSibling()) {
- if (child->isLocalFrame())
- childrenToDetach.append(toLocalFrame(child));
- }
- FrameVector::iterator end = childrenToDetach.end();
- for (FrameVector::iterator it = childrenToDetach.begin(); it != end; ++it)
- (*it)->loader().detachFromParent();
-}
-
// Called every time a resource is completely loaded or an error is received.
void FrameLoader::checkLoadComplete()
{
@@ -1135,28 +1121,12 @@ String FrameLoader::userAgent(const KURL& url) const
return userAgent;
}
-void FrameLoader::frameDetached()
-{
- // stopAllLoaders can detach the LocalFrame, so protect it.
- RefPtr<LocalFrame> protect(m_frame);
- stopAllLoaders();
- detachFromParent();
-}
-
void FrameLoader::detachFromParent()
{
// Temporary explosions. We should never re-enter this code when this condition is true.
RELEASE_ASSERT(!m_willDetachClient);
-
- // stopAllLoaders can detach the LocalFrame, so protect it.
- RefPtr<LocalFrame> protect(m_frame);
-
- closeURL();
- detachChildren();
- // stopAllLoaders() needs to be called after detachChildren(), because detachedChildren()
- // will trigger the unload event handlers of any child frames, and those event
- // handlers might start a new subresource load in this frame.
- stopAllLoaders();
+ // The caller must protect a reference to m_frame.
+ ASSERT(m_frame->refCount() > 1);
InspectorInstrumentation::frameDetachedFromParent(m_frame);
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/page/Page.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698