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

Unified Diff: Source/web/FrameLoaderClientImpl.cpp

Issue 117493002: Invert the owning relationship between WebFrame and Frame. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years 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/web/FrameLoaderClientImpl.cpp
diff --git a/Source/web/FrameLoaderClientImpl.cpp b/Source/web/FrameLoaderClientImpl.cpp
index b9c348639719e4f7c955c0d69125252da1810bd8..f83193876723573a3b97590186a1c30b154785eb 100644
--- a/Source/web/FrameLoaderClientImpl.cpp
+++ b/Source/web/FrameLoaderClientImpl.cpp
@@ -110,17 +110,6 @@ FrameLoaderClientImpl::~FrameLoaderClientImpl()
{
}
-void FrameLoaderClientImpl::frameLoaderDestroyed()
-{
- // When the WebFrame was created, it had an extra reference given to it on
- // behalf of the Frame. Since the WebFrame owns us, this extra ref also
- // serves to keep us alive until the FrameLoader is done with us. The
- // FrameLoader calls this method when it's going away. Therefore, we balance
- // out that extra reference, which may cause 'this' to be deleted.
- ASSERT(!m_webFrame->frame());
- m_webFrame->deref();
-}
-
void FrameLoaderClientImpl::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*)
{
if (m_webFrame->client()) {
@@ -253,24 +242,28 @@ bool FrameLoaderClientImpl::hasFrameView() const
return m_webFrame->viewImpl();
}
-void FrameLoaderClientImpl::detachedFromParent()
+void FrameLoaderClientImpl::willDetachParent()
eseidel 2013/12/28 01:18:40 What's "parent" in this case? The page? The pare
dcheng 2013/12/28 01:51:05 I can't think of a better name for this unfortunat
{
- // Close down the proxy. The purpose of this change is to make the
- // call to ScriptController::clearWindowShell a no-op when called from
- // Frame::pageDestroyed. Without this change, this call to clearWindowShell
- // will cause a crash. If you remove/modify this, just ensure that you can
- // go to a page and then navigate to a new page without getting any asserts
- // or crashes.
- m_webFrame->frame()->script().clearForClose();
+ m_webFrame->willDetachParent();
+}
+void FrameLoaderClientImpl::detachedFromParent()
+{
// Alert the client that the frame is being detached. This is the last
eseidel 2013/12/28 01:18:40 Is this still the last chance? or are we completel
dcheng 2013/12/28 01:51:05 This is the last chance because the final line of
// chance we have to communicate with the client.
- if (m_webFrame->client())
- m_webFrame->client()->frameDetached(m_webFrame);
+ m_webFrame->setWebCoreFrame(0);
- // Stop communicating with the WebFrameClient at this point since we are no
- // longer associated with the Page.
+ // Signal that no further communication with WebFrameClient should take
+ // place at this point since we are no longer associated with the Page.
+ WebFrameClient* client = m_webFrame->client();
m_webFrame->setClient(0);
+
+ // frameDetached() may release the final reference to WebFrame. Since we are
eseidel 2013/12/28 01:18:40 I'm confused by this comment. The goal is to clea
dcheng 2013/12/28 01:51:05 I've tried to clarify this comment. Basically, cal
+ // owned by WebFrame, we can't reference any members after this point, so
+ // clear WebFrame now.
+ WebFrame* webFrame = m_webFrame;
+ m_webFrame = 0;
+ client->frameDetached(webFrame);
}
void FrameLoaderClientImpl::dispatchWillRequestAfterPreconnect(ResourceRequest& request)

Powered by Google App Engine
This is Rietveld 408576698