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

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

Issue 896523004: Revert "Revert of Revert of Issue FrameDestructionObserver::frameDestroyed() notification on detach… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
« no previous file with comments | « Source/core/frame/FrameDestructionObserver.cpp ('k') | no next file » | 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 LocalFrame::~LocalFrame() 202 LocalFrame::~LocalFrame()
203 { 203 {
204 // Verify that the FrameView has been cleared as part of detaching 204 // Verify that the FrameView has been cleared as part of detaching
205 // the frame owner. 205 // the frame owner.
206 ASSERT(!m_view); 206 ASSERT(!m_view);
207 207
208 #if !ENABLE(OILPAN) 208 #if !ENABLE(OILPAN)
209 // Oilpan: see setDOMWindow() comment why it is acceptable not to 209 // Oilpan: see setDOMWindow() comment why it is acceptable not to
210 // mirror the non-Oilpan call below. 210 // mirror the non-Oilpan call below.
211 //
212 // Also, FrameDestructionObservers that live longer than this
213 // frame object keep weak references to the frame; those will be
214 // automatically cleared by the garbage collector. Hence, explicit
215 // frameDestroyed() notifications aren't needed.
211 setDOMWindow(nullptr); 216 setDOMWindow(nullptr);
217
218 for (const auto& frameDestructionObserver : m_destructionObservers)
219 frameDestructionObserver->frameDestroyed();
212 #endif 220 #endif
213 } 221 }
214 222
215 void LocalFrame::trace(Visitor* visitor) 223 void LocalFrame::trace(Visitor* visitor)
216 { 224 {
217 visitor->trace(m_instrumentingAgents); 225 visitor->trace(m_instrumentingAgents);
218 #if ENABLE(OILPAN) 226 #if ENABLE(OILPAN)
219 visitor->trace(m_destructionObservers); 227 visitor->trace(m_destructionObservers);
220 visitor->trace(m_loader); 228 visitor->trace(m_loader);
221 visitor->trace(m_navigationScheduler); 229 visitor->trace(m_navigationScheduler);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 script().clearForClose(); 287 script().clearForClose();
280 ScriptForbiddenScope forbidScript; 288 ScriptForbiddenScope forbidScript;
281 setView(nullptr); 289 setView(nullptr);
282 willDetachFrameHost(); 290 willDetachFrameHost();
283 InspectorInstrumentation::frameDetachedFromParent(this); 291 InspectorInstrumentation::frameDetachedFromParent(this);
284 Frame::detach(); 292 Frame::detach();
285 // Clear the FrameLoader right here rather than during 293 // Clear the FrameLoader right here rather than during
286 // finalization. Too late to access various heap objects at that 294 // finalization. Too late to access various heap objects at that
287 // stage. 295 // stage.
288 m_loader.clear(); 296 m_loader.clear();
289
290 // Signal frame destruction here rather than in the destructor.
291 // Main motivation is to avoid being dependent on its exact timing (Oilpan.)
292 for (const auto& frameDestructionObserver : m_destructionObservers)
293 frameDestructionObserver->frameDestroyed();
294 } 297 }
295 298
296 SecurityContext* LocalFrame::securityContext() const 299 SecurityContext* LocalFrame::securityContext() const
297 { 300 {
298 return document(); 301 return document();
299 } 302 }
300 303
301 void LocalFrame::printNavigationErrorMessage(const Frame& targetFrame, const cha r* reason) 304 void LocalFrame::printNavigationErrorMessage(const Frame& targetFrame, const cha r* reason)
302 { 305 {
303 if (!targetFrame.isLocalFrame()) 306 if (!targetFrame.isLocalFrame())
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 // We detach the FrameView's custom scroll bars as early as 836 // We detach the FrameView's custom scroll bars as early as
834 // possible to prevent m_doc->detach() from messing with the view 837 // possible to prevent m_doc->detach() from messing with the view
835 // such that its scroll bars won't be torn down. 838 // such that its scroll bars won't be torn down.
836 // 839 //
837 // FIXME: We should revisit this. 840 // FIXME: We should revisit this.
838 if (m_view) 841 if (m_view)
839 m_view->prepareForDetach(); 842 m_view->prepareForDetach();
840 } 843 }
841 844
842 } // namespace blink 845 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/FrameDestructionObserver.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698