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

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

Issue 922743002: Dispose Frame when detaching. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 , m_inProgrammaticScroll(false) 118 , m_inProgrammaticScroll(false)
119 , m_safeToPropagateScrollToParent(true) 119 , m_safeToPropagateScrollToParent(true)
120 , m_isTrackingPaintInvalidations(false) 120 , m_isTrackingPaintInvalidations(false)
121 , m_scrollCorner(nullptr) 121 , m_scrollCorner(nullptr)
122 , m_visibleContentScaleFactor(1) 122 , m_visibleContentScaleFactor(1)
123 , m_inputEventsScaleFactorForEmulation(1) 123 , m_inputEventsScaleFactorForEmulation(1)
124 , m_layoutSizeFixedToFrameSize(true) 124 , m_layoutSizeFixedToFrameSize(true)
125 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) 125 , m_didScrollTimer(this, &FrameView::didScrollTimerFired)
126 , m_topControlsViewportAdjustment(0) 126 , m_topControlsViewportAdjustment(0)
127 , m_needsUpdateWidgetPositions(false) 127 , m_needsUpdateWidgetPositions(false)
128 #if ENABLE(OILPAN) && ENABLE(ASSERT) 128 #if ENABLE(ASSERT)
129 , m_hasBeenDisposed(false) 129 , m_hasBeenDisposed(false)
130 #endif 130 #endif
131 , m_horizontalScrollbarMode(ScrollbarAuto) 131 , m_horizontalScrollbarMode(ScrollbarAuto)
132 , m_verticalScrollbarMode(ScrollbarAuto) 132 , m_verticalScrollbarMode(ScrollbarAuto)
133 , m_horizontalScrollbarLock(false) 133 , m_horizontalScrollbarLock(false)
134 , m_verticalScrollbarLock(false) 134 , m_verticalScrollbarLock(false)
135 , m_scrollbarsAvoidingResizer(0) 135 , m_scrollbarsAvoidingResizer(0)
136 , m_scrollbarsSuppressed(false) 136 , m_scrollbarsSuppressed(false)
137 , m_inUpdateScrollbars(false) 137 , m_inUpdateScrollbars(false)
138 , m_shouldDrawPanScrollIcon(false) 138 , m_shouldDrawPanScrollIcon(false)
(...skipping 18 matching lines...) Expand all
157 RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame) ); 157 RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame) );
158 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); 158 view->Widget::setFrameRect(IntRect(view->location(), initialSize));
159 view->setLayoutSizeInternal(initialSize); 159 view->setLayoutSizeInternal(initialSize);
160 160
161 view->show(); 161 view->show();
162 return view.release(); 162 return view.release();
163 } 163 }
164 164
165 FrameView::~FrameView() 165 FrameView::~FrameView()
166 { 166 {
167 #if ENABLE(OILPAN) 167 #if ENABLE(ASSERT)
168 ASSERT(m_hasBeenDisposed); 168 ASSERT(m_hasBeenDisposed);
169 #else 169 #endif
170 #if !ENABLE(OILPAN)
170 // Verify that the LocalFrame has a different FrameView or 171 // Verify that the LocalFrame has a different FrameView or
171 // that it is being detached and destructed. 172 // that it is being detached and destructed.
172 ASSERT(frame().view() != this || !layoutView()); 173 ASSERT(frame().view() != this || !layoutView());
173 dispose();
174 #endif 174 #endif
175 } 175 }
176 176
177 void FrameView::dispose() 177 void FrameView::dispose()
178 { 178 {
179 // Destroy |m_autoSizeInfo| as early as possible, to avoid dereferencing 179 // Destroy |m_autoSizeInfo| as early as possible, to avoid dereferencing
180 // partially destroyed |this| via |m_autoSizeInfo->m_frameView|. 180 // partially destroyed |this| via |m_autoSizeInfo->m_frameView|.
181 m_autoSizeInfo.clear(); 181 m_autoSizeInfo.clear();
182 182
183 if (m_postLayoutTasksTimer.isActive()) 183 if (m_postLayoutTasksTimer.isActive())
(...skipping 11 matching lines...) Expand all
195 setHasHorizontalScrollbar(false); // Remove native scrollbars now before we lose the connection to the HostWindow. 195 setHasHorizontalScrollbar(false); // Remove native scrollbars now before we lose the connection to the HostWindow.
196 setHasVerticalScrollbar(false); 196 setHasVerticalScrollbar(false);
197 197
198 ASSERT(!m_scrollCorner); 198 ASSERT(!m_scrollCorner);
199 199
200 // FIXME: Do we need to do something here for OOPI? 200 // FIXME: Do we need to do something here for OOPI?
201 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); 201 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner();
202 if (ownerElement && ownerElement->ownedWidget() == this) 202 if (ownerElement && ownerElement->ownedWidget() == this)
203 ownerElement->setWidget(nullptr); 203 ownerElement->setWidget(nullptr);
204 204
205 #if ENABLE(OILPAN) && ENABLE(ASSERT) 205 #if ENABLE(ASSERT)
206 m_hasBeenDisposed = true; 206 m_hasBeenDisposed = true;
207 #endif 207 #endif
208 } 208 }
209 209
210 DEFINE_TRACE(FrameView) 210 DEFINE_TRACE(FrameView)
211 { 211 {
212 #if ENABLE(OILPAN) 212 #if ENABLE(OILPAN)
213 visitor->trace(m_frame); 213 visitor->trace(m_frame);
214 visitor->trace(m_nodeToDraw); 214 visitor->trace(m_nodeToDraw);
215 visitor->trace(m_maintainScrollPositionAnchor); 215 visitor->trace(m_maintainScrollPositionAnchor);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 cancelProgrammaticScrollAnimation(); 284 cancelProgrammaticScrollAnimation();
285 285
286 detachCustomScrollbars(); 286 detachCustomScrollbars();
287 // When the view is no longer associated with a frame, it needs to be remove d from the ax object cache 287 // When the view is no longer associated with a frame, it needs to be remove d from the ax object cache
288 // right now, otherwise it won't be able to reach the topDocument()'s axObje ct cache later. 288 // right now, otherwise it won't be able to reach the topDocument()'s axObje ct cache later.
289 removeFromAXObjectCache(); 289 removeFromAXObjectCache();
290 290
291 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) 291 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( ))
292 scrollingCoordinator->willDestroyScrollableArea(this); 292 scrollingCoordinator->willDestroyScrollableArea(this);
293 293
294 #if ENABLE(OILPAN)
295 // FIXME: once/if dust settles, do this always (non-Oilpan)?
296 //
297 // FIXME: Oilpan: is this safe to dispose() if there are FrameView protectio ns on the stack? 294 // FIXME: Oilpan: is this safe to dispose() if there are FrameView protectio ns on the stack?
298 dispose(); 295 dispose();
299 #endif
300 } 296 }
301 297
302 void FrameView::detachCustomScrollbars() 298 void FrameView::detachCustomScrollbars()
303 { 299 {
304 Scrollbar* horizontalBar = horizontalScrollbar(); 300 Scrollbar* horizontalBar = horizontalScrollbar();
305 if (horizontalBar && horizontalBar->isCustomScrollbar()) 301 if (horizontalBar && horizontalBar->isCustomScrollbar())
306 setHasHorizontalScrollbar(false); 302 setHasHorizontalScrollbar(false);
307 303
308 Scrollbar* verticalBar = verticalScrollbar(); 304 Scrollbar* verticalBar = verticalScrollbar();
309 if (verticalBar && verticalBar->isCustomScrollbar()) 305 if (verticalBar && verticalBar->isCustomScrollbar())
(...skipping 3732 matching lines...) Expand 10 before | Expand all | Expand 10 after
4042 { 4038 {
4043 Settings* settings = frame().settings(); 4039 Settings* settings = frame().settings();
4044 if (!settings || !settings->rootLayerScrolls()) 4040 if (!settings || !settings->rootLayerScrolls())
4045 return this; 4041 return this;
4046 4042
4047 LayoutView* layoutView = this->layoutView(); 4043 LayoutView* layoutView = this->layoutView();
4048 return layoutView ? layoutView->scrollableArea() : nullptr; 4044 return layoutView ? layoutView->scrollableArea() : nullptr;
4049 } 4045 }
4050 4046
4051 } // namespace blink 4047 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698