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

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

Issue 1177333002: Revert of Detach old frame on WebFrame::swap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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
« 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 #endif 73 #endif
74 } 74 }
75 75
76 DEFINE_TRACE(Frame) 76 DEFINE_TRACE(Frame)
77 { 77 {
78 visitor->trace(m_treeNode); 78 visitor->trace(m_treeNode);
79 visitor->trace(m_host); 79 visitor->trace(m_host);
80 visitor->trace(m_owner); 80 visitor->trace(m_owner);
81 } 81 }
82 82
83 void Frame::detach(FrameDetachType type) 83 void Frame::detach()
84 { 84 {
85 ASSERT(m_client); 85 ASSERT(m_client);
86 domWindow()->resetLocation(); 86 domWindow()->resetLocation();
87 disconnectOwnerElement(); 87 disconnectOwnerElement();
88 // After this, we must no longer talk to the client since this clears 88 // After this, we must no longer talk to the client since this clears
89 // its owning reference back to our owning LocalFrame. 89 // its owning reference back to our owning LocalFrame.
90 m_client->detached(type); 90 m_client->detached();
91 m_client = nullptr; 91 m_client = nullptr;
92 m_host = nullptr; 92 m_host = nullptr;
93 } 93 }
94 94
95 void Frame::detachChildren() 95 void Frame::detachChildren()
96 { 96 {
97 typedef WillBeHeapVector<RefPtrWillBeMember<Frame>> FrameVector; 97 typedef WillBeHeapVector<RefPtrWillBeMember<Frame>> FrameVector;
98 FrameVector childrenToDetach; 98 FrameVector childrenToDetach;
99 childrenToDetach.reserveCapacity(tree().childCount()); 99 childrenToDetach.reserveCapacity(tree().childCount());
100 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi bling()) 100 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi bling())
101 childrenToDetach.append(child); 101 childrenToDetach.append(child);
102 for (const auto& child : childrenToDetach) 102 for (const auto& child : childrenToDetach)
103 child->detach(FrameDetachType::Remove); 103 child->detach();
104 } 104 }
105 105
106 void Frame::disconnectOwnerElement() 106 void Frame::disconnectOwnerElement()
107 { 107 {
108 if (m_owner) { 108 if (m_owner) {
109 if (m_owner->isLocal()) 109 if (m_owner->isLocal())
110 toHTMLFrameOwnerElement(m_owner)->clearContentFrame(); 110 toHTMLFrameOwnerElement(m_owner)->clearContentFrame();
111 } 111 }
112 m_owner = nullptr; 112 m_owner = nullptr;
113 } 113 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return client; 151 return client;
152 } 152 }
153 153
154 ChromeClient& Frame::chromeClient() const 154 ChromeClient& Frame::chromeClient() const
155 { 155 {
156 if (Page* page = this->page()) 156 if (Page* page = this->page())
157 return page->chromeClient(); 157 return page->chromeClient();
158 return emptyChromeClient(); 158 return emptyChromeClient();
159 } 159 }
160 160
161 void Frame::prepareSwapFrom(Frame* old)
162 {
163 WindowProxyManager* oldManager = old->windowProxyManager();
164 oldManager->clearForNavigation();
165 }
166
167 void Frame::finishSwapFrom(Frame* old) 161 void Frame::finishSwapFrom(Frame* old)
168 { 162 {
169 WindowProxyManager* oldManager = old->windowProxyManager(); 163 WindowProxyManager* oldManager = old->windowProxyManager();
164 // FIXME: In the future, the Blink API layer will be calling detach() on the
165 // old frame prior to completing the swap. However, detach calls
166 // clearForClose() instead of clearForNavigation(). Make sure this doesn't
167 // become a no-op when that lands, since it's important to detach the global .
168 oldManager->clearForNavigation();
170 windowProxyManager()->takeGlobalFrom(oldManager); 169 windowProxyManager()->takeGlobalFrom(oldManager);
171 } 170 }
172 171
173 Frame* Frame::findFrameForNavigation(const AtomicString& name, Frame& activeFram e) 172 Frame* Frame::findFrameForNavigation(const AtomicString& name, Frame& activeFram e)
174 { 173 {
175 Frame* frame = tree().find(name); 174 Frame* frame = tree().find(name);
176 if (!frame || !activeFrame.canNavigate(*frame)) 175 if (!frame || !activeFrame.canNavigate(*frame))
177 return nullptr; 176 return nullptr;
178 return frame; 177 return frame;
179 } 178 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 306
308 if (m_owner) { 307 if (m_owner) {
309 if (m_owner->isLocal()) 308 if (m_owner->isLocal())
310 toHTMLFrameOwnerElement(m_owner)->setContentFrame(*this); 309 toHTMLFrameOwnerElement(m_owner)->setContentFrame(*this);
311 } else { 310 } else {
312 page()->setMainFrame(this); 311 page()->setMainFrame(this);
313 } 312 }
314 } 313 }
315 314
316 } // namespace blink 315 } // 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