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

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

Issue 2505543002: Move FrameView timers to WebFrameScheduler. (Closed)
Patch Set: Created 4 years, 1 month 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 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 20 matching lines...) Expand all
31 #include "core/animation/DocumentAnimations.h" 31 #include "core/animation/DocumentAnimations.h"
32 #include "core/css/FontFaceSet.h" 32 #include "core/css/FontFaceSet.h"
33 #include "core/css/resolver/StyleResolver.h" 33 #include "core/css/resolver/StyleResolver.h"
34 #include "core/dom/AXObjectCache.h" 34 #include "core/dom/AXObjectCache.h"
35 #include "core/dom/DOMNodeIds.h" 35 #include "core/dom/DOMNodeIds.h"
36 #include "core/dom/ElementVisibilityObserver.h" 36 #include "core/dom/ElementVisibilityObserver.h"
37 #include "core/dom/Fullscreen.h" 37 #include "core/dom/Fullscreen.h"
38 #include "core/dom/IntersectionObserverCallback.h" 38 #include "core/dom/IntersectionObserverCallback.h"
39 #include "core/dom/IntersectionObserverController.h" 39 #include "core/dom/IntersectionObserverController.h"
40 #include "core/dom/IntersectionObserverInit.h" 40 #include "core/dom/IntersectionObserverInit.h"
41 #include "core/dom/TaskRunnerHelper.h"
41 #include "core/editing/EditingUtilities.h" 42 #include "core/editing/EditingUtilities.h"
42 #include "core/editing/FrameSelection.h" 43 #include "core/editing/FrameSelection.h"
43 #include "core/editing/RenderedPosition.h" 44 #include "core/editing/RenderedPosition.h"
44 #include "core/editing/markers/DocumentMarkerController.h" 45 #include "core/editing/markers/DocumentMarkerController.h"
45 #include "core/events/ErrorEvent.h" 46 #include "core/events/ErrorEvent.h"
46 #include "core/fetch/ResourceFetcher.h" 47 #include "core/fetch/ResourceFetcher.h"
47 #include "core/frame/BrowserControls.h" 48 #include "core/frame/BrowserControls.h"
48 #include "core/frame/EventHandlerRegistry.h" 49 #include "core/frame/EventHandlerRegistry.h"
49 #include "core/frame/FrameHost.h" 50 #include "core/frame/FrameHost.h"
50 #include "core/frame/LocalFrame.h" 51 #include "core/frame/LocalFrame.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 143
143 using namespace HTMLNames; 144 using namespace HTMLNames;
144 145
145 // The maximum number of updateWidgets iterations that should be done before 146 // The maximum number of updateWidgets iterations that should be done before
146 // returning. 147 // returning.
147 static const unsigned maxUpdateWidgetsIterations = 2; 148 static const unsigned maxUpdateWidgetsIterations = 2;
148 static const double resourcePriorityUpdateDelayAfterScroll = 0.250; 149 static const double resourcePriorityUpdateDelayAfterScroll = 0.250;
149 150
150 static bool s_initialTrackAllPaintInvalidations = false; 151 static bool s_initialTrackAllPaintInvalidations = false;
151 152
152 FrameView::FrameView(LocalFrame* frame) 153 FrameView::FrameView(LocalFrame& frame)
153 : m_frame(frame), 154 : m_frame(frame),
154 m_displayMode(WebDisplayModeBrowser), 155 m_displayMode(WebDisplayModeBrowser),
155 m_canHaveScrollbars(true), 156 m_canHaveScrollbars(true),
156 m_hasPendingLayout(false), 157 m_hasPendingLayout(false),
157 m_inSynchronousPostLayout(false), 158 m_inSynchronousPostLayout(false),
158 m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired), 159 m_postLayoutTasksTimer(TaskRunnerHelper::get(TaskType::Internal, &frame),
159 m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired), 160 this,
161 &FrameView::postLayoutTimerFired),
162 m_updateWidgetsTimer(TaskRunnerHelper::get(TaskType::Internal, &frame),
163 this,
164 &FrameView::updateWidgetsTimerFired),
160 m_isTransparent(false), 165 m_isTransparent(false),
161 m_baseBackgroundColor(Color::white), 166 m_baseBackgroundColor(Color::white),
162 m_mediaType(MediaTypeNames::screen), 167 m_mediaType(MediaTypeNames::screen),
163 m_safeToPropagateScrollToParent(true), 168 m_safeToPropagateScrollToParent(true),
164 m_scrollCorner(nullptr), 169 m_scrollCorner(nullptr),
165 m_stickyPositionObjectCount(0), 170 m_stickyPositionObjectCount(0),
166 m_inputEventsScaleFactorForEmulation(1), 171 m_inputEventsScaleFactorForEmulation(1),
167 m_layoutSizeFixedToFrameSize(true), 172 m_layoutSizeFixedToFrameSize(true),
168 m_didScrollTimer(this, &FrameView::didScrollTimerFired), 173 m_didScrollTimer(this, &FrameView::didScrollTimerFired),
169 m_browserControlsViewportAdjustment(0), 174 m_browserControlsViewportAdjustment(0),
(...skipping 13 matching lines...) Expand all
183 m_subtreeThrottled(false), 188 m_subtreeThrottled(false),
184 m_lifecycleUpdatesThrottled(false), 189 m_lifecycleUpdatesThrottled(false),
185 m_needsPaintPropertyUpdate(true), 190 m_needsPaintPropertyUpdate(true),
186 m_currentUpdateLifecyclePhasesTargetState( 191 m_currentUpdateLifecyclePhasesTargetState(
187 DocumentLifecycle::Uninitialized), 192 DocumentLifecycle::Uninitialized),
188 m_scrollAnchor(this), 193 m_scrollAnchor(this),
189 m_scrollbarManager(*this), 194 m_scrollbarManager(*this),
190 m_needsScrollbarsUpdate(false), 195 m_needsScrollbarsUpdate(false),
191 m_suppressAdjustViewSize(false), 196 m_suppressAdjustViewSize(false),
192 m_allowsLayoutInvalidationAfterLayoutClean(true) { 197 m_allowsLayoutInvalidationAfterLayoutClean(true) {
193 ASSERT(m_frame);
194 init(); 198 init();
195 } 199 }
196 200
197 FrameView* FrameView::create(LocalFrame* frame) { 201 FrameView* FrameView::create(LocalFrame& frame) {
198 FrameView* view = new FrameView(frame); 202 FrameView* view = new FrameView(frame);
199 view->show(); 203 view->show();
200 return view; 204 return view;
201 } 205 }
202 206
203 FrameView* FrameView::create(LocalFrame* frame, const IntSize& initialSize) { 207 FrameView* FrameView::create(LocalFrame& frame, const IntSize& initialSize) {
204 FrameView* view = new FrameView(frame); 208 FrameView* view = new FrameView(frame);
205 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); 209 view->Widget::setFrameRect(IntRect(view->location(), initialSize));
206 view->setLayoutSizeInternal(initialSize); 210 view->setLayoutSizeInternal(initialSize);
207 211
208 view->show(); 212 view->show();
209 return view; 213 return view;
210 } 214 }
211 215
212 FrameView::~FrameView() { 216 FrameView::~FrameView() {
213 ASSERT(m_hasBeenDisposed); 217 ASSERT(m_hasBeenDisposed);
(...skipping 2073 matching lines...) Expand 10 before | Expand all | Expand 10 after
2287 // Prevent plugins from causing infinite updates of themselves. 2291 // Prevent plugins from causing infinite updates of themselves.
2288 // FIXME: Do we really need to prevent this? 2292 // FIXME: Do we really need to prevent this?
2289 m_partUpdateSet.remove(&object); 2293 m_partUpdateSet.remove(&object);
2290 } 2294 }
2291 2295
2292 return m_partUpdateSet.isEmpty(); 2296 return m_partUpdateSet.isEmpty();
2293 } 2297 }
2294 2298
2295 void FrameView::updateWidgetsTimerFired(TimerBase*) { 2299 void FrameView::updateWidgetsTimerFired(TimerBase*) {
2296 ASSERT(!isInPerformLayout()); 2300 ASSERT(!isInPerformLayout());
2297 m_updateWidgetsTimer.stop();
2298 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) { 2301 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) {
2299 if (updateWidgets()) 2302 if (updateWidgets())
2300 return; 2303 return;
2301 } 2304 }
2302 } 2305 }
2303 2306
2304 void FrameView::flushAnyPendingPostLayoutTasks() { 2307 void FrameView::flushAnyPendingPostLayoutTasks() {
2305 ASSERT(!isInPerformLayout()); 2308 ASSERT(!isInPerformLayout());
2306 if (m_postLayoutTasksTimer.isActive()) 2309 if (m_postLayoutTasksTimer.isActive())
2307 performPostLayoutTasks(); 2310 performPostLayoutTasks();
2308 if (m_updateWidgetsTimer.isActive()) 2311 if (m_updateWidgetsTimer.isActive()) {
2309 updateWidgetsTimerFired(0); 2312 m_updateWidgetsTimer.stop();
2313 updateWidgetsTimerFired(nullptr);
2314 }
2310 } 2315 }
2311 2316
2312 void FrameView::scheduleUpdateWidgetsIfNecessary() { 2317 void FrameView::scheduleUpdateWidgetsIfNecessary() {
2313 ASSERT(!isInPerformLayout()); 2318 ASSERT(!isInPerformLayout());
2314 if (m_updateWidgetsTimer.isActive() || m_partUpdateSet.isEmpty()) 2319 if (m_updateWidgetsTimer.isActive() || m_partUpdateSet.isEmpty())
2315 return; 2320 return;
2316 m_updateWidgetsTimer.startOneShot(0, BLINK_FROM_HERE); 2321 m_updateWidgetsTimer.startOneShot(0, BLINK_FROM_HERE);
2317 } 2322 }
2318 2323
2319 void FrameView::performPostLayoutTasks() { 2324 void FrameView::performPostLayoutTasks() {
(...skipping 2254 matching lines...) Expand 10 before | Expand all | Expand 10 after
4574 DCHECK(m_frame->isMainFrame()); 4579 DCHECK(m_frame->isMainFrame());
4575 return m_initialViewportSize.width(); 4580 return m_initialViewportSize.width();
4576 } 4581 }
4577 4582
4578 int FrameView::initialViewportHeight() const { 4583 int FrameView::initialViewportHeight() const {
4579 DCHECK(m_frame->isMainFrame()); 4584 DCHECK(m_frame->isMainFrame());
4580 return m_initialViewportSize.height(); 4585 return m_initialViewportSize.height();
4581 } 4586 }
4582 4587
4583 } // namespace blink 4588 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/frame/LocalFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698