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

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

Issue 1041473002: 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/LocalFrame.h ('k') | Source/core/frame/RemoteFrame.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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 return; 266 return;
267 FrameLoadRequest request = FrameLoadRequest( 267 FrameLoadRequest request = FrameLoadRequest(
268 nullptr, m_loader.resourceRequestForReload(loadType, KURL(), clientR edirectPolicy)); 268 nullptr, m_loader.resourceRequestForReload(loadType, KURL(), clientR edirectPolicy));
269 request.setClientRedirect(clientRedirectPolicy); 269 request.setClientRedirect(clientRedirectPolicy);
270 m_loader.load(request, loadType); 270 m_loader.load(request, loadType);
271 } else { 271 } else {
272 m_navigationScheduler.scheduleReload(); 272 m_navigationScheduler.scheduleReload();
273 } 273 }
274 } 274 }
275 275
276 void LocalFrame::detach() 276 void LocalFrame::detach(FrameDetachType type)
277 { 277 {
278 PluginScriptForbiddenScope forbidPluginDestructorScripting; 278 PluginScriptForbiddenScope forbidPluginDestructorScripting;
279 // A lot of the following steps can result in the current frame being 279 // A lot of the following steps can result in the current frame being
280 // detached, so protect a reference to it. 280 // detached, so protect a reference to it.
281 RefPtrWillBeRawPtr<LocalFrame> protect(this); 281 RefPtrWillBeRawPtr<LocalFrame> protect(this);
282 m_loader.stopAllLoaders(); 282 m_loader.stopAllLoaders();
283 m_loader.dispatchUnloadEvent(); 283 m_loader.dispatchUnloadEvent();
284 detachChildren(); 284 detachChildren();
285 // stopAllLoaders() needs to be called after detachChildren(), because detac hChildren() 285 // stopAllLoaders() needs to be called after detachChildren(), because detac hChildren()
286 // will trigger the unload event handlers of any child frames, and those eve nt 286 // will trigger the unload event handlers of any child frames, and those eve nt
287 // handlers might start a new subresource load in this frame. 287 // handlers might start a new subresource load in this frame.
288 m_loader.stopAllLoaders(); 288 m_loader.stopAllLoaders();
289 m_loader.detach(); 289 m_loader.detach();
290 document()->detach(); 290 document()->detach();
291 m_loader.clear(); 291 m_loader.clear();
292 if (!client()) 292 if (!client())
293 return; 293 return;
294 294
295 client()->willBeDetached(); 295 client()->willBeDetached();
296 // Notify ScriptController that the frame is closing, since its cleanup ends up calling 296 // Notify ScriptController that the frame is closing, since its cleanup ends up calling
297 // back to FrameLoaderClient via WindowProxy. 297 // back to FrameLoaderClient via WindowProxy.
298 script().clearForClose(); 298 script().clearForClose();
299 ScriptForbiddenScope forbidScript; 299 ScriptForbiddenScope forbidScript;
300 setView(nullptr); 300 setView(nullptr);
301 willDetachFrameHost(); 301 willDetachFrameHost();
302 InspectorInstrumentation::frameDetachedFromParent(this); 302 InspectorInstrumentation::frameDetachedFromParent(this);
303 Frame::detach(); 303 Frame::detach(type);
304 304
305 // Signal frame destruction here rather than in the destructor. 305 // Signal frame destruction here rather than in the destructor.
306 // Main motivation is to avoid being dependent on its exact timing (Oilpan.) 306 // Main motivation is to avoid being dependent on its exact timing (Oilpan.)
307 LocalFrameLifecycleNotifier::notifyContextDestroyed(); 307 LocalFrameLifecycleNotifier::notifyContextDestroyed();
308 m_supplements.clear(); 308 m_supplements.clear();
309 WeakIdentifierMap<LocalFrame>::notifyObjectDestroyed(this); 309 WeakIdentifierMap<LocalFrame>::notifyObjectDestroyed(this);
310 } 310 }
311 311
312 bool LocalFrame::prepareForCommit()
313 {
314 return loader().prepareForCommit();
315 }
316
312 SecurityContext* LocalFrame::securityContext() const 317 SecurityContext* LocalFrame::securityContext() const
313 { 318 {
314 return document(); 319 return document();
315 } 320 }
316 321
317 void LocalFrame::printNavigationErrorMessage(const Frame& targetFrame, const cha r* reason) 322 void LocalFrame::printNavigationErrorMessage(const Frame& targetFrame, const cha r* reason)
318 { 323 {
319 // URLs aren't available for RemoteFrames, so the error message uses their 324 // URLs aren't available for RemoteFrames, so the error message uses their
320 // origin instead. 325 // origin instead.
321 String targetFrameDescription = targetFrame.isLocalFrame() ? "with URL '" + toLocalFrame(targetFrame).document()->url().string() + "'" : "with origin '" + t argetFrame.securityContext()->securityOrigin()->toString() + "'"; 326 String targetFrameDescription = targetFrame.isLocalFrame() ? "with URL '" + toLocalFrame(targetFrame).document()->url().string() + "'" : "with origin '" + t argetFrame.securityContext()->securityOrigin()->toString() + "'";
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 , m_textZoomFactor(parentTextZoomFactor(this)) 832 , m_textZoomFactor(parentTextZoomFactor(this))
828 , m_inViewSourceMode(false) 833 , m_inViewSourceMode(false)
829 { 834 {
830 if (isLocalRoot()) 835 if (isLocalRoot())
831 m_instrumentingAgents = InstrumentingAgents::create(); 836 m_instrumentingAgents = InstrumentingAgents::create();
832 else 837 else
833 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents; 838 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents;
834 } 839 }
835 840
836 } // namespace blink 841 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/LocalFrame.h ('k') | Source/core/frame/RemoteFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698