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

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

Issue 645623004: Reland "Streamline frame detach" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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/Frame.h ('k') | Source/core/frame/FrameClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/Frame.cpp
diff --git a/Source/core/frame/Frame.cpp b/Source/core/frame/Frame.cpp
index 302a3e1e1328c2dd483c8800fa04416b5323c0b4..d45db355c975bbb0c7041fed3c7f2504b8a9c281 100644
--- a/Source/core/frame/Frame.cpp
+++ b/Source/core/frame/Frame.cpp
@@ -71,7 +71,6 @@ Frame::Frame(FrameClient* client, FrameHost* host, FrameOwner* owner)
#endif
if (m_owner) {
- page()->incrementSubframeCount();
if (m_owner->isLocal())
toHTMLFrameOwnerElement(m_owner)->setContentFrame(*this);
} else {
@@ -102,6 +101,21 @@ void Frame::trace(Visitor* visitor)
visitor->trace(m_domWindow);
}
+void Frame::detach()
+{
+ // 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.
+ // http://crbug.com/371084 is a probable explanation.
+ if (!client())
+ return;
+ // After this, we must no longer talk to the client since this clears
+ // its owning reference back to our owning LocalFrame.
+ m_client->detached();
+ m_client = nullptr;
+ m_host = nullptr;
+}
+
void Frame::detachChildren()
{
typedef WillBeHeapVector<RefPtrWillBeMember<Frame> > FrameVector;
@@ -206,8 +220,6 @@ void Frame::disconnectOwnerElement()
if (m_owner) {
if (m_owner->isLocal())
toHTMLFrameOwnerElement(m_owner)->clearContentFrame();
- if (page())
- page()->decrementSubframeCount();
}
m_owner = nullptr;
}
« no previous file with comments | « Source/core/frame/Frame.h ('k') | Source/core/frame/FrameClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698