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

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: Fix popup unit tests 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 { 195 {
195 // We detach the FrameView's custom scroll bars as early as 196 // We detach the FrameView's custom scroll bars as early as
196 // possible to prevent m_doc->detach() from messing with the view 197 // possible to prevent m_doc->detach() from messing with the view
197 // such that its scroll bars won't be torn down. 198 // such that its scroll bars won't be torn down.
198 // 199 //
199 // FIXME: We should revisit this. 200 // FIXME: We should revisit this.
200 if (m_view) 201 if (m_view)
201 m_view->prepareForDetach(); 202 m_view->prepareForDetach();
202 } 203 }
203 204
204 void LocalFrame::setView(PassRefPtr<FrameView> view) 205 void LocalFrame::setView(PassRefPtrWillBeRawPtr<FrameView> view)
205 { 206 {
206 detachView(); 207 detachView();
207 208
208 // Prepare for destruction now, so any unload event handlers get run and the LocalDOMWindow is 209 // Prepare for destruction now, so any unload event handlers get run and the LocalDOMWindow is
209 // notified. If we wait until the view is destroyed, then things won't be ho oked up enough for 210 // notified. If we wait until the view is destroyed, then things won't be ho oked up enough for
210 // these calls to work. 211 // these calls to work.
211 if (!view && document() && document()->isActive()) { 212 if (!view && document() && document()->isActive()) {
212 // FIXME: We don't call willRemove here. Why is that OK? 213 // FIXME: We don't call willRemove here. Why is that OK?
213 document()->prepareForDestruction(); 214 document()->prepareForDestruction();
214 } 215 }
215 216
216 eventHandler().clear(); 217 eventHandler().clear();
217 218
219 if (m_view && !view)
220 m_view->dispose();
221
218 m_view = view; 222 m_view = view;
219 223
220 if (m_view && isMainFrame() && !settings()->pinchVirtualViewportEnabled()) 224 if (m_view && isMainFrame() && !settings()->pinchVirtualViewportEnabled())
221 m_view->setVisibleContentScaleFactor(page()->pageScaleFactor()); 225 m_view->setVisibleContentScaleFactor(page()->pageScaleFactor());
222 } 226 }
223 227
224 void LocalFrame::setPrinting(bool printing, const FloatSize& pageSize, const Flo atSize& originalPageSize, float maximumShrinkRatio) 228 void LocalFrame::setPrinting(bool printing, const FloatSize& pageSize, const Flo atSize& originalPageSize, float maximumShrinkRatio)
225 { 229 {
226 // In setting printing, we should not validate resources already cached for the document. 230 // In setting printing, we should not validate resources already cached for the document.
227 // See https://bugs.webkit.org/show_bug.cgi?id=43704 231 // See https://bugs.webkit.org/show_bug.cgi?id=43704
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 ASSERT(this); 435 ASSERT(this);
432 ASSERT(page()); 436 ASSERT(page());
433 437
434 bool isLocalRoot = this->isLocalRoot(); 438 bool isLocalRoot = this->isLocalRoot();
435 439
436 if (isLocalRoot && view()) 440 if (isLocalRoot && view())
437 view()->setParentVisible(false); 441 view()->setParentVisible(false);
438 442
439 setView(nullptr); 443 setView(nullptr);
440 444
441 RefPtr<FrameView> frameView; 445 RefPtrWillBeRawPtr<FrameView> frameView = nullptr;
442 if (isLocalRoot) { 446 if (isLocalRoot) {
443 frameView = FrameView::create(this, viewportSize); 447 frameView = FrameView::create(this, viewportSize);
444 448
445 // The layout size is set by WebViewImpl to support @viewport 449 // The layout size is set by WebViewImpl to support @viewport
446 frameView->setLayoutSizeFixedToFrameSize(false); 450 frameView->setLayoutSizeFixedToFrameSize(false);
447 } else 451 } else
448 frameView = FrameView::create(this); 452 frameView = FrameView::create(this);
449 453
450 frameView->setScrollbarModes(horizontalScrollbarMode, verticalScrollbarMode, horizontalLock, verticalLock); 454 frameView->setScrollbarModes(horizontalScrollbarMode, verticalScrollbarMode, horizontalLock, verticalLock);
451 455
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 735
732 return curFrame; 736 return curFrame;
733 } 737 }
734 738
735 void LocalFrame::setPagePopupOwner(Element& owner) 739 void LocalFrame::setPagePopupOwner(Element& owner)
736 { 740 {
737 m_pagePopupOwner = &owner; 741 m_pagePopupOwner = &owner;
738 } 742 }
739 743
740 } // namespace blink 744 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698