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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
13 #include "cc/output/begin_frame_args.h" | 13 #include "cc/output/begin_frame_args.h" |
14 #include "cc/scheduler/commit_earlyout_reason.h" | 14 #include "cc/scheduler/commit_earlyout_reason.h" |
15 #include "cc/scheduler/draw_result.h" | 15 #include "cc/scheduler/draw_result.h" |
16 #include "cc/scheduler/scheduler_settings.h" | 16 #include "cc/scheduler/scheduler_settings.h" |
| 17 #include "cc/tiles/tile_priority.h" |
17 | 18 |
18 namespace base { | 19 namespace base { |
19 namespace trace_event { | 20 namespace trace_event { |
20 class ConvertableToTraceFormat; | 21 class ConvertableToTraceFormat; |
21 class TracedValue; | 22 class TracedValue; |
22 } | 23 } |
23 class Value; | 24 class Value; |
24 } | 25 } |
25 | 26 |
26 namespace cc { | 27 namespace cc { |
27 | 28 |
| 29 enum class ScrollHandlerState { |
| 30 SCROLL_AFFECTS_SCROLL_HANDLER, |
| 31 SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER, |
| 32 }; |
| 33 const char* ScrollHandlerStateToString(ScrollHandlerState state); |
| 34 |
28 // The SchedulerStateMachine decides how to coordinate main thread activites | 35 // The SchedulerStateMachine decides how to coordinate main thread activites |
29 // like painting/running javascript with rendering and input activities on the | 36 // like painting/running javascript with rendering and input activities on the |
30 // impl thread. | 37 // impl thread. |
31 // | 38 // |
32 // The state machine tracks internal state but is also influenced by external | 39 // The state machine tracks internal state but is also influenced by external |
33 // state. Internal state includes things like whether a frame has been | 40 // state. Internal state includes things like whether a frame has been |
34 // requested, while external state includes things like the current time being | 41 // requested, while external state includes things like the current time being |
35 // near to the vblank time. | 42 // near to the vblank time. |
36 // | 43 // |
37 // The scheduler seperates "what to do next" from the updating of its internal | 44 // The scheduler seperates "what to do next" from the updating of its internal |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // with a low resolution or checkerboarded tile. | 190 // with a low resolution or checkerboarded tile. |
184 void SetSwapUsedIncompleteTile(bool used_incomplete_tile); | 191 void SetSwapUsedIncompleteTile(bool used_incomplete_tile); |
185 | 192 |
186 // Notification from the OutputSurface that a swap has been consumed. | 193 // Notification from the OutputSurface that a swap has been consumed. |
187 void DidSwapBuffersComplete(); | 194 void DidSwapBuffersComplete(); |
188 | 195 |
189 int pending_swaps() const { return pending_swaps_; } | 196 int pending_swaps() const { return pending_swaps_; } |
190 | 197 |
191 // Indicates whether to prioritize impl thread latency (i.e., animation | 198 // Indicates whether to prioritize impl thread latency (i.e., animation |
192 // smoothness) over new content activation. | 199 // smoothness) over new content activation. |
193 void SetImplLatencyTakesPriority(bool impl_latency_takes_priority); | 200 void SetTreePrioritiesAndScrollState(TreePriority tree_priority, |
194 bool impl_latency_takes_priority() const { | 201 ScrollHandlerState scroll_handler_state); |
195 return impl_latency_takes_priority_; | 202 |
196 } | 203 // Indicates if the main thread will likely respond within 1 vsync. |
| 204 void SetCriticalBeginMainFrameToActivateIsFast(bool is_fast); |
| 205 |
| 206 // A function of SetTreePrioritiesAndScrollState and |
| 207 // SetCriticalBeginMainFrameToActivateIsFast. |
| 208 bool ImplLatencyTakesPriority() const; |
197 | 209 |
198 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen. | 210 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen. |
199 void DidDrawIfPossibleCompleted(DrawResult result); | 211 void DidDrawIfPossibleCompleted(DrawResult result); |
200 | 212 |
201 // Indicates that a new begin main frame flow needs to be performed, either | 213 // Indicates that a new begin main frame flow needs to be performed, either |
202 // to pull updates from the main thread to the impl, or to push deltas from | 214 // to pull updates from the main thread to the impl, or to push deltas from |
203 // the impl thread to main. | 215 // the impl thread to main. |
204 void SetNeedsBeginMainFrame(); | 216 void SetNeedsBeginMainFrame(); |
205 bool needs_begin_main_frame() const { return needs_begin_main_frame_; } | 217 bool needs_begin_main_frame() const { return needs_begin_main_frame_; } |
206 | 218 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 bool needs_prepare_tiles_; | 335 bool needs_prepare_tiles_; |
324 bool needs_begin_main_frame_; | 336 bool needs_begin_main_frame_; |
325 bool needs_one_begin_impl_frame_; | 337 bool needs_one_begin_impl_frame_; |
326 bool visible_; | 338 bool visible_; |
327 bool resourceless_draw_; | 339 bool resourceless_draw_; |
328 bool can_draw_; | 340 bool can_draw_; |
329 bool has_pending_tree_; | 341 bool has_pending_tree_; |
330 bool pending_tree_is_ready_for_activation_; | 342 bool pending_tree_is_ready_for_activation_; |
331 bool active_tree_needs_first_draw_; | 343 bool active_tree_needs_first_draw_; |
332 bool did_create_and_initialize_first_output_surface_; | 344 bool did_create_and_initialize_first_output_surface_; |
333 bool impl_latency_takes_priority_; | 345 TreePriority tree_priority_; |
| 346 ScrollHandlerState scroll_handler_state_; |
| 347 bool critical_begin_main_frame_to_activate_is_fast_; |
334 bool main_thread_missed_last_deadline_; | 348 bool main_thread_missed_last_deadline_; |
335 bool skip_next_begin_main_frame_to_reduce_latency_; | 349 bool skip_next_begin_main_frame_to_reduce_latency_; |
336 bool children_need_begin_frames_; | 350 bool children_need_begin_frames_; |
337 bool defer_commits_; | 351 bool defer_commits_; |
338 bool video_needs_begin_frames_; | 352 bool video_needs_begin_frames_; |
339 bool last_commit_had_no_updates_; | 353 bool last_commit_had_no_updates_; |
340 bool wait_for_ready_to_draw_; | 354 bool wait_for_ready_to_draw_; |
341 bool did_request_swap_in_last_frame_; | 355 bool did_request_swap_in_last_frame_; |
342 bool did_perform_swap_in_last_draw_; | 356 bool did_perform_swap_in_last_draw_; |
343 | 357 |
344 private: | 358 private: |
345 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 359 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
346 }; | 360 }; |
347 | 361 |
348 } // namespace cc | 362 } // namespace cc |
349 | 363 |
350 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 364 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
OLD | NEW |