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

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

Issue 881683003: Issue FrameDestructionObserver::frameDestroyed() notification on detach. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: inline temporary helper, tidy Created 5 years, 10 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 199
200 LocalFrame::~LocalFrame() 200 LocalFrame::~LocalFrame()
201 { 201 {
202 // Verify that the FrameView has been cleared as part of detaching 202 // Verify that the FrameView has been cleared as part of detaching
203 // the frame owner. 203 // the frame owner.
204 ASSERT(!m_view); 204 ASSERT(!m_view);
205 205
206 #if !ENABLE(OILPAN) 206 #if !ENABLE(OILPAN)
207 // Oilpan: see setDOMWindow() comment why it is acceptable not to 207 // Oilpan: see setDOMWindow() comment why it is acceptable not to
208 // mirror the non-Oilpan call below. 208 // mirror the non-Oilpan call below.
209 //
210 // Also, FrameDestructionObservers that live longer than this
211 // frame object keep weak references to the frame; those will be
212 // automatically cleared by the garbage collector. Hence, explicit
213 // frameDestroyed() notifications aren't needed.
214 setDOMWindow(nullptr); 209 setDOMWindow(nullptr);
215
216 for (const auto& frameDestructionObserver : m_destructionObservers)
217 frameDestructionObserver->frameDestroyed();
218 #endif 210 #endif
219 } 211 }
220 212
221 void LocalFrame::trace(Visitor* visitor) 213 void LocalFrame::trace(Visitor* visitor)
222 { 214 {
223 #if ENABLE(OILPAN) 215 #if ENABLE(OILPAN)
224 visitor->trace(m_destructionObservers); 216 visitor->trace(m_destructionObservers);
225 visitor->trace(m_loader); 217 visitor->trace(m_loader);
226 visitor->trace(m_navigationScheduler); 218 visitor->trace(m_navigationScheduler);
227 visitor->trace(m_view); 219 visitor->trace(m_view);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 script().clearForClose(); 276 script().clearForClose();
285 ScriptForbiddenScope forbidScript; 277 ScriptForbiddenScope forbidScript;
286 setView(nullptr); 278 setView(nullptr);
287 willDetachFrameHost(); 279 willDetachFrameHost();
288 InspectorInstrumentation::frameDetachedFromParent(this); 280 InspectorInstrumentation::frameDetachedFromParent(this);
289 Frame::detach(); 281 Frame::detach();
290 // Clear the FrameLoader right here rather than during 282 // Clear the FrameLoader right here rather than during
291 // finalization. Too late to access various heap objects at that 283 // finalization. Too late to access various heap objects at that
292 // stage. 284 // stage.
293 m_loader.clear(); 285 m_loader.clear();
286
287 // Signal frame destruction here rather than in the destructor.
288 // Main motivation is to avoid being dependent on its exact timing (Oilpan.)
289 for (const auto& frameDestructionObserver : m_destructionObservers)
290 frameDestructionObserver->frameDestroyed();
haraken 2015/01/31 01:30:01 Nit: In a follow-up CL, we might want to replace F
294 } 291 }
295 292
296 SecurityContext* LocalFrame::securityContext() const 293 SecurityContext* LocalFrame::securityContext() const
297 { 294 {
298 return document(); 295 return document();
299 } 296 }
300 297
301 void LocalFrame::printNavigationErrorMessage(const Frame& targetFrame, const cha r* reason) 298 void LocalFrame::printNavigationErrorMessage(const Frame& targetFrame, const cha r* reason)
302 { 299 {
303 if (!targetFrame.isLocalFrame()) 300 if (!targetFrame.isLocalFrame())
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 // We detach the FrameView's custom scroll bars as early as 819 // We detach the FrameView's custom scroll bars as early as
823 // possible to prevent m_doc->detach() from messing with the view 820 // possible to prevent m_doc->detach() from messing with the view
824 // such that its scroll bars won't be torn down. 821 // such that its scroll bars won't be torn down.
825 // 822 //
826 // FIXME: We should revisit this. 823 // FIXME: We should revisit this.
827 if (m_view) 824 if (m_view)
828 m_view->prepareForDetach(); 825 m_view->prepareForDetach();
829 } 826 }
830 827
831 } // namespace blink 828 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698