OLD | NEW |
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 CommitState commit_state() const { return commit_state_; } | 88 CommitState commit_state() const { return commit_state_; } |
89 | 89 |
90 bool RedrawPending() const { return needs_redraw_; } | 90 bool RedrawPending() const { return needs_redraw_; } |
91 bool ManageTilesPending() const { return needs_manage_tiles_; } | 91 bool ManageTilesPending() const { return needs_manage_tiles_; } |
92 | 92 |
93 enum Action { | 93 enum Action { |
94 ACTION_NONE, | 94 ACTION_NONE, |
95 ACTION_ANIMATE, | 95 ACTION_ANIMATE, |
96 ACTION_SEND_BEGIN_MAIN_FRAME, | 96 ACTION_SEND_BEGIN_MAIN_FRAME, |
97 ACTION_COMMIT, | 97 ACTION_COMMIT, |
98 ACTION_UPDATE_VISIBLE_TILES, | |
99 ACTION_ACTIVATE_SYNC_TREE, | 98 ACTION_ACTIVATE_SYNC_TREE, |
100 ACTION_DRAW_AND_SWAP_IF_POSSIBLE, | 99 ACTION_DRAW_AND_SWAP_IF_POSSIBLE, |
101 ACTION_DRAW_AND_SWAP_FORCED, | 100 ACTION_DRAW_AND_SWAP_FORCED, |
102 ACTION_DRAW_AND_SWAP_ABORT, | 101 ACTION_DRAW_AND_SWAP_ABORT, |
103 ACTION_BEGIN_OUTPUT_SURFACE_CREATION, | 102 ACTION_BEGIN_OUTPUT_SURFACE_CREATION, |
104 ACTION_MANAGE_TILES, | 103 ACTION_MANAGE_TILES, |
105 }; | 104 }; |
106 static const char* ActionToString(Action action); | 105 static const char* ActionToString(Action action); |
107 | 106 |
108 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; | 107 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 bool ProactiveBeginFrameWanted() const; | 252 bool ProactiveBeginFrameWanted() const; |
254 | 253 |
255 // True if we need to force activations to make forward progress. | 254 // True if we need to force activations to make forward progress. |
256 bool PendingActivationsShouldBeForced() const; | 255 bool PendingActivationsShouldBeForced() const; |
257 | 256 |
258 bool ShouldAnimate() const; | 257 bool ShouldAnimate() const; |
259 bool ShouldBeginOutputSurfaceCreation() const; | 258 bool ShouldBeginOutputSurfaceCreation() const; |
260 bool ShouldDrawForced() const; | 259 bool ShouldDrawForced() const; |
261 bool ShouldDraw() const; | 260 bool ShouldDraw() const; |
262 bool ShouldActivatePendingTree() const; | 261 bool ShouldActivatePendingTree() const; |
263 bool ShouldUpdateVisibleTiles() const; | |
264 bool ShouldSendBeginMainFrame() const; | 262 bool ShouldSendBeginMainFrame() const; |
265 bool ShouldCommit() const; | 263 bool ShouldCommit() const; |
266 bool ShouldManageTiles() const; | 264 bool ShouldManageTiles() const; |
267 | 265 |
268 void AdvanceCurrentFrameNumber(); | 266 void AdvanceCurrentFrameNumber(); |
269 bool HasAnimatedThisFrame() const; | 267 bool HasAnimatedThisFrame() const; |
270 bool HasSentBeginMainFrameThisFrame() const; | 268 bool HasSentBeginMainFrameThisFrame() const; |
271 bool HasUpdatedVisibleTilesThisFrame() const; | |
272 bool HasRequestedSwapThisFrame() const; | 269 bool HasRequestedSwapThisFrame() const; |
273 bool HasSwappedThisFrame() const; | 270 bool HasSwappedThisFrame() const; |
274 | 271 |
275 void UpdateStateOnCommit(bool commit_was_aborted); | 272 void UpdateStateOnCommit(bool commit_was_aborted); |
276 void UpdateStateOnActivation(); | 273 void UpdateStateOnActivation(); |
277 void UpdateStateOnDraw(bool did_request_swap); | 274 void UpdateStateOnDraw(bool did_request_swap); |
278 void UpdateStateOnManageTiles(); | 275 void UpdateStateOnManageTiles(); |
279 | 276 |
280 const SchedulerSettings settings_; | 277 const SchedulerSettings settings_; |
281 | 278 |
282 OutputSurfaceState output_surface_state_; | 279 OutputSurfaceState output_surface_state_; |
283 BeginImplFrameState begin_impl_frame_state_; | 280 BeginImplFrameState begin_impl_frame_state_; |
284 CommitState commit_state_; | 281 CommitState commit_state_; |
285 ForcedRedrawOnTimeoutState forced_redraw_state_; | 282 ForcedRedrawOnTimeoutState forced_redraw_state_; |
286 | 283 |
287 BeginFrameArgs begin_impl_frame_args_; | 284 BeginFrameArgs begin_impl_frame_args_; |
288 | 285 |
289 int commit_count_; | 286 int commit_count_; |
290 int current_frame_number_; | 287 int current_frame_number_; |
291 int last_frame_number_animate_performed_; | 288 int last_frame_number_animate_performed_; |
292 int last_frame_number_swap_performed_; | 289 int last_frame_number_swap_performed_; |
293 int last_frame_number_swap_requested_; | 290 int last_frame_number_swap_requested_; |
294 int last_frame_number_begin_main_frame_sent_; | 291 int last_frame_number_begin_main_frame_sent_; |
295 int last_frame_number_update_visible_tiles_was_called_; | |
296 | 292 |
297 // manage_tiles_funnel_ is "filled" each time ManageTiles is called | 293 // manage_tiles_funnel_ is "filled" each time ManageTiles is called |
298 // and "drained" on each BeginImplFrame. If the funnel gets too full, | 294 // and "drained" on each BeginImplFrame. If the funnel gets too full, |
299 // we start throttling ACTION_MANAGE_TILES such that we average one | 295 // we start throttling ACTION_MANAGE_TILES such that we average one |
300 // ManageTile per BeginImplFrame. | 296 // ManageTile per BeginImplFrame. |
301 int manage_tiles_funnel_; | 297 int manage_tiles_funnel_; |
302 int consecutive_checkerboard_animations_; | 298 int consecutive_checkerboard_animations_; |
303 int max_pending_swaps_; | 299 int max_pending_swaps_; |
304 int pending_swaps_; | 300 int pending_swaps_; |
305 bool needs_redraw_; | 301 bool needs_redraw_; |
306 bool needs_animate_; | 302 bool needs_animate_; |
307 bool needs_manage_tiles_; | 303 bool needs_manage_tiles_; |
308 bool swap_used_incomplete_tile_; | |
309 bool needs_commit_; | 304 bool needs_commit_; |
310 bool inside_poll_for_anticipated_draw_triggers_; | 305 bool inside_poll_for_anticipated_draw_triggers_; |
311 bool visible_; | 306 bool visible_; |
312 bool can_start_; | 307 bool can_start_; |
313 bool can_draw_; | 308 bool can_draw_; |
314 bool has_pending_tree_; | 309 bool has_pending_tree_; |
315 bool pending_tree_is_ready_for_activation_; | 310 bool pending_tree_is_ready_for_activation_; |
316 bool active_tree_needs_first_draw_; | 311 bool active_tree_needs_first_draw_; |
317 bool did_commit_after_animating_; | 312 bool did_commit_after_animating_; |
318 bool did_create_and_initialize_first_output_surface_; | 313 bool did_create_and_initialize_first_output_surface_; |
319 bool impl_latency_takes_priority_; | 314 bool impl_latency_takes_priority_; |
320 bool skip_next_begin_main_frame_to_reduce_latency_; | 315 bool skip_next_begin_main_frame_to_reduce_latency_; |
321 bool skip_begin_main_frame_to_reduce_latency_; | 316 bool skip_begin_main_frame_to_reduce_latency_; |
322 bool continuous_painting_; | 317 bool continuous_painting_; |
323 bool impl_latency_takes_priority_on_battery_; | 318 bool impl_latency_takes_priority_on_battery_; |
324 | 319 |
325 private: | 320 private: |
326 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 321 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
327 }; | 322 }; |
328 | 323 |
329 } // namespace cc | 324 } // namespace cc |
330 | 325 |
331 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 326 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
OLD | NEW |