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

Side by Side Diff: cc/scheduler/scheduler_state_machine.h

Issue 1133673004: cc: Heuristic for Renderer latency recovery (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix lots of issues; improve test coverage; Created 5 years, 7 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 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ 5 #ifndef CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_
6 #define CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ 6 #define CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 void OnBeginImplFrameIdle(); 138 void OnBeginImplFrameIdle();
139 BeginImplFrameState begin_impl_frame_state() const { 139 BeginImplFrameState begin_impl_frame_state() const {
140 return begin_impl_frame_state_; 140 return begin_impl_frame_state_;
141 } 141 }
142 BeginImplFrameDeadlineMode CurrentBeginImplFrameDeadlineMode() const; 142 BeginImplFrameDeadlineMode CurrentBeginImplFrameDeadlineMode() const;
143 143
144 // If the main thread didn't manage to produce a new frame in time for the 144 // If the main thread didn't manage to produce a new frame in time for the
145 // impl thread to draw, it is in a high latency mode. 145 // impl thread to draw, it is in a high latency mode.
146 bool MainThreadIsInHighLatencyMode() const; 146 bool MainThreadIsInHighLatencyMode() const;
147 147
148 bool swaps_are_likely_high_latency() const {
149 return swaps_are_likely_high_latency_;
150 }
151
148 // Indicates whether the LayerTreeHostImpl is visible. 152 // Indicates whether the LayerTreeHostImpl is visible.
149 void SetVisible(bool visible); 153 void SetVisible(bool visible);
150 bool visible() const { return visible_; } 154 bool visible() const { return visible_; }
151 155
152 // Indicates that a redraw is required, either due to the impl tree changing 156 // Indicates that a redraw is required, either due to the impl tree changing
153 // or the screen being damaged and simply needing redisplay. 157 // or the screen being damaged and simply needing redisplay.
154 void SetNeedsRedraw(); 158 void SetNeedsRedraw();
155 bool needs_redraw() const { return needs_redraw_; } 159 bool needs_redraw() const { return needs_redraw_; }
156 160
157 void SetNeedsAnimate(); 161 void SetNeedsAnimate();
(...skipping 28 matching lines...) Expand all
186 return impl_latency_takes_priority_; 190 return impl_latency_takes_priority_;
187 } 191 }
188 192
189 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen. 193 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen.
190 void DidDrawIfPossibleCompleted(DrawResult result); 194 void DidDrawIfPossibleCompleted(DrawResult result);
191 195
192 // Indicates that a new commit flow needs to be performed, either to pull 196 // Indicates that a new commit flow needs to be performed, either to pull
193 // updates from the main thread to the impl, or to push deltas from the impl 197 // updates from the main thread to the impl, or to push deltas from the impl
194 // thread to main. 198 // thread to main.
195 void SetNeedsCommit(); 199 void SetNeedsCommit();
200 bool needs_commit() const { return needs_commit_; }
196 201
197 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME 202 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME
198 // from NextAction. 203 // from NextAction.
199 // Indicates that all painting is complete. 204 // Indicates that all painting is complete.
200 void NotifyReadyToCommit(); 205 void NotifyReadyToCommit();
201 206
202 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME 207 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME
203 // from NextAction if the client rejects the BeginMainFrame message. 208 // from NextAction if the client rejects the BeginMainFrame message.
204 void BeginMainFrameAborted(CommitEarlyOutReason reason); 209 void BeginMainFrameAborted(CommitEarlyOutReason reason);
205 210
206 // Set that we can create the first OutputSurface and start the scheduler. 211 // Set that we can create the first OutputSurface and start the scheduler.
207 void SetCanStart() { can_start_ = true; } 212 void SetCanStart() { can_start_ = true; }
208 // Allow access of the can_start_ state in tests. 213 // Allow access of the can_start_ state in tests.
209 bool CanStartForTesting() const { return can_start_; } 214 bool CanStartForTesting() const { return can_start_; }
210 215
216 // Indicates production should be skipped to recover latency.
211 void SetSkipNextBeginMainFrameToReduceLatency(); 217 void SetSkipNextBeginMainFrameToReduceLatency();
218 void SetSkipNextSwapToReduceLatency();
212 219
213 // Indicates whether drawing would, at this time, make sense. 220 // Indicates whether drawing would, at this time, make sense.
214 // CanDraw can be used to suppress flashes or checkerboarding 221 // CanDraw can be used to suppress flashes or checkerboarding
215 // when such behavior would be undesirable. 222 // when such behavior would be undesirable.
216 void SetCanDraw(bool can); 223 void SetCanDraw(bool can);
217 224
218 // Indicates that scheduled BeginMainFrame is started. 225 // Indicates that scheduled BeginMainFrame is started.
219 void NotifyBeginMainFrameStarted(); 226 void NotifyBeginMainFrameStarted();
220 227
221 // Indicates that the pending tree is ready for activation. 228 // Indicates that the pending tree is ready for activation.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 bool invalidate_output_surface_funnel_; 317 bool invalidate_output_surface_funnel_;
311 // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called 318 // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called
312 // and "drained" on each BeginImplFrame. If the funnel gets too full, 319 // and "drained" on each BeginImplFrame. If the funnel gets too full,
313 // we start throttling ACTION_PREPARE_TILES such that we average one 320 // we start throttling ACTION_PREPARE_TILES such that we average one
314 // PrepareTiles per BeginImplFrame. 321 // PrepareTiles per BeginImplFrame.
315 int prepare_tiles_funnel_; 322 int prepare_tiles_funnel_;
316 323
317 int consecutive_checkerboard_animations_; 324 int consecutive_checkerboard_animations_;
318 int max_pending_swaps_; 325 int max_pending_swaps_;
319 int pending_swaps_; 326 int pending_swaps_;
327 bool swaps_are_likely_high_latency_;
328 bool was_swap_throttled_on_begin_impl_frame_;
320 bool needs_redraw_; 329 bool needs_redraw_;
321 bool needs_animate_; 330 bool needs_animate_;
322 bool needs_prepare_tiles_; 331 bool needs_prepare_tiles_;
323 bool needs_commit_; 332 bool needs_commit_;
324 bool visible_; 333 bool visible_;
325 bool can_start_; 334 bool can_start_;
326 bool can_draw_; 335 bool can_draw_;
327 bool has_pending_tree_; 336 bool has_pending_tree_;
328 bool pending_tree_is_ready_for_activation_; 337 bool pending_tree_is_ready_for_activation_;
329 bool active_tree_needs_first_draw_; 338 bool active_tree_needs_first_draw_;
330 bool did_create_and_initialize_first_output_surface_; 339 bool did_create_and_initialize_first_output_surface_;
331 bool impl_latency_takes_priority_; 340 bool impl_latency_takes_priority_;
332 bool skip_next_begin_main_frame_to_reduce_latency_; 341 bool skip_next_begin_main_frame_to_reduce_latency_;
333 bool skip_begin_main_frame_to_reduce_latency_; 342 bool skip_next_swap_to_reduce_latency_;
334 bool continuous_painting_; 343 bool continuous_painting_;
335 bool children_need_begin_frames_; 344 bool children_need_begin_frames_;
336 bool defer_commits_; 345 bool defer_commits_;
337 bool video_needs_begin_frames_; 346 bool video_needs_begin_frames_;
338 bool last_commit_had_no_updates_; 347 bool last_commit_had_no_updates_;
339 bool wait_for_active_tree_ready_to_draw_; 348 bool wait_for_active_tree_ready_to_draw_;
340 bool did_request_swap_in_last_frame_; 349 bool did_request_swap_in_last_frame_;
341 bool did_perform_swap_in_last_draw_; 350 bool did_perform_swap_in_last_draw_;
342 351
343 private: 352 private:
344 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); 353 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine);
345 }; 354 };
346 355
347 } // namespace cc 356 } // namespace cc
348 357
349 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ 358 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698