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

Side by Side Diff: Source/core/frame/Frame.cpp

Issue 618253002: Revert of 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/Frame.h ('k') | Source/core/frame/FrameClient.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Simon Hausmann <hausmann@kde.org> 5 * 2000 Simon Hausmann <hausmann@kde.org>
6 * 2000 Stefan Schimanski <1Stein@gmx.de> 6 * 2000 Stefan Schimanski <1Stein@gmx.de>
7 * 2001 George Staikos <staikos@kde.org> 7 * 2001 George Staikos <staikos@kde.org>
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 , m_owner(owner) 63 , m_owner(owner)
64 , m_client(client) 64 , m_client(client)
65 , m_remotePlatformLayer(0) 65 , m_remotePlatformLayer(0)
66 { 66 {
67 ASSERT(page()); 67 ASSERT(page());
68 68
69 #ifndef NDEBUG 69 #ifndef NDEBUG
70 frameCounter.increment(); 70 frameCounter.increment();
71 #endif 71 #endif
72 72
73 m_host->incrementFrameCount();
74
75 if (m_owner) { 73 if (m_owner) {
74 page()->incrementSubframeCount();
76 if (m_owner->isLocal()) 75 if (m_owner->isLocal())
77 toHTMLFrameOwnerElement(m_owner)->setContentFrame(*this); 76 toHTMLFrameOwnerElement(m_owner)->setContentFrame(*this);
78 } else { 77 } else {
79 page()->setMainFrame(this); 78 page()->setMainFrame(this);
80 } 79 }
81 } 80 }
82 81
83 Frame::~Frame() 82 Frame::~Frame()
84 { 83 {
85 #if ENABLE(OILPAN) 84 #if ENABLE(OILPAN)
(...skipping 10 matching lines...) Expand all
96 } 95 }
97 96
98 void Frame::trace(Visitor* visitor) 97 void Frame::trace(Visitor* visitor)
99 { 98 {
100 visitor->trace(m_treeNode); 99 visitor->trace(m_treeNode);
101 visitor->trace(m_host); 100 visitor->trace(m_host);
102 visitor->trace(m_owner); 101 visitor->trace(m_owner);
103 visitor->trace(m_domWindow); 102 visitor->trace(m_domWindow);
104 } 103 }
105 104
106 void Frame::detach()
107 {
108 // client() should never be null because that means we somehow re-entered
109 // the frame detach code... but it is sometimes.
110 // FIXME: Understand why this is happening so we can document this insanity.
111 // http://crbug.com/371084 is a probable explanation.
112 if (!client())
113 return;
114 // FIXME: Should we enforce the invariant that all pointers nulled in this f unction
115 // get nulled at the same time?
116 m_host->decrementFrameCount();
117 m_host = nullptr;
118 // After this, we must no longer talk to the client since this clears
119 // its owning reference back to our owning LocalFrame.
120 m_client->detached();
121 m_client = nullptr;
122 }
123
124 void Frame::detachChildren() 105 void Frame::detachChildren()
125 { 106 {
126 typedef WillBeHeapVector<RefPtrWillBeMember<Frame> > FrameVector; 107 typedef WillBeHeapVector<RefPtrWillBeMember<Frame> > FrameVector;
127 FrameVector childrenToDetach; 108 FrameVector childrenToDetach;
128 childrenToDetach.reserveCapacity(tree().childCount()); 109 childrenToDetach.reserveCapacity(tree().childCount());
129 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi bling()) 110 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi bling())
130 childrenToDetach.append(child); 111 childrenToDetach.append(child);
131 FrameVector::iterator end = childrenToDetach.end(); 112 FrameVector::iterator end = childrenToDetach.end();
132 for (FrameVector::iterator it = childrenToDetach.begin(); it != end; ++it) 113 for (FrameVector::iterator it = childrenToDetach.begin(); it != end; ++it)
133 (*it)->detach(); 114 (*it)->detach();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 return true; 199 return true;
219 200
220 return tree().parent()->isRemoteFrame(); 201 return tree().parent()->isRemoteFrame();
221 } 202 }
222 203
223 void Frame::disconnectOwnerElement() 204 void Frame::disconnectOwnerElement()
224 { 205 {
225 if (m_owner) { 206 if (m_owner) {
226 if (m_owner->isLocal()) 207 if (m_owner->isLocal())
227 toHTMLFrameOwnerElement(m_owner)->clearContentFrame(); 208 toHTMLFrameOwnerElement(m_owner)->clearContentFrame();
209 if (page())
210 page()->decrementSubframeCount();
228 } 211 }
229 m_owner = nullptr; 212 m_owner = nullptr;
230 } 213 }
231 214
232 HTMLFrameOwnerElement* Frame::deprecatedLocalOwner() const 215 HTMLFrameOwnerElement* Frame::deprecatedLocalOwner() const
233 { 216 {
234 return m_owner && m_owner->isLocal() ? toHTMLFrameOwnerElement(m_owner) : 0; 217 return m_owner && m_owner->isLocal() ? toHTMLFrameOwnerElement(m_owner) : 0;
235 } 218 }
236 219
237 } // namespace blink 220 } // namespace blink
OLDNEW
« 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