Chromium Code Reviews| 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 30 matching lines...) Expand all Loading... | |
| 41 #include "core/events/Event.h" | 41 #include "core/events/Event.h" |
| 42 #include "core/fetch/ResourceFetcher.h" | 42 #include "core/fetch/ResourceFetcher.h" |
| 43 #include "core/frame/EventHandlerRegistry.h" | 43 #include "core/frame/EventHandlerRegistry.h" |
| 44 #include "core/frame/FrameConsole.h" | 44 #include "core/frame/FrameConsole.h" |
| 45 #include "core/frame/FrameDestructionObserver.h" | 45 #include "core/frame/FrameDestructionObserver.h" |
| 46 #include "core/frame/FrameHost.h" | 46 #include "core/frame/FrameHost.h" |
| 47 #include "core/frame/FrameView.h" | 47 #include "core/frame/FrameView.h" |
| 48 #include "core/frame/LocalDOMWindow.h" | 48 #include "core/frame/LocalDOMWindow.h" |
| 49 #include "core/frame/Settings.h" | 49 #include "core/frame/Settings.h" |
| 50 #include "core/html/HTMLFrameElementBase.h" | 50 #include "core/html/HTMLFrameElementBase.h" |
| 51 #include "core/html/HTMLPlugInElement.h" | |
| 51 #include "core/inspector/ConsoleMessageStorage.h" | 52 #include "core/inspector/ConsoleMessageStorage.h" |
| 52 #include "core/inspector/InspectorInstrumentation.h" | 53 #include "core/inspector/InspectorInstrumentation.h" |
| 53 #include "core/loader/FrameLoaderClient.h" | 54 #include "core/loader/FrameLoaderClient.h" |
| 54 #include "core/page/Chrome.h" | 55 #include "core/page/Chrome.h" |
| 55 #include "core/page/EventHandler.h" | 56 #include "core/page/EventHandler.h" |
| 56 #include "core/page/FocusController.h" | 57 #include "core/page/FocusController.h" |
| 57 #include "core/page/Page.h" | 58 #include "core/page/Page.h" |
| 58 #include "core/page/scrolling/ScrollingCoordinator.h" | 59 #include "core/page/scrolling/ScrollingCoordinator.h" |
| 59 #include "core/rendering/HitTestResult.h" | 60 #include "core/rendering/HitTestResult.h" |
| 60 #include "core/rendering/RenderLayer.h" | 61 #include "core/rendering/RenderLayer.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 (*it)->frameDestroyed(); | 139 (*it)->frameDestroyed(); |
| 139 #endif | 140 #endif |
| 140 } | 141 } |
| 141 | 142 |
| 142 void LocalFrame::trace(Visitor* visitor) | 143 void LocalFrame::trace(Visitor* visitor) |
| 143 { | 144 { |
| 144 #if ENABLE(OILPAN) | 145 #if ENABLE(OILPAN) |
| 145 visitor->trace(m_destructionObservers); | 146 visitor->trace(m_destructionObservers); |
| 146 visitor->trace(m_loader); | 147 visitor->trace(m_loader); |
| 147 visitor->trace(m_navigationScheduler); | 148 visitor->trace(m_navigationScheduler); |
| 149 visitor->trace(m_view); | |
| 148 visitor->trace(m_pagePopupOwner); | 150 visitor->trace(m_pagePopupOwner); |
| 149 visitor->trace(m_script); | 151 visitor->trace(m_script); |
| 150 visitor->trace(m_editor); | 152 visitor->trace(m_editor); |
| 151 visitor->trace(m_spellChecker); | 153 visitor->trace(m_spellChecker); |
| 152 visitor->trace(m_selection); | 154 visitor->trace(m_selection); |
| 153 visitor->trace(m_eventHandler); | 155 visitor->trace(m_eventHandler); |
| 154 visitor->trace(m_console); | 156 visitor->trace(m_console); |
| 155 visitor->trace(m_inputMethodController); | 157 visitor->trace(m_inputMethodController); |
| 158 visitor->trace(m_pluginElements); | |
|
haraken
2014/10/11 17:33:02
Is it safe to trace m_pluginElements? There is no
sof
2014/10/12 08:16:22
It is safe with the weak callback stack that the i
haraken
2014/10/12 12:56:04
I'm suggesting the first one :)
If I'm understand
sof
2014/10/12 13:09:12
It does not always return true; if no one has mark
haraken
2014/10/12 13:38:23
Do you know how it's guaranteed that weak processi
sof
2014/10/12 16:22:13
There are no such guarantees, but the weak callbac
sof
2014/10/12 18:35:36
I've switched m_pluginElements to HashSet<HTMLPlug
| |
| 159 visitor->registerWeakMembers<LocalFrame, &LocalFrame::clearWeakMembers>(this ); | |
| 156 HeapSupplementable<LocalFrame>::trace(visitor); | 160 HeapSupplementable<LocalFrame>::trace(visitor); |
| 157 #endif | 161 #endif |
| 158 Frame::trace(visitor); | 162 Frame::trace(visitor); |
| 159 } | 163 } |
| 160 | 164 |
| 165 #if ENABLE(OILPAN) | |
| 166 void LocalFrame::clearWeakMembers(Visitor* visitor) | |
| 167 { | |
| 168 for (HeapHashSet<WeakMember<HTMLPlugInElement> >::const_iterator it = m_plug inElements.begin(); it != m_pluginElements.end(); ++it) { | |
| 169 if (!visitor->isAlive(*it)) | |
| 170 (*it)->shouldDisposePlugin(); | |
|
haraken
2014/10/11 17:33:02
shouldDisposePlugin() only does simple things and
sof
2014/10/12 08:16:22
How would you know if the LocalFrame is still aliv
haraken
2014/10/12 12:56:04
I'm a bit confused. Pre-finalizers are invoked bef
sof
2014/10/12 13:09:12
It's still alive, yes. But the plugin is allowed t
haraken
2014/10/12 13:38:23
I agree that dispose() does a bunch of things, but
sof
2014/10/12 16:22:13
Yes, it does not, but it should only be called/sig
| |
| 171 } | |
| 172 } | |
| 173 #endif | |
| 174 | |
| 161 void LocalFrame::navigate(Document& originDocument, const KURL& url, bool lockBa ckForwardList) | 175 void LocalFrame::navigate(Document& originDocument, const KURL& url, bool lockBa ckForwardList) |
| 162 { | 176 { |
| 163 m_navigationScheduler.scheduleLocationChange(&originDocument, url.string(), lockBackForwardList); | 177 m_navigationScheduler.scheduleLocationChange(&originDocument, url.string(), lockBackForwardList); |
| 164 } | 178 } |
| 165 | 179 |
| 166 void LocalFrame::detach() | 180 void LocalFrame::detach() |
| 167 { | 181 { |
| 168 // A lot of the following steps can result in the current frame being | 182 // A lot of the following steps can result in the current frame being |
| 169 // detached, so protect a reference to it. | 183 // detached, so protect a reference to it. |
| 170 RefPtrWillBeRawPtr<LocalFrame> protect(this); | 184 RefPtrWillBeRawPtr<LocalFrame> protect(this); |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 195 { | 209 { |
| 196 // We detach the FrameView's custom scroll bars as early as | 210 // We detach the FrameView's custom scroll bars as early as |
| 197 // possible to prevent m_doc->detach() from messing with the view | 211 // possible to prevent m_doc->detach() from messing with the view |
| 198 // such that its scroll bars won't be torn down. | 212 // such that its scroll bars won't be torn down. |
| 199 // | 213 // |
| 200 // FIXME: We should revisit this. | 214 // FIXME: We should revisit this. |
| 201 if (m_view) | 215 if (m_view) |
| 202 m_view->prepareForDetach(); | 216 m_view->prepareForDetach(); |
| 203 } | 217 } |
| 204 | 218 |
| 205 void LocalFrame::setView(PassRefPtr<FrameView> view) | 219 void LocalFrame::setView(PassRefPtrWillBeRawPtr<FrameView> view) |
| 206 { | 220 { |
| 221 ASSERT(!m_view || m_view != view); | |
| 207 detachView(); | 222 detachView(); |
| 208 | 223 |
| 209 // Prepare for destruction now, so any unload event handlers get run and the LocalDOMWindow is | 224 // Prepare for destruction now, so any unload event handlers get run and the LocalDOMWindow is |
| 210 // notified. If we wait until the view is destroyed, then things won't be ho oked up enough for | 225 // notified. If we wait until the view is destroyed, then things won't be ho oked up enough for |
| 211 // these calls to work. | 226 // these calls to work. |
| 212 if (!view && document() && document()->isActive()) { | 227 if (!view && document() && document()->isActive()) { |
| 213 // FIXME: We don't call willRemove here. Why is that OK? | 228 // FIXME: We don't call willRemove here. Why is that OK? |
| 214 document()->prepareForDestruction(); | 229 document()->prepareForDestruction(); |
| 215 } | 230 } |
| 216 | 231 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 441 ASSERT(this); | 456 ASSERT(this); |
| 442 ASSERT(page()); | 457 ASSERT(page()); |
| 443 | 458 |
| 444 bool isLocalRoot = this->isLocalRoot(); | 459 bool isLocalRoot = this->isLocalRoot(); |
| 445 | 460 |
| 446 if (isLocalRoot && view()) | 461 if (isLocalRoot && view()) |
| 447 view()->setParentVisible(false); | 462 view()->setParentVisible(false); |
| 448 | 463 |
| 449 setView(nullptr); | 464 setView(nullptr); |
| 450 | 465 |
| 451 RefPtr<FrameView> frameView; | 466 RefPtrWillBeRawPtr<FrameView> frameView = nullptr; |
| 452 if (isLocalRoot) { | 467 if (isLocalRoot) { |
| 453 frameView = FrameView::create(this, viewportSize); | 468 frameView = FrameView::create(this, viewportSize); |
| 454 | 469 |
| 455 // The layout size is set by WebViewImpl to support @viewport | 470 // The layout size is set by WebViewImpl to support @viewport |
| 456 frameView->setLayoutSizeFixedToFrameSize(false); | 471 frameView->setLayoutSizeFixedToFrameSize(false); |
| 457 } else | 472 } else |
| 458 frameView = FrameView::create(this); | 473 frameView = FrameView::create(this); |
| 459 | 474 |
| 460 frameView->setScrollbarModes(horizontalScrollbarMode, verticalScrollbarMode, horizontalLock, verticalLock); | 475 frameView->setScrollbarModes(horizontalScrollbarMode, verticalScrollbarMode, horizontalLock, verticalLock); |
| 461 | 476 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 716 ratio *= pageZoomFactor(); | 731 ratio *= pageZoomFactor(); |
| 717 return ratio; | 732 return ratio; |
| 718 } | 733 } |
| 719 | 734 |
| 720 void LocalFrame::disconnectOwnerElement() | 735 void LocalFrame::disconnectOwnerElement() |
| 721 { | 736 { |
| 722 if (owner()) { | 737 if (owner()) { |
| 723 if (Document* document = this->document()) | 738 if (Document* document = this->document()) |
| 724 document->topDocument().clearAXObjectCache(); | 739 document->topDocument().clearAXObjectCache(); |
| 725 #if ENABLE(OILPAN) | 740 #if ENABLE(OILPAN) |
| 741 // First give the plugin elements holding persisted, | |
| 742 // renderer-less plugins the opportunity to dispose of them. | |
| 743 for (HeapHashSet<WeakMember<HTMLPlugInElement> >::const_iterator it = m_ pluginElements.begin(); it != m_pluginElements.end(); ++it) | |
| 744 (*it)->disconnectContentFrame(); | |
| 745 m_pluginElements.clear(); | |
| 746 | |
| 726 // Clear the FrameView and FrameLoader right here rather than | 747 // Clear the FrameView and FrameLoader right here rather than |
| 727 // during finalization. Too late to access various heap objects | 748 // during finalization. Too late to access various heap objects |
| 728 // at that stage. | 749 // at that stage. |
| 729 setView(nullptr); | 750 setView(nullptr); |
| 730 loader().clear(); | 751 loader().clear(); |
| 731 #endif | 752 #endif |
| 732 } | 753 } |
| 733 Frame::disconnectOwnerElement(); | 754 Frame::disconnectOwnerElement(); |
| 734 } | 755 } |
| 735 | 756 |
| 736 LocalFrame* LocalFrame::localFrameRoot() | 757 LocalFrame* LocalFrame::localFrameRoot() |
| 737 { | 758 { |
| 738 LocalFrame* curFrame = this; | 759 LocalFrame* curFrame = this; |
| 739 while (curFrame && curFrame->tree().parent() && curFrame->tree().parent()->i sLocalFrame()) | 760 while (curFrame && curFrame->tree().parent() && curFrame->tree().parent()->i sLocalFrame()) |
| 740 curFrame = toLocalFrame(curFrame->tree().parent()); | 761 curFrame = toLocalFrame(curFrame->tree().parent()); |
| 741 | 762 |
| 742 return curFrame; | 763 return curFrame; |
| 743 } | 764 } |
| 744 | 765 |
| 745 void LocalFrame::setPagePopupOwner(Element& owner) | 766 void LocalFrame::setPagePopupOwner(Element& owner) |
| 746 { | 767 { |
| 747 m_pagePopupOwner = &owner; | 768 m_pagePopupOwner = &owner; |
| 748 } | 769 } |
| 749 | 770 |
| 771 #if ENABLE(OILPAN) | |
| 772 void LocalFrame::registerPluginElement(HTMLPlugInElement* plugin) | |
| 773 { | |
| 774 m_pluginElements.add(plugin); | |
| 775 } | |
| 776 | |
| 777 void LocalFrame::unregisterPluginElement(HTMLPlugInElement* plugin) | |
| 778 { | |
| 779 ASSERT(!ThreadState::current()->isSweepInProgress()); | |
|
haraken
2014/10/11 17:33:02
I wanted to add this check since it would cause an
sof
2014/10/12 08:16:22
Gone :)
| |
| 780 ASSERT(m_pluginElements.contains(plugin)); | |
| 781 m_pluginElements.remove(plugin); | |
| 782 } | |
| 783 #endif | |
| 784 | |
| 750 } // namespace blink | 785 } // namespace blink |
| OLD | NEW |