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

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
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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 void LocalFrame::reload(ReloadPolicy reloadPolicy, ClientRedirectPolicy clientRe directPolicy) 254 void LocalFrame::reload(ReloadPolicy reloadPolicy, ClientRedirectPolicy clientRe directPolicy)
255 { 255 {
256 ASSERT(clientRedirectPolicy == NotClientRedirect || reloadPolicy == NormalRe load); 256 ASSERT(clientRedirectPolicy == NotClientRedirect || reloadPolicy == NormalRe load);
257 if (clientRedirectPolicy == NotClientRedirect) 257 if (clientRedirectPolicy == NotClientRedirect)
258 m_loader.reload(reloadPolicy); 258 m_loader.reload(reloadPolicy);
259 else 259 else
260 m_navigationScheduler.scheduleReload(); 260 m_navigationScheduler.scheduleReload();
261 } 261 }
262 262
263 void LocalFrame::detach() 263 void LocalFrame::detach(FrameDetachType type)
264 { 264 {
265 // A lot of the following steps can result in the current frame being 265 // A lot of the following steps can result in the current frame being
266 // detached, so protect a reference to it. 266 // detached, so protect a reference to it.
267 RefPtrWillBeRawPtr<LocalFrame> protect(this); 267 RefPtrWillBeRawPtr<LocalFrame> protect(this);
268 m_loader.stopAllLoaders(); 268 m_loader.stopAllLoaders();
269 m_loader.dispatchUnloadEvent(); 269 m_loader.dispatchUnloadEvent();
270 detachChildren(); 270 detachChildren();
271 // stopAllLoaders() needs to be called after detachChildren(), because detac hChildren() 271 // stopAllLoaders() needs to be called after detachChildren(), because detac hChildren()
272 // will trigger the unload event handlers of any child frames, and those eve nt 272 // will trigger the unload event handlers of any child frames, and those eve nt
273 // handlers might start a new subresource load in this frame. 273 // handlers might start a new subresource load in this frame.
274 m_loader.stopAllLoaders(); 274 m_loader.stopAllLoaders();
275 m_loader.detach(); 275 m_loader.detach();
276 document()->detach(); 276 document()->detach();
277 m_loader.clear(); 277 m_loader.clear();
278 if (!client()) 278 if (!client())
279 return; 279 return;
280 280
281 client()->willBeDetached(); 281 client()->willBeDetached();
282 // Notify ScriptController that the frame is closing, since its cleanup ends up calling 282 // Notify ScriptController that the frame is closing, since its cleanup ends up calling
283 // back to FrameLoaderClient via WindowProxy. 283 // back to FrameLoaderClient via WindowProxy.
284 script().clearForClose(); 284 script().clearForClose();
285 ScriptForbiddenScope forbidScript; 285 ScriptForbiddenScope forbidScript;
286 setView(nullptr); 286 setView(nullptr);
287 willDetachFrameHost(); 287 willDetachFrameHost();
288 InspectorInstrumentation::frameDetachedFromParent(this); 288 InspectorInstrumentation::frameDetachedFromParent(this);
289 Frame::detach(); 289 Frame::detach(type);
290 290
291 // Signal frame destruction here rather than in the destructor. 291 // Signal frame destruction here rather than in the destructor.
292 // Main motivation is to avoid being dependent on its exact timing (Oilpan.) 292 // Main motivation is to avoid being dependent on its exact timing (Oilpan.)
293 LocalFrameLifecycleNotifier::notifyContextDestroyed(); 293 LocalFrameLifecycleNotifier::notifyContextDestroyed();
294 m_supplements.clear(); 294 m_supplements.clear();
295 WeakIdentifierMap<LocalFrame>::notifyObjectDestroyed(this); 295 WeakIdentifierMap<LocalFrame>::notifyObjectDestroyed(this);
296 } 296 }
297 297
298 SecurityContext* LocalFrame::securityContext() const 298 SecurityContext* LocalFrame::securityContext() const
299 { 299 {
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 , m_textZoomFactor(parentTextZoomFactor(this)) 812 , m_textZoomFactor(parentTextZoomFactor(this))
813 , m_inViewSourceMode(false) 813 , m_inViewSourceMode(false)
814 { 814 {
815 if (isLocalRoot()) 815 if (isLocalRoot())
816 m_instrumentingAgents = InstrumentingAgents::create(); 816 m_instrumentingAgents = InstrumentingAgents::create();
817 else 817 else
818 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents; 818 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents;
819 } 819 }
820 820
821 } // namespace blink 821 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698