OLD | NEW |
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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 197 |
198 if (HTMLFrameOwnerElement* owner = deprecatedLocalOwner()) | 198 if (HTMLFrameOwnerElement* owner = deprecatedLocalOwner()) |
199 view()->setCanHaveScrollbars(owner->scrollingMode() != ScrollbarAlwaysOf
f); | 199 view()->setCanHaveScrollbars(owner->scrollingMode() != ScrollbarAlwaysOf
f); |
200 } | 200 } |
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 #if !ENABLE(OILPAN) | 208 #if !ENABLE(OILPAN) |
208 // Oilpan: see setDOMWindow() comment why it is acceptable not to | 209 // Oilpan: see setDOMWindow() comment why it is acceptable not to |
209 // explicitly call setDOMWindow() here. | 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. |
210 setDOMWindow(nullptr); | 216 setDOMWindow(nullptr); |
| 217 |
| 218 for (const auto& frameDestructionObserver : m_destructionObservers) |
| 219 frameDestructionObserver->frameDestroyed(); |
211 #endif | 220 #endif |
212 } | 221 } |
213 | 222 |
214 void LocalFrame::trace(Visitor* visitor) | 223 void LocalFrame::trace(Visitor* visitor) |
215 { | 224 { |
216 visitor->trace(m_instrumentingAgents); | 225 visitor->trace(m_instrumentingAgents); |
217 #if ENABLE(OILPAN) | 226 #if ENABLE(OILPAN) |
218 visitor->trace(m_destructionObservers); | 227 visitor->trace(m_destructionObservers); |
219 visitor->trace(m_loader); | 228 visitor->trace(m_loader); |
220 visitor->trace(m_navigationScheduler); | 229 visitor->trace(m_navigationScheduler); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 RefPtrWillBeRawPtr<LocalFrame> protect(this); | 274 RefPtrWillBeRawPtr<LocalFrame> protect(this); |
266 m_loader.stopAllLoaders(); | 275 m_loader.stopAllLoaders(); |
267 m_loader.dispatchUnloadEvent(); | 276 m_loader.dispatchUnloadEvent(); |
268 detachChildren(); | 277 detachChildren(); |
269 // stopAllLoaders() needs to be called after detachChildren(), because detac
hChildren() | 278 // stopAllLoaders() needs to be called after detachChildren(), because detac
hChildren() |
270 // will trigger the unload event handlers of any child frames, and those eve
nt | 279 // will trigger the unload event handlers of any child frames, and those eve
nt |
271 // handlers might start a new subresource load in this frame. | 280 // handlers might start a new subresource load in this frame. |
272 m_loader.stopAllLoaders(); | 281 m_loader.stopAllLoaders(); |
273 if (!client()) | 282 if (!client()) |
274 return; | 283 return; |
275 | |
276 m_loader.detach(); | 284 m_loader.detach(); |
277 // Notify ScriptController that the frame is closing, since its cleanup ends
up calling | 285 // Notify ScriptController that the frame is closing, since its cleanup ends
up calling |
278 // back to FrameLoaderClient via WindowProxy. | 286 // back to FrameLoaderClient via WindowProxy. |
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 | |
295 m_destructionObservers.clear(); | |
296 m_supplements.clear(); | |
297 } | 297 } |
298 | 298 |
299 SecurityContext* LocalFrame::securityContext() const | 299 SecurityContext* LocalFrame::securityContext() const |
300 { | 300 { |
301 return document(); | 301 return document(); |
302 } | 302 } |
303 | 303 |
304 void LocalFrame::printNavigationErrorMessage(const Frame& targetFrame, const cha
r* reason) | 304 void LocalFrame::printNavigationErrorMessage(const Frame& targetFrame, const cha
r* reason) |
305 { | 305 { |
306 if (!targetFrame.isLocalFrame()) | 306 if (!targetFrame.isLocalFrame()) |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 // We detach the FrameView's custom scroll bars as early as | 836 // We detach the FrameView's custom scroll bars as early as |
837 // possible to prevent m_doc->detach() from messing with the view | 837 // possible to prevent m_doc->detach() from messing with the view |
838 // such that its scroll bars won't be torn down. | 838 // such that its scroll bars won't be torn down. |
839 // | 839 // |
840 // FIXME: We should revisit this. | 840 // FIXME: We should revisit this. |
841 if (m_view) | 841 if (m_view) |
842 m_view->prepareForDetach(); | 842 m_view->prepareForDetach(); |
843 } | 843 } |
844 | 844 |
845 } // namespace blink | 845 } // namespace blink |
OLD | NEW |