| 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 | |
| 208 #if !ENABLE(OILPAN) | 207 #if !ENABLE(OILPAN) |
| 209 // Oilpan: see setDOMWindow() comment why it is acceptable not to | 208 // Oilpan: see setDOMWindow() comment why it is acceptable not to |
| 210 // mirror the non-Oilpan call below. | 209 // explicitly call setDOMWindow() here. |
| 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. | |
| 216 setDOMWindow(nullptr); | 210 setDOMWindow(nullptr); |
| 217 | |
| 218 for (const auto& frameDestructionObserver : m_destructionObservers) | |
| 219 frameDestructionObserver->frameDestroyed(); | |
| 220 #endif | 211 #endif |
| 221 } | 212 } |
| 222 | 213 |
| 223 void LocalFrame::trace(Visitor* visitor) | 214 void LocalFrame::trace(Visitor* visitor) |
| 224 { | 215 { |
| 225 visitor->trace(m_instrumentingAgents); | 216 visitor->trace(m_instrumentingAgents); |
| 226 #if ENABLE(OILPAN) | 217 #if ENABLE(OILPAN) |
| 227 visitor->trace(m_destructionObservers); | 218 visitor->trace(m_destructionObservers); |
| 228 visitor->trace(m_loader); | 219 visitor->trace(m_loader); |
| 229 visitor->trace(m_navigationScheduler); | 220 visitor->trace(m_navigationScheduler); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 RefPtrWillBeRawPtr<LocalFrame> protect(this); | 265 RefPtrWillBeRawPtr<LocalFrame> protect(this); |
| 275 m_loader.stopAllLoaders(); | 266 m_loader.stopAllLoaders(); |
| 276 m_loader.dispatchUnloadEvent(); | 267 m_loader.dispatchUnloadEvent(); |
| 277 detachChildren(); | 268 detachChildren(); |
| 278 // stopAllLoaders() needs to be called after detachChildren(), because detac
hChildren() | 269 // stopAllLoaders() needs to be called after detachChildren(), because detac
hChildren() |
| 279 // will trigger the unload event handlers of any child frames, and those eve
nt | 270 // will trigger the unload event handlers of any child frames, and those eve
nt |
| 280 // handlers might start a new subresource load in this frame. | 271 // handlers might start a new subresource load in this frame. |
| 281 m_loader.stopAllLoaders(); | 272 m_loader.stopAllLoaders(); |
| 282 if (!client()) | 273 if (!client()) |
| 283 return; | 274 return; |
| 275 |
| 284 m_loader.detach(); | 276 m_loader.detach(); |
| 285 // Notify ScriptController that the frame is closing, since its cleanup ends
up calling | 277 // Notify ScriptController that the frame is closing, since its cleanup ends
up calling |
| 286 // back to FrameLoaderClient via WindowProxy. | 278 // back to FrameLoaderClient via WindowProxy. |
| 287 script().clearForClose(); | 279 script().clearForClose(); |
| 288 ScriptForbiddenScope forbidScript; | 280 ScriptForbiddenScope forbidScript; |
| 289 setView(nullptr); | 281 setView(nullptr); |
| 290 willDetachFrameHost(); | 282 willDetachFrameHost(); |
| 291 InspectorInstrumentation::frameDetachedFromParent(this); | 283 InspectorInstrumentation::frameDetachedFromParent(this); |
| 292 Frame::detach(); | 284 Frame::detach(); |
| 293 // Clear the FrameLoader right here rather than during | 285 // Clear the FrameLoader right here rather than during |
| 294 // finalization. Too late to access various heap objects at that | 286 // finalization. Too late to access various heap objects at that |
| 295 // stage. | 287 // stage. |
| 296 m_loader.clear(); | 288 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 |