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

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

Issue 896103002: 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 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.
209 setDOMWindow(nullptr); 214 setDOMWindow(nullptr);
215
216 for (const auto& frameDestructionObserver : m_destructionObservers)
217 frameDestructionObserver->frameDestroyed();
210 #endif 218 #endif
211 } 219 }
212 220
213 void LocalFrame::trace(Visitor* visitor) 221 void LocalFrame::trace(Visitor* visitor)
214 { 222 {
215 #if ENABLE(OILPAN) 223 #if ENABLE(OILPAN)
216 visitor->trace(m_destructionObservers); 224 visitor->trace(m_destructionObservers);
217 visitor->trace(m_loader); 225 visitor->trace(m_loader);
218 visitor->trace(m_navigationScheduler); 226 visitor->trace(m_navigationScheduler);
219 visitor->trace(m_view); 227 visitor->trace(m_view);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 script().clearForClose(); 284 script().clearForClose();
277 ScriptForbiddenScope forbidScript; 285 ScriptForbiddenScope forbidScript;
278 setView(nullptr); 286 setView(nullptr);
279 willDetachFrameHost(); 287 willDetachFrameHost();
280 InspectorInstrumentation::frameDetachedFromParent(this); 288 InspectorInstrumentation::frameDetachedFromParent(this);
281 Frame::detach(); 289 Frame::detach();
282 // Clear the FrameLoader right here rather than during 290 // Clear the FrameLoader right here rather than during
283 // finalization. Too late to access various heap objects at that 291 // finalization. Too late to access various heap objects at that
284 // stage. 292 // stage.
285 m_loader.clear(); 293 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();
291 } 294 }
292 295
293 SecurityContext* LocalFrame::securityContext() const 296 SecurityContext* LocalFrame::securityContext() const
294 { 297 {
295 return document(); 298 return document();
296 } 299 }
297 300
298 void LocalFrame::printNavigationErrorMessage(const Frame& targetFrame, const cha r* reason) 301 void LocalFrame::printNavigationErrorMessage(const Frame& targetFrame, const cha r* reason)
299 { 302 {
300 if (!targetFrame.isLocalFrame()) 303 if (!targetFrame.isLocalFrame())
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 // We detach the FrameView's custom scroll bars as early as 822 // We detach the FrameView's custom scroll bars as early as
820 // possible to prevent m_doc->detach() from messing with the view 823 // possible to prevent m_doc->detach() from messing with the view
821 // such that its scroll bars won't be torn down. 824 // such that its scroll bars won't be torn down.
822 // 825 //
823 // FIXME: We should revisit this. 826 // FIXME: We should revisit this.
824 if (m_view) 827 if (m_view)
825 m_view->prepareForDetach(); 828 m_view->prepareForDetach();
826 } 829 }
827 830
828 } // namespace blink 831 } // 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