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

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

Issue 1014993002: [exp] cc: Introduce cc::CompositorMutator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.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
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 commit_state_ == COMMIT_STATE_READY_TO_COMMIT; 96 commit_state_ == COMMIT_STATE_READY_TO_COMMIT;
97 } 97 }
98 CommitState commit_state() const { return commit_state_; } 98 CommitState commit_state() const { return commit_state_; }
99 99
100 bool RedrawPending() const { return needs_redraw_; } 100 bool RedrawPending() const { return needs_redraw_; }
101 bool PrepareTilesPending() const { return needs_prepare_tiles_; } 101 bool PrepareTilesPending() const { return needs_prepare_tiles_; }
102 102
103 enum Action { 103 enum Action {
104 ACTION_NONE, 104 ACTION_NONE,
105 ACTION_ANIMATE, 105 ACTION_ANIMATE,
106 ACTION_CUSTOM_MUTATE,
106 ACTION_SEND_BEGIN_MAIN_FRAME, 107 ACTION_SEND_BEGIN_MAIN_FRAME,
107 ACTION_COMMIT, 108 ACTION_COMMIT,
108 ACTION_ACTIVATE_SYNC_TREE, 109 ACTION_ACTIVATE_SYNC_TREE,
109 ACTION_DRAW_AND_SWAP_IF_POSSIBLE, 110 ACTION_DRAW_AND_SWAP_IF_POSSIBLE,
110 ACTION_DRAW_AND_SWAP_FORCED, 111 ACTION_DRAW_AND_SWAP_FORCED,
111 ACTION_DRAW_AND_SWAP_ABORT, 112 ACTION_DRAW_AND_SWAP_ABORT,
112 ACTION_BEGIN_OUTPUT_SURFACE_CREATION, 113 ACTION_BEGIN_OUTPUT_SURFACE_CREATION,
113 ACTION_PREPARE_TILES, 114 ACTION_PREPARE_TILES,
114 }; 115 };
115 static const char* ActionToString(Action action); 116 static const char* ActionToString(Action action);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 bool visible() const { return visible_; } 166 bool visible() const { return visible_; }
166 167
167 // Indicates that a redraw is required, either due to the impl tree changing 168 // Indicates that a redraw is required, either due to the impl tree changing
168 // or the screen being damaged and simply needing redisplay. 169 // or the screen being damaged and simply needing redisplay.
169 void SetNeedsRedraw(); 170 void SetNeedsRedraw();
170 bool needs_redraw() const { return needs_redraw_; } 171 bool needs_redraw() const { return needs_redraw_; }
171 172
172 void SetNeedsAnimate(); 173 void SetNeedsAnimate();
173 bool needs_animate() const { return needs_animate_; } 174 bool needs_animate() const { return needs_animate_; }
174 175
176 void SetNeedsCustomMutate();
177 bool needs_custom_mutate() const { return needs_custom_mutate_; }
178
175 // Indicates that prepare-tiles is required. This guarantees another 179 // Indicates that prepare-tiles is required. This guarantees another
176 // PrepareTiles will occur shortly (even if no redraw is required). 180 // PrepareTiles will occur shortly (even if no redraw is required).
177 void SetNeedsPrepareTiles(); 181 void SetNeedsPrepareTiles();
178 182
179 // Sets how many swaps can be pending to the OutputSurface. 183 // Sets how many swaps can be pending to the OutputSurface.
180 void SetMaxSwapsPending(int max); 184 void SetMaxSwapsPending(int max);
181 185
182 // If the scheduler attempted to draw and swap, this provides feedback 186 // If the scheduler attempted to draw and swap, this provides feedback
183 // regarding whether or not the swap actually occured. We might skip the 187 // regarding whether or not the swap actually occured. We might skip the
184 // swap when there is not damage, for example. 188 // swap when there is not damage, for example.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 bool BeginFrameNeededToAnimateOrDraw() const; 273 bool BeginFrameNeededToAnimateOrDraw() const;
270 bool BeginFrameNeededForChildren() const; 274 bool BeginFrameNeededForChildren() const;
271 bool ProactiveBeginFrameWanted() const; 275 bool ProactiveBeginFrameWanted() const;
272 276
273 bool ShouldTriggerBeginImplFrameDeadlineImmediately() const; 277 bool ShouldTriggerBeginImplFrameDeadlineImmediately() const;
274 278
275 // True if we need to force activations to make forward progress. 279 // True if we need to force activations to make forward progress.
276 bool PendingActivationsShouldBeForced() const; 280 bool PendingActivationsShouldBeForced() const;
277 281
278 bool ShouldAnimate() const; 282 bool ShouldAnimate() const;
283 bool ShouldCustomMutate() const;
279 bool ShouldBeginOutputSurfaceCreation() const; 284 bool ShouldBeginOutputSurfaceCreation() const;
280 bool ShouldDraw() const; 285 bool ShouldDraw() const;
281 bool ShouldActivatePendingTree() const; 286 bool ShouldActivatePendingTree() const;
282 bool ShouldSendBeginMainFrame() const; 287 bool ShouldSendBeginMainFrame() const;
283 bool ShouldCommit() const; 288 bool ShouldCommit() const;
284 bool ShouldPrepareTiles() const; 289 bool ShouldPrepareTiles() const;
285 290
286 void AdvanceCurrentFrameNumber(); 291 void AdvanceCurrentFrameNumber();
287 bool HasAnimatedThisFrame() const; 292 bool HasAnimatedThisFrame() const;
293 bool HasCustomMutatedThisFrame() const;
288 bool HasSentBeginMainFrameThisFrame() const; 294 bool HasSentBeginMainFrameThisFrame() const;
289 bool HasRequestedSwapThisFrame() const; 295 bool HasRequestedSwapThisFrame() const;
290 bool HasSwappedThisFrame() const; 296 bool HasSwappedThisFrame() const;
291 297
292 void UpdateStateOnCommit(bool commit_had_no_updates); 298 void UpdateStateOnCommit(bool commit_had_no_updates);
293 void UpdateStateOnActivation(); 299 void UpdateStateOnActivation();
294 void UpdateStateOnDraw(bool did_request_swap); 300 void UpdateStateOnDraw(bool did_request_swap);
295 void UpdateStateOnPrepareTiles(); 301 void UpdateStateOnPrepareTiles();
296 302
297 const SchedulerSettings settings_; 303 const SchedulerSettings settings_;
298 304
299 OutputSurfaceState output_surface_state_; 305 OutputSurfaceState output_surface_state_;
300 BeginImplFrameState begin_impl_frame_state_; 306 BeginImplFrameState begin_impl_frame_state_;
301 CommitState commit_state_; 307 CommitState commit_state_;
302 ForcedRedrawOnTimeoutState forced_redraw_state_; 308 ForcedRedrawOnTimeoutState forced_redraw_state_;
303 309
304 BeginFrameArgs begin_impl_frame_args_; 310 BeginFrameArgs begin_impl_frame_args_;
305 311
306 int commit_count_; 312 int commit_count_;
307 int current_frame_number_; 313 int current_frame_number_;
308 int last_frame_number_animate_performed_; 314 int last_frame_number_animate_performed_;
315 int last_frame_number_custom_mutate_performed_;
309 int last_frame_number_swap_performed_; 316 int last_frame_number_swap_performed_;
310 int last_frame_number_swap_requested_; 317 int last_frame_number_swap_requested_;
311 int last_frame_number_begin_main_frame_sent_; 318 int last_frame_number_begin_main_frame_sent_;
312 319
313 // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called 320 // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called
314 // and "drained" on each BeginImplFrame. If the funnel gets too full, 321 // and "drained" on each BeginImplFrame. If the funnel gets too full,
315 // we start throttling ACTION_PREPARE_TILES such that we average one 322 // we start throttling ACTION_PREPARE_TILES such that we average one
316 // PrepareTiles per BeginImplFrame. 323 // PrepareTiles per BeginImplFrame.
317 int prepare_tiles_funnel_; 324 int prepare_tiles_funnel_;
318 int consecutive_checkerboard_animations_; 325 int consecutive_checkerboard_animations_;
319 int max_pending_swaps_; 326 int max_pending_swaps_;
320 int pending_swaps_; 327 int pending_swaps_;
321 bool needs_redraw_; 328 bool needs_redraw_;
322 bool needs_animate_; 329 bool needs_animate_;
330 bool needs_custom_mutate_;
323 bool needs_prepare_tiles_; 331 bool needs_prepare_tiles_;
324 bool needs_commit_; 332 bool needs_commit_;
325 bool inside_poll_for_anticipated_draw_triggers_; 333 bool inside_poll_for_anticipated_draw_triggers_;
326 bool visible_; 334 bool visible_;
327 bool can_start_; 335 bool can_start_;
328 bool can_draw_; 336 bool can_draw_;
329 bool has_pending_tree_; 337 bool has_pending_tree_;
330 bool pending_tree_is_ready_for_activation_; 338 bool pending_tree_is_ready_for_activation_;
331 bool active_tree_needs_first_draw_; 339 bool active_tree_needs_first_draw_;
332 bool did_commit_after_animating_; 340 bool did_commit_after_animating_;
333 bool did_create_and_initialize_first_output_surface_; 341 bool did_create_and_initialize_first_output_surface_;
334 bool impl_latency_takes_priority_; 342 bool impl_latency_takes_priority_;
335 bool skip_next_begin_main_frame_to_reduce_latency_; 343 bool skip_next_begin_main_frame_to_reduce_latency_;
336 bool skip_begin_main_frame_to_reduce_latency_; 344 bool skip_begin_main_frame_to_reduce_latency_;
337 bool continuous_painting_; 345 bool continuous_painting_;
338 bool children_need_begin_frames_; 346 bool children_need_begin_frames_;
339 bool defer_commits_; 347 bool defer_commits_;
340 348
341 private: 349 private:
342 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); 350 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine);
343 }; 351 };
344 352
345 } // namespace cc 353 } // namespace cc
346 354
347 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ 355 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698