| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; | 119 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; |
| 120 void AsValueInto(base::trace_event::TracedValue* dict) const; | 120 void AsValueInto(base::trace_event::TracedValue* dict) const; |
| 121 | 121 |
| 122 Action NextAction() const; | 122 Action NextAction() const; |
| 123 void UpdateState(Action action); | 123 void UpdateState(Action action); |
| 124 | 124 |
| 125 // Indicates whether the impl thread needs a BeginImplFrame callback in order | 125 // Indicates whether the impl thread needs a BeginImplFrame callback in order |
| 126 // to make progress. | 126 // to make progress. |
| 127 bool BeginFrameNeeded() const; | 127 bool BeginFrameNeeded() const; |
| 128 | 128 |
| 129 // Notifies the statme machine that the Scheduler skipped a BeginImplFrame |
| 130 // so the state machine can reset associated state. |
| 131 void DidSkipBeginImplFrameToReduceLatency(); |
| 132 |
| 129 // Indicates that the system has entered and left a BeginImplFrame callback. | 133 // Indicates that the system has entered and left a BeginImplFrame callback. |
| 130 // The scheduler will not draw more than once in a given BeginImplFrame | 134 // The scheduler will not draw more than once in a given BeginImplFrame |
| 131 // callback nor send more than one BeginMainFrame message. | 135 // callback nor send more than one BeginMainFrame message. |
| 132 void OnBeginImplFrame(); | 136 void OnBeginImplFrame(); |
| 133 void OnBeginImplFrameDeadlinePending(); | 137 void OnBeginImplFrameDeadlinePending(); |
| 134 // Indicates that the scheduler has entered the draw phase. The scheduler | 138 // Indicates that the scheduler has entered the draw phase. The scheduler |
| 135 // will not draw more than once in a single draw phase. | 139 // will not draw more than once in a single draw phase. |
| 136 // TODO(sunnyps): Rename OnBeginImplFrameDeadline to OnDraw or similar. | 140 // TODO(sunnyps): Rename OnBeginImplFrameDeadline to OnDraw or similar. |
| 137 void OnBeginImplFrameDeadline(); | 141 void OnBeginImplFrameDeadline(); |
| 138 void OnBeginImplFrameIdle(); | 142 void OnBeginImplFrameIdle(); |
| 139 BeginImplFrameState begin_impl_frame_state() const { | 143 BeginImplFrameState begin_impl_frame_state() const { |
| 140 return begin_impl_frame_state_; | 144 return begin_impl_frame_state_; |
| 141 } | 145 } |
| 142 BeginImplFrameDeadlineMode CurrentBeginImplFrameDeadlineMode() const; | 146 BeginImplFrameDeadlineMode CurrentBeginImplFrameDeadlineMode() const; |
| 143 | 147 |
| 144 // If the main thread didn't manage to produce a new frame in time for the | 148 // If the main thread didn't manage to produce a new frame in time for the |
| 145 // impl thread to draw, it is in a high latency mode. | 149 // impl thread to draw, it is in a high latency mode. |
| 146 bool MainThreadIsInHighLatencyMode() const; | 150 bool MainThreadIsInHighLatencyMode() const; |
| 147 | 151 |
| 152 bool last_swap_ack_came_after_begin_impl_frame() const { |
| 153 return last_swap_ack_came_after_begin_impl_frame_; |
| 154 } |
| 155 |
| 148 // Indicates whether the LayerTreeHostImpl is visible. | 156 // Indicates whether the LayerTreeHostImpl is visible. |
| 149 void SetVisible(bool visible); | 157 void SetVisible(bool visible); |
| 150 bool visible() const { return visible_; } | 158 bool visible() const { return visible_; } |
| 151 | 159 |
| 152 // Indicates that a redraw is required, either due to the impl tree changing | 160 // Indicates that a redraw is required, either due to the impl tree changing |
| 153 // or the screen being damaged and simply needing redisplay. | 161 // or the screen being damaged and simply needing redisplay. |
| 154 void SetNeedsRedraw(); | 162 void SetNeedsRedraw(); |
| 155 bool needs_redraw() const { return needs_redraw_; } | 163 bool needs_redraw() const { return needs_redraw_; } |
| 156 | 164 |
| 157 void SetNeedsAnimate(); | 165 void SetNeedsAnimate(); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 bool invalidate_output_surface_funnel_; | 318 bool invalidate_output_surface_funnel_; |
| 311 // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called | 319 // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called |
| 312 // and "drained" on each BeginImplFrame. If the funnel gets too full, | 320 // and "drained" on each BeginImplFrame. If the funnel gets too full, |
| 313 // we start throttling ACTION_PREPARE_TILES such that we average one | 321 // we start throttling ACTION_PREPARE_TILES such that we average one |
| 314 // PrepareTiles per BeginImplFrame. | 322 // PrepareTiles per BeginImplFrame. |
| 315 int prepare_tiles_funnel_; | 323 int prepare_tiles_funnel_; |
| 316 | 324 |
| 317 int consecutive_checkerboard_animations_; | 325 int consecutive_checkerboard_animations_; |
| 318 int max_pending_swaps_; | 326 int max_pending_swaps_; |
| 319 int pending_swaps_; | 327 int pending_swaps_; |
| 328 bool last_swap_ack_came_after_begin_impl_frame_; |
| 320 bool needs_redraw_; | 329 bool needs_redraw_; |
| 321 bool needs_animate_; | 330 bool needs_animate_; |
| 322 bool needs_prepare_tiles_; | 331 bool needs_prepare_tiles_; |
| 323 bool needs_commit_; | 332 bool needs_commit_; |
| 324 bool visible_; | 333 bool visible_; |
| 325 bool can_start_; | 334 bool can_start_; |
| 326 bool can_draw_; | 335 bool can_draw_; |
| 327 bool has_pending_tree_; | 336 bool has_pending_tree_; |
| 328 bool pending_tree_is_ready_for_activation_; | 337 bool pending_tree_is_ready_for_activation_; |
| 329 bool active_tree_needs_first_draw_; | 338 bool active_tree_needs_first_draw_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 340 bool did_request_swap_in_last_frame_; | 349 bool did_request_swap_in_last_frame_; |
| 341 bool did_perform_swap_in_last_draw_; | 350 bool did_perform_swap_in_last_draw_; |
| 342 | 351 |
| 343 private: | 352 private: |
| 344 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 353 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
| 345 }; | 354 }; |
| 346 | 355 |
| 347 } // namespace cc | 356 } // namespace cc |
| 348 | 357 |
| 349 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 358 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
| OLD | NEW |