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

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 upto and resolve r182737 conflict. 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 Frame* parent = frame->tree().parent(); 86 Frame* parent = frame->tree().parent();
87 if (!parent || !parent->isLocalFrame()) 87 if (!parent || !parent->isLocalFrame())
88 return 1; 88 return 1;
89 return toLocalFrame(parent)->textZoomFactor(); 89 return toLocalFrame(parent)->textZoomFactor();
90 } 90 }
91 91
92 inline LocalFrame::LocalFrame(FrameLoaderClient* client, FrameHost* host, FrameO wner* owner) 92 inline LocalFrame::LocalFrame(FrameLoaderClient* client, FrameHost* host, FrameO wner* owner)
93 : Frame(client, host, owner) 93 : Frame(client, host, owner)
94 , m_loader(this) 94 , m_loader(this)
95 , m_navigationScheduler(this) 95 , m_navigationScheduler(this)
96 , m_script(adoptPtr(new ScriptController(this))) 96 , m_script(ScriptController::create(this))
97 , m_editor(Editor::create(*this)) 97 , m_editor(Editor::create(*this))
98 , m_spellChecker(SpellChecker::create(*this)) 98 , m_spellChecker(SpellChecker::create(*this))
99 , m_selection(FrameSelection::create(this)) 99 , m_selection(FrameSelection::create(this))
100 , m_eventHandler(adoptPtrWillBeNoop(new EventHandler(this))) 100 , m_eventHandler(adoptPtrWillBeNoop(new EventHandler(this)))
101 , m_console(FrameConsole::create(*this)) 101 , m_console(FrameConsole::create(*this))
102 , m_inputMethodController(InputMethodController::create(*this)) 102 , m_inputMethodController(InputMethodController::create(*this))
103 , m_pageZoomFactor(parentPageZoomFactor(this)) 103 , m_pageZoomFactor(parentPageZoomFactor(this))
104 , m_textZoomFactor(parentTextZoomFactor(this)) 104 , m_textZoomFactor(parentTextZoomFactor(this))
105 , m_inViewSourceMode(false) 105 , m_inViewSourceMode(false)
106 { 106 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 (*it)->frameDestroyed(); 138 (*it)->frameDestroyed();
139 #endif 139 #endif
140 } 140 }
141 141
142 void LocalFrame::trace(Visitor* visitor) 142 void LocalFrame::trace(Visitor* visitor)
143 { 143 {
144 #if ENABLE(OILPAN) 144 #if ENABLE(OILPAN)
145 visitor->trace(m_destructionObservers); 145 visitor->trace(m_destructionObservers);
146 visitor->trace(m_loader); 146 visitor->trace(m_loader);
147 visitor->trace(m_navigationScheduler); 147 visitor->trace(m_navigationScheduler);
148 visitor->trace(m_view);
148 visitor->trace(m_pagePopupOwner); 149 visitor->trace(m_pagePopupOwner);
149 visitor->trace(m_editor); 150 visitor->trace(m_editor);
150 visitor->trace(m_spellChecker); 151 visitor->trace(m_spellChecker);
151 visitor->trace(m_selection); 152 visitor->trace(m_selection);
152 visitor->trace(m_eventHandler); 153 visitor->trace(m_eventHandler);
153 visitor->trace(m_console); 154 visitor->trace(m_console);
154 visitor->trace(m_inputMethodController); 155 visitor->trace(m_inputMethodController);
155 HeapSupplementable<LocalFrame>::trace(visitor); 156 HeapSupplementable<LocalFrame>::trace(visitor);
156 #endif 157 #endif
157 Frame::trace(visitor); 158 Frame::trace(visitor);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 { 190 {
190 // We detach the FrameView's custom scroll bars as early as 191 // We detach the FrameView's custom scroll bars as early as
191 // possible to prevent m_doc->detach() from messing with the view 192 // possible to prevent m_doc->detach() from messing with the view
192 // such that its scroll bars won't be torn down. 193 // such that its scroll bars won't be torn down.
193 // 194 //
194 // FIXME: We should revisit this. 195 // FIXME: We should revisit this.
195 if (m_view) 196 if (m_view)
196 m_view->prepareForDetach(); 197 m_view->prepareForDetach();
197 } 198 }
198 199
199 void LocalFrame::setView(PassRefPtr<FrameView> view) 200 void LocalFrame::setView(PassRefPtrWillBeRawPtr<FrameView> view)
200 { 201 {
201 detachView(); 202 detachView();
202 203
203 // Prepare for destruction now, so any unload event handlers get run and the LocalDOMWindow is 204 // Prepare for destruction now, so any unload event handlers get run and the LocalDOMWindow is
204 // notified. If we wait until the view is destroyed, then things won't be ho oked up enough for 205 // notified. If we wait until the view is destroyed, then things won't be ho oked up enough for
205 // these calls to work. 206 // these calls to work.
206 if (!view && document() && document()->isActive()) { 207 if (!view && document() && document()->isActive()) {
207 // FIXME: We don't call willRemove here. Why is that OK? 208 // FIXME: We don't call willRemove here. Why is that OK?
208 document()->prepareForDestruction(); 209 document()->prepareForDestruction();
209 } 210 }
210 211
211 eventHandler().clear(); 212 eventHandler().clear();
212 213
214 if (m_view && !view)
215 m_view->dispose();
haraken 2014/09/26 09:19:25 Just help me understand: Why is it OK to promptly
sof 2014/09/28 08:05:53 A key question. I think it would be safer if the d
sof 2014/09/28 08:20:32 Forgot to say -- no tests exercise code paths that
216
213 m_view = view; 217 m_view = view;
214 218
215 if (m_view && isMainFrame()) { 219 if (m_view && isMainFrame()) {
216 if (settings()->pinchVirtualViewportEnabled()) 220 if (settings()->pinchVirtualViewportEnabled())
217 m_host->pinchViewport().mainFrameDidChangeSize(); 221 m_host->pinchViewport().mainFrameDidChangeSize();
218 else 222 else
219 m_view->setVisibleContentScaleFactor(page()->pageScaleFactor()); 223 m_view->setVisibleContentScaleFactor(page()->pageScaleFactor());
220 } 224 }
221 } 225 }
222 226
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 ASSERT(this); 434 ASSERT(this);
431 ASSERT(page()); 435 ASSERT(page());
432 436
433 bool isLocalRoot = this->isLocalRoot(); 437 bool isLocalRoot = this->isLocalRoot();
434 438
435 if (isLocalRoot && view()) 439 if (isLocalRoot && view())
436 view()->setParentVisible(false); 440 view()->setParentVisible(false);
437 441
438 setView(nullptr); 442 setView(nullptr);
439 443
440 RefPtr<FrameView> frameView; 444 RefPtrWillBeRawPtr<FrameView> frameView = nullptr;
441 if (isLocalRoot) { 445 if (isLocalRoot) {
442 frameView = FrameView::create(this, viewportSize); 446 frameView = FrameView::create(this, viewportSize);
443 447
444 // The layout size is set by WebViewImpl to support @viewport 448 // The layout size is set by WebViewImpl to support @viewport
445 frameView->setLayoutSizeFixedToFrameSize(false); 449 frameView->setLayoutSizeFixedToFrameSize(false);
446 } else 450 } else
447 frameView = FrameView::create(this); 451 frameView = FrameView::create(this);
448 452
449 frameView->setScrollbarModes(horizontalScrollbarMode, verticalScrollbarMode, horizontalLock, verticalLock); 453 frameView->setScrollbarModes(horizontalScrollbarMode, verticalScrollbarMode, horizontalLock, verticalLock);
450 454
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 734
731 return curFrame; 735 return curFrame;
732 } 736 }
733 737
734 void LocalFrame::setPagePopupOwner(Element& owner) 738 void LocalFrame::setPagePopupOwner(Element& owner)
735 { 739 {
736 m_pagePopupOwner = &owner; 740 m_pagePopupOwner = &owner;
737 } 741 }
738 742
739 } // namespace blink 743 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698