| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 // Indicates that a redraw is required, either due to the impl tree changing | 162 // Indicates that a redraw is required, either due to the impl tree changing |
| 163 // or the screen being damaged and simply needing redisplay. | 163 // or the screen being damaged and simply needing redisplay. |
| 164 void SetNeedsRedraw(); | 164 void SetNeedsRedraw(); |
| 165 bool needs_redraw() const { return needs_redraw_; } | 165 bool needs_redraw() const { return needs_redraw_; } |
| 166 | 166 |
| 167 // Indicates that manage-tiles is required. This guarantees another | 167 // Indicates that manage-tiles is required. This guarantees another |
| 168 // ManageTiles will occur shortly (even if no redraw is required). | 168 // ManageTiles will occur shortly (even if no redraw is required). |
| 169 void SetNeedsManageTiles(); | 169 void SetNeedsManageTiles(); |
| 170 | 170 |
| 171 // Sets how many swaps can be pending to the OutputSurface. |
| 172 void SetMaxSwapsPending(int max); |
| 173 |
| 174 // If the scheduler attempted to draw and swap, this provides feedback |
| 175 // regarding whether or not the swap actually occured. We might skip the |
| 176 // swap when there is not damage, for example. |
| 177 void DidSwapBuffers(); |
| 178 |
| 171 // Indicates whether a redraw is required because we are currently rendering | 179 // Indicates whether a redraw is required because we are currently rendering |
| 172 // with a low resolution or checkerboarded tile. | 180 // with a low resolution or checkerboarded tile. |
| 173 void SetSwapUsedIncompleteTile(bool used_incomplete_tile); | 181 void SetSwapUsedIncompleteTile(bool used_incomplete_tile); |
| 174 | 182 |
| 183 // Notification from the OutputSurface that a swap has been consumed. |
| 184 void DidSwapBuffersComplete(); |
| 185 |
| 175 // Indicates whether to prioritize animation smoothness over new content | 186 // Indicates whether to prioritize animation smoothness over new content |
| 176 // activation. | 187 // activation. |
| 177 void SetSmoothnessTakesPriority(bool smoothness_takes_priority); | 188 void SetSmoothnessTakesPriority(bool smoothness_takes_priority); |
| 178 bool smoothness_takes_priority() const { return smoothness_takes_priority_; } | 189 bool smoothness_takes_priority() const { return smoothness_takes_priority_; } |
| 179 | 190 |
| 180 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen. | 191 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen. |
| 181 void DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DrawResult result); | 192 void DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DrawResult result); |
| 182 | 193 |
| 183 // Indicates that a new commit flow needs to be performed, either to pull | 194 // Indicates that a new commit flow needs to be performed, either to pull |
| 184 // updates from the main thread to the impl, or to push deltas from the impl | 195 // updates from the main thread to the impl, or to push deltas from the impl |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 bool ShouldManageTiles() const; | 264 bool ShouldManageTiles() const; |
| 254 | 265 |
| 255 void AdvanceCurrentFrameNumber(); | 266 void AdvanceCurrentFrameNumber(); |
| 256 bool HasSentBeginMainFrameThisFrame() const; | 267 bool HasSentBeginMainFrameThisFrame() const; |
| 257 bool HasScheduledManageTilesThisFrame() const; | 268 bool HasScheduledManageTilesThisFrame() const; |
| 258 bool HasUpdatedVisibleTilesThisFrame() const; | 269 bool HasUpdatedVisibleTilesThisFrame() const; |
| 259 bool HasSwappedThisFrame() const; | 270 bool HasSwappedThisFrame() const; |
| 260 | 271 |
| 261 void UpdateStateOnCommit(bool commit_was_aborted); | 272 void UpdateStateOnCommit(bool commit_was_aborted); |
| 262 void UpdateStateOnActivation(); | 273 void UpdateStateOnActivation(); |
| 263 void UpdateStateOnDraw(bool did_swap); | 274 void UpdateStateOnDraw(bool did_request_swap); |
| 264 void UpdateStateOnManageTiles(); | 275 void UpdateStateOnManageTiles(); |
| 265 | 276 |
| 266 const SchedulerSettings settings_; | 277 const SchedulerSettings settings_; |
| 267 | 278 |
| 268 OutputSurfaceState output_surface_state_; | 279 OutputSurfaceState output_surface_state_; |
| 269 BeginImplFrameState begin_impl_frame_state_; | 280 BeginImplFrameState begin_impl_frame_state_; |
| 270 CommitState commit_state_; | 281 CommitState commit_state_; |
| 271 ForcedRedrawOnTimeoutState forced_redraw_state_; | 282 ForcedRedrawOnTimeoutState forced_redraw_state_; |
| 272 SynchronousReadbackState readback_state_; | 283 SynchronousReadbackState readback_state_; |
| 273 | 284 |
| 274 BeginFrameArgs begin_impl_frame_args_; | 285 BeginFrameArgs begin_impl_frame_args_; |
| 275 | 286 |
| 276 int commit_count_; | 287 int commit_count_; |
| 277 int current_frame_number_; | 288 int current_frame_number_; |
| 278 int last_frame_number_swap_performed_; | 289 int last_frame_number_swap_performed_; |
| 279 int last_frame_number_begin_main_frame_sent_; | 290 int last_frame_number_begin_main_frame_sent_; |
| 280 int last_frame_number_update_visible_tiles_was_called_; | 291 int last_frame_number_update_visible_tiles_was_called_; |
| 281 | 292 |
| 282 // manage_tiles_funnel_ is "filled" each time ManageTiles is called | 293 // manage_tiles_funnel_ is "filled" each time ManageTiles is called |
| 283 // and "drained" on each BeginImplFrame. If the funnel gets too full, | 294 // and "drained" on each BeginImplFrame. If the funnel gets too full, |
| 284 // we start throttling ACTION_MANAGE_TILES such that we average one | 295 // we start throttling ACTION_MANAGE_TILES such that we average one |
| 285 // ManageTile per BeginImplFrame. | 296 // ManageTile per BeginImplFrame. |
| 286 int manage_tiles_funnel_; | 297 int manage_tiles_funnel_; |
| 287 int consecutive_checkerboard_animations_; | 298 int consecutive_checkerboard_animations_; |
| 299 int max_pending_swaps_; |
| 300 int pending_swaps_; |
| 288 bool needs_redraw_; | 301 bool needs_redraw_; |
| 289 bool needs_manage_tiles_; | 302 bool needs_manage_tiles_; |
| 290 bool swap_used_incomplete_tile_; | 303 bool swap_used_incomplete_tile_; |
| 291 bool needs_commit_; | 304 bool needs_commit_; |
| 292 bool inside_poll_for_anticipated_draw_triggers_; | 305 bool inside_poll_for_anticipated_draw_triggers_; |
| 293 bool visible_; | 306 bool visible_; |
| 294 bool can_start_; | 307 bool can_start_; |
| 295 bool can_draw_; | 308 bool can_draw_; |
| 296 bool has_pending_tree_; | 309 bool has_pending_tree_; |
| 297 bool pending_tree_is_ready_for_activation_; | 310 bool pending_tree_is_ready_for_activation_; |
| 298 bool active_tree_needs_first_draw_; | 311 bool active_tree_needs_first_draw_; |
| 299 bool draw_if_possible_failed_; | 312 bool draw_if_possible_failed_; |
| 300 bool did_create_and_initialize_first_output_surface_; | 313 bool did_create_and_initialize_first_output_surface_; |
| 301 bool smoothness_takes_priority_; | 314 bool smoothness_takes_priority_; |
| 302 bool skip_next_begin_main_frame_to_reduce_latency_; | 315 bool skip_next_begin_main_frame_to_reduce_latency_; |
| 303 bool skip_begin_main_frame_to_reduce_latency_; | 316 bool skip_begin_main_frame_to_reduce_latency_; |
| 304 bool continuous_painting_; | 317 bool continuous_painting_; |
| 305 bool needs_back_to_back_readback_; | 318 bool needs_back_to_back_readback_; |
| 306 | 319 |
| 307 private: | 320 private: |
| 308 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 321 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
| 309 }; | 322 }; |
| 310 | 323 |
| 311 } // namespace cc | 324 } // namespace cc |
| 312 | 325 |
| 313 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 326 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
| OLD | NEW |