| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 PassRefPtrWillBeRawPtr<LocalFrame> LocalFrame::create(FrameLoaderClient* client,
FrameHost* host, FrameOwner* owner) | 125 PassRefPtrWillBeRawPtr<LocalFrame> LocalFrame::create(FrameLoaderClient* client,
FrameHost* host, FrameOwner* owner) |
| 126 { | 126 { |
| 127 RefPtrWillBeRawPtr<LocalFrame> frame = adoptRefWillBeNoop(new LocalFrame(cli
ent, host, owner)); | 127 RefPtrWillBeRawPtr<LocalFrame> frame = adoptRefWillBeNoop(new LocalFrame(cli
ent, host, owner)); |
| 128 InspectorInstrumentation::frameAttachedToParent(frame.get()); | 128 InspectorInstrumentation::frameAttachedToParent(frame.get()); |
| 129 return frame.release(); | 129 return frame.release(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void LocalFrame::setView(PassRefPtrWillBeRawPtr<FrameView> view) | 132 void LocalFrame::setView(PassRefPtrWillBeRawPtr<FrameView> view) |
| 133 { | 133 { |
| 134 ASSERT(!m_view || m_view != view); | 134 ASSERT(!m_view || m_view != view); |
| 135 ASSERT(!document() || !document()->isActive()); |
| 136 |
| 135 detachView(); | 137 detachView(); |
| 136 | |
| 137 // Prepare for destruction now, so any unload event handlers get run and the
LocalDOMWindow is | |
| 138 // notified. If we wait until the view is destroyed, then things won't be ho
oked up enough for | |
| 139 // these calls to work. | |
| 140 if (!view && document() && document()->isActive()) { | |
| 141 // FIXME: We don't call willRemove here. Why is that OK? | |
| 142 document()->prepareForDestruction(); | |
| 143 } | |
| 144 | |
| 145 eventHandler().clear(); | 138 eventHandler().clear(); |
| 146 | 139 |
| 147 m_view = view; | 140 m_view = view; |
| 148 } | 141 } |
| 149 | 142 |
| 150 void LocalFrame::createView(const IntSize& viewportSize, const Color& background
Color, bool transparent, | 143 void LocalFrame::createView(const IntSize& viewportSize, const Color& background
Color, bool transparent, |
| 151 ScrollbarMode horizontalScrollbarMode, bool horizontalLock, | 144 ScrollbarMode horizontalScrollbarMode, bool horizontalLock, |
| 152 ScrollbarMode verticalScrollbarMode, bool verticalLock) | 145 ScrollbarMode verticalScrollbarMode, bool verticalLock) |
| 153 { | 146 { |
| 154 ASSERT(this); | 147 ASSERT(this); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 // detached, so protect a reference to it. | 253 // detached, so protect a reference to it. |
| 261 RefPtrWillBeRawPtr<LocalFrame> protect(this); | 254 RefPtrWillBeRawPtr<LocalFrame> protect(this); |
| 262 m_loader.stopAllLoaders(); | 255 m_loader.stopAllLoaders(); |
| 263 m_loader.dispatchUnloadEvent(); | 256 m_loader.dispatchUnloadEvent(); |
| 264 detachChildren(); | 257 detachChildren(); |
| 265 // stopAllLoaders() needs to be called after detachChildren(), because detac
hChildren() | 258 // stopAllLoaders() needs to be called after detachChildren(), because detac
hChildren() |
| 266 // will trigger the unload event handlers of any child frames, and those eve
nt | 259 // will trigger the unload event handlers of any child frames, and those eve
nt |
| 267 // handlers might start a new subresource load in this frame. | 260 // handlers might start a new subresource load in this frame. |
| 268 m_loader.stopAllLoaders(); | 261 m_loader.stopAllLoaders(); |
| 269 m_loader.detach(); | 262 m_loader.detach(); |
| 263 document()->prepareForDestruction(); |
| 264 m_loader.clear(); |
| 270 if (!client()) | 265 if (!client()) |
| 271 return; | 266 return; |
| 272 | 267 |
| 273 client()->willBeDetached(); | 268 client()->willBeDetached(); |
| 274 // Notify ScriptController that the frame is closing, since its cleanup ends
up calling | 269 // Notify ScriptController that the frame is closing, since its cleanup ends
up calling |
| 275 // back to FrameLoaderClient via WindowProxy. | 270 // back to FrameLoaderClient via WindowProxy. |
| 276 script().clearForClose(); | 271 script().clearForClose(); |
| 277 ScriptForbiddenScope forbidScript; | 272 ScriptForbiddenScope forbidScript; |
| 278 setView(nullptr); | 273 setView(nullptr); |
| 279 willDetachFrameHost(); | 274 willDetachFrameHost(); |
| 280 InspectorInstrumentation::frameDetachedFromParent(this); | 275 InspectorInstrumentation::frameDetachedFromParent(this); |
| 281 Frame::detach(); | 276 Frame::detach(); |
| 282 // Clear the FrameLoader right here rather than during | |
| 283 // finalization. Too late to access various heap objects at that | |
| 284 // stage. | |
| 285 m_loader.clear(); | |
| 286 | 277 |
| 287 // Signal frame destruction here rather than in the destructor. | 278 // Signal frame destruction here rather than in the destructor. |
| 288 // Main motivation is to avoid being dependent on its exact timing (Oilpan.) | 279 // Main motivation is to avoid being dependent on its exact timing (Oilpan.) |
| 289 LocalFrameLifecycleNotifier::notifyContextDestroyed(); | 280 LocalFrameLifecycleNotifier::notifyContextDestroyed(); |
| 290 m_supplements.clear(); | 281 m_supplements.clear(); |
| 291 } | 282 } |
| 292 | 283 |
| 293 SecurityContext* LocalFrame::securityContext() const | 284 SecurityContext* LocalFrame::securityContext() const |
| 294 { | 285 { |
| 295 return document(); | 286 return document(); |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 // We detach the FrameView's custom scroll bars as early as | 830 // We detach the FrameView's custom scroll bars as early as |
| 840 // possible to prevent m_doc->detach() from messing with the view | 831 // possible to prevent m_doc->detach() from messing with the view |
| 841 // such that its scroll bars won't be torn down. | 832 // such that its scroll bars won't be torn down. |
| 842 // | 833 // |
| 843 // FIXME: We should revisit this. | 834 // FIXME: We should revisit this. |
| 844 if (m_view) | 835 if (m_view) |
| 845 m_view->prepareForDetach(); | 836 m_view->prepareForDetach(); |
| 846 } | 837 } |
| 847 | 838 |
| 848 } // namespace blink | 839 } // namespace blink |
| OLD | NEW |