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

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

Issue 206793003: cc: Split animating and drawing into separate actions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments and rebased. Created 6 years, 8 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 | Annotate | Revision Log
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 commit_state_ == COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED || 94 commit_state_ == COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED ||
95 commit_state_ == COMMIT_STATE_READY_TO_COMMIT; 95 commit_state_ == COMMIT_STATE_READY_TO_COMMIT;
96 } 96 }
97 CommitState commit_state() const { return commit_state_; } 97 CommitState commit_state() const { return commit_state_; }
98 98
99 bool RedrawPending() const { return needs_redraw_; } 99 bool RedrawPending() const { return needs_redraw_; }
100 bool ManageTilesPending() const { return needs_manage_tiles_; } 100 bool ManageTilesPending() const { return needs_manage_tiles_; }
101 101
102 enum Action { 102 enum Action {
103 ACTION_NONE, 103 ACTION_NONE,
104 ACTION_ANIMATE,
104 ACTION_SEND_BEGIN_MAIN_FRAME, 105 ACTION_SEND_BEGIN_MAIN_FRAME,
105 ACTION_COMMIT, 106 ACTION_COMMIT,
106 ACTION_UPDATE_VISIBLE_TILES, 107 ACTION_UPDATE_VISIBLE_TILES,
107 ACTION_ACTIVATE_PENDING_TREE, 108 ACTION_ACTIVATE_PENDING_TREE,
108 ACTION_DRAW_AND_SWAP_IF_POSSIBLE, 109 ACTION_DRAW_AND_SWAP_IF_POSSIBLE,
109 ACTION_DRAW_AND_SWAP_FORCED, 110 ACTION_DRAW_AND_SWAP_FORCED,
110 ACTION_DRAW_AND_SWAP_ABORT, 111 ACTION_DRAW_AND_SWAP_ABORT,
111 ACTION_DRAW_AND_READBACK, 112 ACTION_DRAW_AND_READBACK,
112 ACTION_BEGIN_OUTPUT_SURFACE_CREATION, 113 ACTION_BEGIN_OUTPUT_SURFACE_CREATION,
113 ACTION_MANAGE_TILES, 114 ACTION_MANAGE_TILES,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 158 }
158 159
159 // Indicates whether the LayerTreeHostImpl is visible. 160 // Indicates whether the LayerTreeHostImpl is visible.
160 void SetVisible(bool visible); 161 void SetVisible(bool visible);
161 162
162 // Indicates that a redraw is required, either due to the impl tree changing 163 // Indicates that a redraw is required, either due to the impl tree changing
163 // or the screen being damaged and simply needing redisplay. 164 // or the screen being damaged and simply needing redisplay.
164 void SetNeedsRedraw(); 165 void SetNeedsRedraw();
165 bool needs_redraw() const { return needs_redraw_; } 166 bool needs_redraw() const { return needs_redraw_; }
166 167
168 void SetNeedsAnimate();
169 bool needs_animate() const { return needs_animate_; }
170
167 // Indicates that manage-tiles is required. This guarantees another 171 // Indicates that manage-tiles is required. This guarantees another
168 // ManageTiles will occur shortly (even if no redraw is required). 172 // ManageTiles will occur shortly (even if no redraw is required).
169 void SetNeedsManageTiles(); 173 void SetNeedsManageTiles();
170 174
171 // Indicates whether a redraw is required because we are currently rendering 175 // Indicates whether a redraw is required because we are currently rendering
172 // with a low resolution or checkerboarded tile. 176 // with a low resolution or checkerboarded tile.
173 void SetSwapUsedIncompleteTile(bool used_incomplete_tile); 177 void SetSwapUsedIncompleteTile(bool used_incomplete_tile);
174 178
175 // Indicates whether to prioritize animation smoothness over new content 179 // Indicates whether to prioritize animation smoothness over new content
176 // activation. 180 // activation.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 continuous_painting_ = continuous_painting; 240 continuous_painting_ = continuous_painting;
237 } 241 }
238 242
239 protected: 243 protected:
240 bool BeginFrameNeededToDraw() const; 244 bool BeginFrameNeededToDraw() const;
241 bool ProactiveBeginFrameWanted() const; 245 bool ProactiveBeginFrameWanted() const;
242 246
243 // True if we need to force activations to make forward progress. 247 // True if we need to force activations to make forward progress.
244 bool PendingActivationsShouldBeForced() const; 248 bool PendingActivationsShouldBeForced() const;
245 249
250 bool ShouldAnimate() const;
246 bool ShouldBeginOutputSurfaceCreation() const; 251 bool ShouldBeginOutputSurfaceCreation() const;
247 bool ShouldDrawForced() const; 252 bool ShouldDrawForced() const;
248 bool ShouldDraw() const; 253 bool ShouldDraw() const;
249 bool ShouldActivatePendingTree() const; 254 bool ShouldActivatePendingTree() const;
250 bool ShouldUpdateVisibleTiles() const; 255 bool ShouldUpdateVisibleTiles() const;
251 bool ShouldSendBeginMainFrame() const; 256 bool ShouldSendBeginMainFrame() const;
252 bool ShouldCommit() const; 257 bool ShouldCommit() const;
253 bool ShouldManageTiles() const; 258 bool ShouldManageTiles() const;
254 259
255 void AdvanceCurrentFrameNumber(); 260 void AdvanceCurrentFrameNumber();
(...skipping 12 matching lines...) Expand all
268 OutputSurfaceState output_surface_state_; 273 OutputSurfaceState output_surface_state_;
269 BeginImplFrameState begin_impl_frame_state_; 274 BeginImplFrameState begin_impl_frame_state_;
270 CommitState commit_state_; 275 CommitState commit_state_;
271 ForcedRedrawOnTimeoutState forced_redraw_state_; 276 ForcedRedrawOnTimeoutState forced_redraw_state_;
272 SynchronousReadbackState readback_state_; 277 SynchronousReadbackState readback_state_;
273 278
274 BeginFrameArgs begin_impl_frame_args_; 279 BeginFrameArgs begin_impl_frame_args_;
275 280
276 int commit_count_; 281 int commit_count_;
277 int current_frame_number_; 282 int current_frame_number_;
283 int last_frame_number_animate_performed_;
278 int last_frame_number_swap_performed_; 284 int last_frame_number_swap_performed_;
279 int last_frame_number_begin_main_frame_sent_; 285 int last_frame_number_begin_main_frame_sent_;
280 int last_frame_number_update_visible_tiles_was_called_; 286 int last_frame_number_update_visible_tiles_was_called_;
281 287
282 // manage_tiles_funnel_ is "filled" each time ManageTiles is called 288 // manage_tiles_funnel_ is "filled" each time ManageTiles is called
283 // and "drained" on each BeginImplFrame. If the funnel gets too full, 289 // and "drained" on each BeginImplFrame. If the funnel gets too full,
284 // we start throttling ACTION_MANAGE_TILES such that we average one 290 // we start throttling ACTION_MANAGE_TILES such that we average one
285 // ManageTile per BeginImplFrame. 291 // ManageTile per BeginImplFrame.
286 int manage_tiles_funnel_; 292 int manage_tiles_funnel_;
287 int consecutive_checkerboard_animations_; 293 int consecutive_checkerboard_animations_;
288 bool needs_redraw_; 294 bool needs_redraw_;
295 bool needs_animate_;
289 bool needs_manage_tiles_; 296 bool needs_manage_tiles_;
290 bool swap_used_incomplete_tile_; 297 bool swap_used_incomplete_tile_;
291 bool needs_commit_; 298 bool needs_commit_;
292 bool inside_poll_for_anticipated_draw_triggers_; 299 bool inside_poll_for_anticipated_draw_triggers_;
293 bool visible_; 300 bool visible_;
294 bool can_start_; 301 bool can_start_;
295 bool can_draw_; 302 bool can_draw_;
296 bool has_pending_tree_; 303 bool has_pending_tree_;
297 bool pending_tree_is_ready_for_activation_; 304 bool pending_tree_is_ready_for_activation_;
298 bool active_tree_needs_first_draw_; 305 bool active_tree_needs_first_draw_;
299 bool draw_if_possible_failed_; 306 bool draw_if_possible_failed_;
300 bool did_create_and_initialize_first_output_surface_; 307 bool did_create_and_initialize_first_output_surface_;
301 bool smoothness_takes_priority_; 308 bool smoothness_takes_priority_;
302 bool skip_next_begin_main_frame_to_reduce_latency_; 309 bool skip_next_begin_main_frame_to_reduce_latency_;
303 bool skip_begin_main_frame_to_reduce_latency_; 310 bool skip_begin_main_frame_to_reduce_latency_;
304 bool continuous_painting_; 311 bool continuous_painting_;
305 bool needs_back_to_back_readback_; 312 bool needs_back_to_back_readback_;
306 313
307 private: 314 private:
308 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); 315 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine);
309 }; 316 };
310 317
311 } // namespace cc 318 } // namespace cc
312 319
313 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ 320 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698