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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 // Sets how many swaps can be pending to the OutputSurface. | 175 // Sets how many swaps can be pending to the OutputSurface. |
172 void SetMaxSwapsPending(int max); | 176 void SetMaxSwapsPending(int max); |
173 | 177 |
174 // If the scheduler attempted to draw and swap, this provides feedback | 178 // If the scheduler attempted to draw and swap, this provides feedback |
175 // regarding whether or not the swap actually occured. We might skip the | 179 // regarding whether or not the swap actually occured. We might skip the |
176 // swap when there is not damage, for example. | 180 // swap when there is not damage, for example. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 // True if we need to abort draws to make forward progress. | 245 // True if we need to abort draws to make forward progress. |
242 bool PendingDrawsShouldBeAborted() const; | 246 bool PendingDrawsShouldBeAborted() const; |
243 | 247 |
244 bool SupportsProactiveBeginFrame() const; | 248 bool SupportsProactiveBeginFrame() const; |
245 | 249 |
246 void SetContinuousPainting(bool continuous_painting) { | 250 void SetContinuousPainting(bool continuous_painting) { |
247 continuous_painting_ = continuous_painting; | 251 continuous_painting_ = continuous_painting; |
248 } | 252 } |
249 | 253 |
250 protected: | 254 protected: |
251 bool BeginFrameNeededToDraw() const; | 255 bool BeginFrameNeededToAnimateOrDraw() const; |
252 bool ProactiveBeginFrameWanted() const; | 256 bool ProactiveBeginFrameWanted() const; |
253 | 257 |
254 // True if we need to force activations to make forward progress. | 258 // True if we need to force activations to make forward progress. |
255 bool PendingActivationsShouldBeForced() const; | 259 bool PendingActivationsShouldBeForced() const; |
256 | 260 |
| 261 bool ShouldAnimate() const; |
257 bool ShouldBeginOutputSurfaceCreation() const; | 262 bool ShouldBeginOutputSurfaceCreation() const; |
258 bool ShouldDrawForced() const; | 263 bool ShouldDrawForced() const; |
259 bool ShouldDraw() const; | 264 bool ShouldDraw() const; |
260 bool ShouldActivatePendingTree() const; | 265 bool ShouldActivatePendingTree() const; |
261 bool ShouldUpdateVisibleTiles() const; | 266 bool ShouldUpdateVisibleTiles() const; |
262 bool ShouldSendBeginMainFrame() const; | 267 bool ShouldSendBeginMainFrame() const; |
263 bool ShouldCommit() const; | 268 bool ShouldCommit() const; |
264 bool ShouldManageTiles() const; | 269 bool ShouldManageTiles() const; |
265 | 270 |
266 void AdvanceCurrentFrameNumber(); | 271 void AdvanceCurrentFrameNumber(); |
(...skipping 12 matching lines...) Expand all Loading... |
279 OutputSurfaceState output_surface_state_; | 284 OutputSurfaceState output_surface_state_; |
280 BeginImplFrameState begin_impl_frame_state_; | 285 BeginImplFrameState begin_impl_frame_state_; |
281 CommitState commit_state_; | 286 CommitState commit_state_; |
282 ForcedRedrawOnTimeoutState forced_redraw_state_; | 287 ForcedRedrawOnTimeoutState forced_redraw_state_; |
283 SynchronousReadbackState readback_state_; | 288 SynchronousReadbackState readback_state_; |
284 | 289 |
285 BeginFrameArgs begin_impl_frame_args_; | 290 BeginFrameArgs begin_impl_frame_args_; |
286 | 291 |
287 int commit_count_; | 292 int commit_count_; |
288 int current_frame_number_; | 293 int current_frame_number_; |
| 294 int last_frame_number_animate_performed_; |
289 int last_frame_number_swap_performed_; | 295 int last_frame_number_swap_performed_; |
290 int last_frame_number_begin_main_frame_sent_; | 296 int last_frame_number_begin_main_frame_sent_; |
291 int last_frame_number_update_visible_tiles_was_called_; | 297 int last_frame_number_update_visible_tiles_was_called_; |
292 | 298 |
293 // manage_tiles_funnel_ is "filled" each time ManageTiles is called | 299 // manage_tiles_funnel_ is "filled" each time ManageTiles is called |
294 // and "drained" on each BeginImplFrame. If the funnel gets too full, | 300 // and "drained" on each BeginImplFrame. If the funnel gets too full, |
295 // we start throttling ACTION_MANAGE_TILES such that we average one | 301 // we start throttling ACTION_MANAGE_TILES such that we average one |
296 // ManageTile per BeginImplFrame. | 302 // ManageTile per BeginImplFrame. |
297 int manage_tiles_funnel_; | 303 int manage_tiles_funnel_; |
298 int consecutive_checkerboard_animations_; | 304 int consecutive_checkerboard_animations_; |
299 int max_pending_swaps_; | 305 int max_pending_swaps_; |
300 int pending_swaps_; | 306 int pending_swaps_; |
301 bool needs_redraw_; | 307 bool needs_redraw_; |
| 308 bool needs_animate_; |
302 bool needs_manage_tiles_; | 309 bool needs_manage_tiles_; |
303 bool swap_used_incomplete_tile_; | 310 bool swap_used_incomplete_tile_; |
304 bool needs_commit_; | 311 bool needs_commit_; |
305 bool inside_poll_for_anticipated_draw_triggers_; | 312 bool inside_poll_for_anticipated_draw_triggers_; |
306 bool visible_; | 313 bool visible_; |
307 bool can_start_; | 314 bool can_start_; |
308 bool can_draw_; | 315 bool can_draw_; |
309 bool has_pending_tree_; | 316 bool has_pending_tree_; |
310 bool pending_tree_is_ready_for_activation_; | 317 bool pending_tree_is_ready_for_activation_; |
311 bool active_tree_needs_first_draw_; | 318 bool active_tree_needs_first_draw_; |
312 bool draw_if_possible_failed_; | 319 bool draw_if_possible_failed_; |
313 bool did_create_and_initialize_first_output_surface_; | 320 bool did_create_and_initialize_first_output_surface_; |
314 bool smoothness_takes_priority_; | 321 bool smoothness_takes_priority_; |
315 bool skip_next_begin_main_frame_to_reduce_latency_; | 322 bool skip_next_begin_main_frame_to_reduce_latency_; |
316 bool skip_begin_main_frame_to_reduce_latency_; | 323 bool skip_begin_main_frame_to_reduce_latency_; |
317 bool continuous_painting_; | 324 bool continuous_painting_; |
318 bool needs_back_to_back_readback_; | 325 bool needs_back_to_back_readback_; |
319 | 326 |
320 private: | 327 private: |
321 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 328 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
322 }; | 329 }; |
323 | 330 |
324 } // namespace cc | 331 } // namespace cc |
325 | 332 |
326 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 333 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
OLD | NEW |