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

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

Issue 603193005: Move the Widget hierarchy to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase needed again Created 6 years, 2 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
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 30 matching lines...) Expand all
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
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);
156 HeapSupplementable<LocalFrame>::trace(visitor); 159 HeapSupplementable<LocalFrame>::trace(visitor);
157 #endif 160 #endif
158 Frame::trace(visitor); 161 Frame::trace(visitor);
159 } 162 }
160 163
161 void LocalFrame::navigate(Document& originDocument, const KURL& url, bool lockBa ckForwardList) 164 void LocalFrame::navigate(Document& originDocument, const KURL& url, bool lockBa ckForwardList)
162 { 165 {
163 m_navigationScheduler.scheduleLocationChange(&originDocument, url.string(), lockBackForwardList); 166 m_navigationScheduler.scheduleLocationChange(&originDocument, url.string(), lockBackForwardList);
164 } 167 }
165 168
(...skipping 29 matching lines...) Expand all
195 { 198 {
196 // We detach the FrameView's custom scroll bars as early as 199 // We detach the FrameView's custom scroll bars as early as
197 // possible to prevent m_doc->detach() from messing with the view 200 // possible to prevent m_doc->detach() from messing with the view
198 // such that its scroll bars won't be torn down. 201 // such that its scroll bars won't be torn down.
199 // 202 //
200 // FIXME: We should revisit this. 203 // FIXME: We should revisit this.
201 if (m_view) 204 if (m_view)
202 m_view->prepareForDetach(); 205 m_view->prepareForDetach();
203 } 206 }
204 207
205 void LocalFrame::setView(PassRefPtr<FrameView> view) 208 void LocalFrame::setView(PassRefPtrWillBeRawPtr<FrameView> view)
206 { 209 {
210 ASSERT(!m_view || m_view != view);
207 detachView(); 211 detachView();
208 212
209 // Prepare for destruction now, so any unload event handlers get run and the LocalDOMWindow is 213 // 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 214 // notified. If we wait until the view is destroyed, then things won't be ho oked up enough for
211 // these calls to work. 215 // these calls to work.
212 if (!view && document() && document()->isActive()) { 216 if (!view && document() && document()->isActive()) {
213 // FIXME: We don't call willRemove here. Why is that OK? 217 // FIXME: We don't call willRemove here. Why is that OK?
214 document()->prepareForDestruction(); 218 document()->prepareForDestruction();
215 } 219 }
216 220
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 ASSERT(this); 445 ASSERT(this);
442 ASSERT(page()); 446 ASSERT(page());
443 447
444 bool isLocalRoot = this->isLocalRoot(); 448 bool isLocalRoot = this->isLocalRoot();
445 449
446 if (isLocalRoot && view()) 450 if (isLocalRoot && view())
447 view()->setParentVisible(false); 451 view()->setParentVisible(false);
448 452
449 setView(nullptr); 453 setView(nullptr);
450 454
451 RefPtr<FrameView> frameView; 455 RefPtrWillBeRawPtr<FrameView> frameView = nullptr;
452 if (isLocalRoot) { 456 if (isLocalRoot) {
453 frameView = FrameView::create(this, viewportSize); 457 frameView = FrameView::create(this, viewportSize);
454 458
455 // The layout size is set by WebViewImpl to support @viewport 459 // The layout size is set by WebViewImpl to support @viewport
456 frameView->setLayoutSizeFixedToFrameSize(false); 460 frameView->setLayoutSizeFixedToFrameSize(false);
457 } else 461 } else
458 frameView = FrameView::create(this); 462 frameView = FrameView::create(this);
459 463
460 frameView->setScrollbarModes(horizontalScrollbarMode, verticalScrollbarMode, horizontalLock, verticalLock); 464 frameView->setScrollbarModes(horizontalScrollbarMode, verticalScrollbarMode, horizontalLock, verticalLock);
461 465
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 ratio *= pageZoomFactor(); 720 ratio *= pageZoomFactor();
717 return ratio; 721 return ratio;
718 } 722 }
719 723
720 void LocalFrame::disconnectOwnerElement() 724 void LocalFrame::disconnectOwnerElement()
721 { 725 {
722 if (owner()) { 726 if (owner()) {
723 if (Document* document = this->document()) 727 if (Document* document = this->document())
724 document->topDocument().clearAXObjectCache(); 728 document->topDocument().clearAXObjectCache();
725 #if ENABLE(OILPAN) 729 #if ENABLE(OILPAN)
730 // First give the plugin elements holding persisted,
731 // renderer-less the opportunity to dispose of their plugins.
732 for (HeapHashSet<WeakMember<HTMLPlugInElement> >::const_iterator it = m_ pluginElements.begin(); it != m_pluginElements.end(); ++it)
733 (*it)->disconnectContentFrame();
734 m_pluginElements.clear();
735
726 // Clear the FrameView and FrameLoader right here rather than 736 // Clear the FrameView and FrameLoader right here rather than
727 // during finalization. Too late to access various heap objects 737 // during finalization. Too late to access various heap objects
728 // at that stage. 738 // at that stage.
729 setView(nullptr); 739 setView(nullptr);
730 loader().clear(); 740 loader().clear();
731 #endif 741 #endif
732 } 742 }
733 Frame::disconnectOwnerElement(); 743 Frame::disconnectOwnerElement();
734 } 744 }
735 745
736 LocalFrame* LocalFrame::localFrameRoot() 746 LocalFrame* LocalFrame::localFrameRoot()
737 { 747 {
738 LocalFrame* curFrame = this; 748 LocalFrame* curFrame = this;
739 while (curFrame && curFrame->tree().parent() && curFrame->tree().parent()->i sLocalFrame()) 749 while (curFrame && curFrame->tree().parent() && curFrame->tree().parent()->i sLocalFrame())
740 curFrame = toLocalFrame(curFrame->tree().parent()); 750 curFrame = toLocalFrame(curFrame->tree().parent());
741 751
742 return curFrame; 752 return curFrame;
743 } 753 }
744 754
745 void LocalFrame::setPagePopupOwner(Element& owner) 755 void LocalFrame::setPagePopupOwner(Element& owner)
746 { 756 {
747 m_pagePopupOwner = &owner; 757 m_pagePopupOwner = &owner;
748 } 758 }
749 759
760 #if ENABLE(OILPAN)
761 void LocalFrame::registerPluginElement(HTMLPlugInElement* plugin)
762 {
763 m_pluginElements.add(plugin);
764 }
765 #endif
766
750 } // namespace blink 767 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698