Chromium Code Reviews| 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 state 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 swaps_are_likely_high_latency() const { | |
| 153 return swaps_are_likely_high_latency_; | |
| 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 28 matching lines...) Expand all Loading... | |
| 186 return impl_latency_takes_priority_; | 194 return impl_latency_takes_priority_; |
| 187 } | 195 } |
| 188 | 196 |
| 189 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen. | 197 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen. |
| 190 void DidDrawIfPossibleCompleted(DrawResult result); | 198 void DidDrawIfPossibleCompleted(DrawResult result); |
| 191 | 199 |
| 192 // Indicates that a new commit flow needs to be performed, either to pull | 200 // Indicates that a new commit flow needs to be performed, either to pull |
| 193 // updates from the main thread to the impl, or to push deltas from the impl | 201 // updates from the main thread to the impl, or to push deltas from the impl |
| 194 // thread to main. | 202 // thread to main. |
| 195 void SetNeedsCommit(); | 203 void SetNeedsCommit(); |
| 204 bool NeedsCommitForTesting() const { return needs_commit_; } | |
|
sunnyps
2015/05/12 00:36:25
nit: This could be renamed to needs_commit. That w
brianderson
2015/05/12 19:25:17
Done.
| |
| 196 | 205 |
| 197 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME | 206 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME |
| 198 // from NextAction. | 207 // from NextAction. |
| 199 // Indicates that all painting is complete. | 208 // Indicates that all painting is complete. |
| 200 void NotifyReadyToCommit(); | 209 void NotifyReadyToCommit(); |
| 201 | 210 |
| 202 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME | 211 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME |
| 203 // from NextAction if the client rejects the BeginMainFrame message. | 212 // from NextAction if the client rejects the BeginMainFrame message. |
| 204 void BeginMainFrameAborted(CommitEarlyOutReason reason); | 213 void BeginMainFrameAborted(CommitEarlyOutReason reason); |
| 205 | 214 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 bool invalidate_output_surface_funnel_; | 319 bool invalidate_output_surface_funnel_; |
| 311 // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called | 320 // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called |
| 312 // and "drained" on each BeginImplFrame. If the funnel gets too full, | 321 // and "drained" on each BeginImplFrame. If the funnel gets too full, |
| 313 // we start throttling ACTION_PREPARE_TILES such that we average one | 322 // we start throttling ACTION_PREPARE_TILES such that we average one |
| 314 // PrepareTiles per BeginImplFrame. | 323 // PrepareTiles per BeginImplFrame. |
| 315 int prepare_tiles_funnel_; | 324 int prepare_tiles_funnel_; |
| 316 | 325 |
| 317 int consecutive_checkerboard_animations_; | 326 int consecutive_checkerboard_animations_; |
| 318 int max_pending_swaps_; | 327 int max_pending_swaps_; |
| 319 int pending_swaps_; | 328 int pending_swaps_; |
| 329 bool swaps_are_likely_high_latency_; | |
| 330 bool swap_throttled_in_last_deadline_; | |
| 320 bool needs_redraw_; | 331 bool needs_redraw_; |
| 321 bool needs_animate_; | 332 bool needs_animate_; |
| 322 bool needs_prepare_tiles_; | 333 bool needs_prepare_tiles_; |
| 323 bool needs_commit_; | 334 bool needs_commit_; |
| 324 bool visible_; | 335 bool visible_; |
| 325 bool can_start_; | 336 bool can_start_; |
| 326 bool can_draw_; | 337 bool can_draw_; |
| 327 bool has_pending_tree_; | 338 bool has_pending_tree_; |
| 328 bool pending_tree_is_ready_for_activation_; | 339 bool pending_tree_is_ready_for_activation_; |
| 329 bool active_tree_needs_first_draw_; | 340 bool active_tree_needs_first_draw_; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 340 bool did_request_swap_in_last_frame_; | 351 bool did_request_swap_in_last_frame_; |
| 341 bool did_perform_swap_in_last_draw_; | 352 bool did_perform_swap_in_last_draw_; |
| 342 | 353 |
| 343 private: | 354 private: |
| 344 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 355 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
| 345 }; | 356 }; |
| 346 | 357 |
| 347 } // namespace cc | 358 } // namespace cc |
| 348 | 359 |
| 349 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 360 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
| OLD | NEW |