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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 ForcedRedrawOnTimeoutState state); | 90 ForcedRedrawOnTimeoutState state); |
91 | 91 |
92 bool CommitPending() const { | 92 bool CommitPending() const { |
93 return commit_state_ == COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 93 return commit_state_ == COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
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 PrepareTilesPending() const { return needs_prepare_tiles_; } |
101 | 101 |
102 enum Action { | 102 enum Action { |
103 ACTION_NONE, | 103 ACTION_NONE, |
104 ACTION_ANIMATE, | 104 ACTION_ANIMATE, |
105 ACTION_SEND_BEGIN_MAIN_FRAME, | 105 ACTION_SEND_BEGIN_MAIN_FRAME, |
106 ACTION_COMMIT, | 106 ACTION_COMMIT, |
107 ACTION_ACTIVATE_SYNC_TREE, | 107 ACTION_ACTIVATE_SYNC_TREE, |
108 ACTION_DRAW_AND_SWAP_IF_POSSIBLE, | 108 ACTION_DRAW_AND_SWAP_IF_POSSIBLE, |
109 ACTION_DRAW_AND_SWAP_FORCED, | 109 ACTION_DRAW_AND_SWAP_FORCED, |
110 ACTION_DRAW_AND_SWAP_ABORT, | 110 ACTION_DRAW_AND_SWAP_ABORT, |
111 ACTION_BEGIN_OUTPUT_SURFACE_CREATION, | 111 ACTION_BEGIN_OUTPUT_SURFACE_CREATION, |
112 ACTION_MANAGE_TILES, | 112 ACTION_PREPARE_TILES, |
113 }; | 113 }; |
114 static const char* ActionToString(Action action); | 114 static const char* ActionToString(Action action); |
115 | 115 |
116 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; | 116 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; |
117 void AsValueInto(base::debug::TracedValue* dict, base::TimeTicks now) const; | 117 void AsValueInto(base::debug::TracedValue* dict, base::TimeTicks now) const; |
118 | 118 |
119 Action NextAction() const; | 119 Action NextAction() const; |
120 void UpdateState(Action action); | 120 void UpdateState(Action action); |
121 | 121 |
122 // Indicates whether the impl thread needs a BeginImplFrame callback in order | 122 // Indicates whether the impl thread needs a BeginImplFrame callback in order |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 void SetVisible(bool visible); | 158 void SetVisible(bool visible); |
159 | 159 |
160 // 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 |
161 // or the screen being damaged and simply needing redisplay. | 161 // or the screen being damaged and simply needing redisplay. |
162 void SetNeedsRedraw(); | 162 void SetNeedsRedraw(); |
163 bool needs_redraw() const { return needs_redraw_; } | 163 bool needs_redraw() const { return needs_redraw_; } |
164 | 164 |
165 void SetNeedsAnimate(); | 165 void SetNeedsAnimate(); |
166 bool needs_animate() const { return needs_animate_; } | 166 bool needs_animate() const { return needs_animate_; } |
167 | 167 |
168 // Indicates that manage-tiles is required. This guarantees another | 168 // Indicates that manage-tiles is required. This guarantees another |
brianderson
2014/12/09 03:30:07
Fix comment
vmiura
2014/12/09 18:08:46
Done.
| |
169 // ManageTiles will occur shortly (even if no redraw is required). | 169 // PrepareTiles will occur shortly (even if no redraw is required). |
170 void SetNeedsManageTiles(); | 170 void SetNeedsPrepareTiles(); |
171 | 171 |
172 // Sets how many swaps can be pending to the OutputSurface. | 172 // Sets how many swaps can be pending to the OutputSurface. |
173 void SetMaxSwapsPending(int max); | 173 void SetMaxSwapsPending(int max); |
174 | 174 |
175 // If the scheduler attempted to draw and swap, this provides feedback | 175 // If the scheduler attempted to draw and swap, this provides feedback |
176 // regarding whether or not the swap actually occured. We might skip the | 176 // regarding whether or not the swap actually occured. We might skip the |
177 // swap when there is not damage, for example. | 177 // swap when there is not damage, for example. |
178 void DidSwapBuffers(); | 178 void DidSwapBuffers(); |
179 | 179 |
180 // Indicates whether a redraw is required because we are currently rendering | 180 // Indicates whether a redraw is required because we are currently rendering |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
223 void NotifyBeginMainFrameStarted(); | 223 void NotifyBeginMainFrameStarted(); |
224 | 224 |
225 // Indicates that the pending tree is ready for activation. | 225 // Indicates that the pending tree is ready for activation. |
226 void NotifyReadyToActivate(); | 226 void NotifyReadyToActivate(); |
227 | 227 |
228 bool has_pending_tree() const { return has_pending_tree_; } | 228 bool has_pending_tree() const { return has_pending_tree_; } |
229 bool active_tree_needs_first_draw() const { | 229 bool active_tree_needs_first_draw() const { |
230 return active_tree_needs_first_draw_; | 230 return active_tree_needs_first_draw_; |
231 } | 231 } |
232 | 232 |
233 void DidManageTiles(); | 233 void DidPrepareTiles(); |
234 void DidLoseOutputSurface(); | 234 void DidLoseOutputSurface(); |
235 void DidCreateAndInitializeOutputSurface(); | 235 void DidCreateAndInitializeOutputSurface(); |
236 bool HasInitializedOutputSurface() const; | 236 bool HasInitializedOutputSurface() const; |
237 | 237 |
238 // True if we need to abort draws to make forward progress. | 238 // True if we need to abort draws to make forward progress. |
239 bool PendingDrawsShouldBeAborted() const; | 239 bool PendingDrawsShouldBeAborted() const; |
240 | 240 |
241 bool SupportsProactiveBeginFrame() const; | 241 bool SupportsProactiveBeginFrame() const; |
242 | 242 |
243 void SetContinuousPainting(bool continuous_painting) { | 243 void SetContinuousPainting(bool continuous_painting) { |
(...skipping 27 matching lines...) Expand all Loading... | |
271 // True if we need to force activations to make forward progress. | 271 // True if we need to force activations to make forward progress. |
272 bool PendingActivationsShouldBeForced() const; | 272 bool PendingActivationsShouldBeForced() const; |
273 | 273 |
274 bool ShouldAnimate() const; | 274 bool ShouldAnimate() const; |
275 bool ShouldBeginOutputSurfaceCreation() const; | 275 bool ShouldBeginOutputSurfaceCreation() const; |
276 bool ShouldDrawForced() const; | 276 bool ShouldDrawForced() const; |
277 bool ShouldDraw() const; | 277 bool ShouldDraw() const; |
278 bool ShouldActivatePendingTree() const; | 278 bool ShouldActivatePendingTree() const; |
279 bool ShouldSendBeginMainFrame() const; | 279 bool ShouldSendBeginMainFrame() const; |
280 bool ShouldCommit() const; | 280 bool ShouldCommit() const; |
281 bool ShouldManageTiles() const; | 281 bool ShouldPrepareTiles() const; |
282 | 282 |
283 void AdvanceCurrentFrameNumber(); | 283 void AdvanceCurrentFrameNumber(); |
284 bool HasAnimatedThisFrame() const; | 284 bool HasAnimatedThisFrame() const; |
285 bool HasSentBeginMainFrameThisFrame() const; | 285 bool HasSentBeginMainFrameThisFrame() const; |
286 bool HasRequestedSwapThisFrame() const; | 286 bool HasRequestedSwapThisFrame() const; |
287 bool HasSwappedThisFrame() const; | 287 bool HasSwappedThisFrame() const; |
288 | 288 |
289 void UpdateStateOnCommit(bool commit_was_aborted); | 289 void UpdateStateOnCommit(bool commit_was_aborted); |
290 void UpdateStateOnActivation(); | 290 void UpdateStateOnActivation(); |
291 void UpdateStateOnDraw(bool did_request_swap); | 291 void UpdateStateOnDraw(bool did_request_swap); |
292 void UpdateStateOnManageTiles(); | 292 void UpdateStateOnPrepareTiles(); |
293 | 293 |
294 const SchedulerSettings settings_; | 294 const SchedulerSettings settings_; |
295 | 295 |
296 OutputSurfaceState output_surface_state_; | 296 OutputSurfaceState output_surface_state_; |
297 BeginImplFrameState begin_impl_frame_state_; | 297 BeginImplFrameState begin_impl_frame_state_; |
298 CommitState commit_state_; | 298 CommitState commit_state_; |
299 ForcedRedrawOnTimeoutState forced_redraw_state_; | 299 ForcedRedrawOnTimeoutState forced_redraw_state_; |
300 | 300 |
301 BeginFrameArgs begin_impl_frame_args_; | 301 BeginFrameArgs begin_impl_frame_args_; |
302 | 302 |
303 int commit_count_; | 303 int commit_count_; |
304 int current_frame_number_; | 304 int current_frame_number_; |
305 int last_frame_number_animate_performed_; | 305 int last_frame_number_animate_performed_; |
306 int last_frame_number_swap_performed_; | 306 int last_frame_number_swap_performed_; |
307 int last_frame_number_swap_requested_; | 307 int last_frame_number_swap_requested_; |
308 int last_frame_number_begin_main_frame_sent_; | 308 int last_frame_number_begin_main_frame_sent_; |
309 | 309 |
310 // manage_tiles_funnel_ is "filled" each time ManageTiles is called | 310 // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called |
311 // and "drained" on each BeginImplFrame. If the funnel gets too full, | 311 // and "drained" on each BeginImplFrame. If the funnel gets too full, |
312 // we start throttling ACTION_MANAGE_TILES such that we average one | 312 // we start throttling ACTION_PREPARE_TILES such that we average one |
313 // ManageTile per BeginImplFrame. | 313 // ManageTile per BeginImplFrame. |
brianderson
2014/12/09 03:30:07
ManageTile per BeginImplFrame -> PrepareTile per..
vmiura
2014/12/09 18:08:46
Done.
| |
314 int manage_tiles_funnel_; | 314 int prepare_tiles_funnel_; |
315 int consecutive_checkerboard_animations_; | 315 int consecutive_checkerboard_animations_; |
316 int max_pending_swaps_; | 316 int max_pending_swaps_; |
317 int pending_swaps_; | 317 int pending_swaps_; |
318 bool needs_redraw_; | 318 bool needs_redraw_; |
319 bool needs_animate_; | 319 bool needs_animate_; |
320 bool needs_manage_tiles_; | 320 bool needs_prepare_tiles_; |
321 bool needs_commit_; | 321 bool needs_commit_; |
322 bool inside_poll_for_anticipated_draw_triggers_; | 322 bool inside_poll_for_anticipated_draw_triggers_; |
323 bool visible_; | 323 bool visible_; |
324 bool can_start_; | 324 bool can_start_; |
325 bool can_draw_; | 325 bool can_draw_; |
326 bool has_pending_tree_; | 326 bool has_pending_tree_; |
327 bool pending_tree_is_ready_for_activation_; | 327 bool pending_tree_is_ready_for_activation_; |
328 bool active_tree_needs_first_draw_; | 328 bool active_tree_needs_first_draw_; |
329 bool did_commit_after_animating_; | 329 bool did_commit_after_animating_; |
330 bool did_create_and_initialize_first_output_surface_; | 330 bool did_create_and_initialize_first_output_surface_; |
331 bool impl_latency_takes_priority_; | 331 bool impl_latency_takes_priority_; |
332 bool skip_next_begin_main_frame_to_reduce_latency_; | 332 bool skip_next_begin_main_frame_to_reduce_latency_; |
333 bool skip_begin_main_frame_to_reduce_latency_; | 333 bool skip_begin_main_frame_to_reduce_latency_; |
334 bool continuous_painting_; | 334 bool continuous_painting_; |
335 bool impl_latency_takes_priority_on_battery_; | 335 bool impl_latency_takes_priority_on_battery_; |
336 bool children_need_begin_frames_; | 336 bool children_need_begin_frames_; |
337 | 337 |
338 private: | 338 private: |
339 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 339 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
340 }; | 340 }; |
341 | 341 |
342 } // namespace cc | 342 } // namespace cc |
343 | 343 |
344 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 344 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
OLD | NEW |