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" |
| 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 ScrollHandlerState { | |
|
Sami
2015/11/18 19:46:05
nit: could this be an enum class?
| |
| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 // with a low resolution or checkerboarded tile. | 193 // with a low resolution or checkerboarded tile. |
| 187 void SetSwapUsedIncompleteTile(bool used_incomplete_tile); | 194 void SetSwapUsedIncompleteTile(bool used_incomplete_tile); |
| 188 | 195 |
| 189 // Notification from the OutputSurface that a swap has been consumed. | 196 // Notification from the OutputSurface that a swap has been consumed. |
| 190 void DidSwapBuffersComplete(); | 197 void DidSwapBuffersComplete(); |
| 191 | 198 |
| 192 int pending_swaps() const { return pending_swaps_; } | 199 int pending_swaps() const { return pending_swaps_; } |
| 193 | 200 |
| 194 // Indicates whether to prioritize impl thread latency (i.e., animation | 201 // Indicates whether to prioritize impl thread latency (i.e., animation |
| 195 // smoothness) over new content activation. | 202 // smoothness) over new content activation. |
| 196 void SetImplLatencyTakesPriority(bool impl_latency_takes_priority); | 203 void SetSmoothnessMode(TreePriority tree_priority, |
| 197 bool impl_latency_takes_priority() const { | 204 ScrollHandlerState scroll_handler_state); |
| 198 return impl_latency_takes_priority_; | 205 |
| 199 } | 206 // Indicates if the main thread will likely respond within 1 vsync. |
| 207 void SetCriticalBeginMainFrameToActivateIsFast(bool is_fast); | |
| 208 | |
| 209 // A function of SetSmoothnessMode and | |
| 210 // SetCriticalBeginMainFrameToActivateIsFast. | |
| 211 bool ImplLatencyTakesPriority() const; | |
| 200 | 212 |
| 201 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen. | 213 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen. |
| 202 void DidDrawIfPossibleCompleted(DrawResult result); | 214 void DidDrawIfPossibleCompleted(DrawResult result); |
| 203 | 215 |
| 204 // Indicates that a new begin main frame flow needs to be performed, either | 216 // Indicates that a new begin main frame flow needs to be performed, either |
| 205 // to pull updates from the main thread to the impl, or to push deltas from | 217 // to pull updates from the main thread to the impl, or to push deltas from |
| 206 // the impl thread to main. | 218 // the impl thread to main. |
| 207 void SetNeedsBeginMainFrame(); | 219 void SetNeedsBeginMainFrame(); |
| 208 bool needs_begin_main_frame() const { return needs_begin_main_frame_; } | 220 bool needs_begin_main_frame() const { return needs_begin_main_frame_; } |
| 209 | 221 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 bool needs_prepare_tiles_; | 338 bool needs_prepare_tiles_; |
| 327 bool needs_begin_main_frame_; | 339 bool needs_begin_main_frame_; |
| 328 bool needs_one_begin_impl_frame_; | 340 bool needs_one_begin_impl_frame_; |
| 329 bool visible_; | 341 bool visible_; |
| 330 bool resourceless_draw_; | 342 bool resourceless_draw_; |
| 331 bool can_draw_; | 343 bool can_draw_; |
| 332 bool has_pending_tree_; | 344 bool has_pending_tree_; |
| 333 bool pending_tree_is_ready_for_activation_; | 345 bool pending_tree_is_ready_for_activation_; |
| 334 bool active_tree_needs_first_draw_; | 346 bool active_tree_needs_first_draw_; |
| 335 bool did_create_and_initialize_first_output_surface_; | 347 bool did_create_and_initialize_first_output_surface_; |
| 336 bool impl_latency_takes_priority_; | 348 TreePriority tree_priority_; |
| 349 ScrollHandlerState scroll_handler_state_; | |
| 350 bool critical_begin_main_frame_to_activate_is_fast_; | |
| 337 bool main_thread_missed_last_deadline_; | 351 bool main_thread_missed_last_deadline_; |
| 338 bool skip_next_begin_main_frame_to_reduce_latency_; | 352 bool skip_next_begin_main_frame_to_reduce_latency_; |
| 339 bool children_need_begin_frames_; | 353 bool children_need_begin_frames_; |
| 340 bool defer_commits_; | 354 bool defer_commits_; |
| 341 bool video_needs_begin_frames_; | 355 bool video_needs_begin_frames_; |
| 342 bool last_commit_had_no_updates_; | 356 bool last_commit_had_no_updates_; |
| 343 bool wait_for_ready_to_draw_; | 357 bool wait_for_ready_to_draw_; |
| 344 bool did_request_swap_in_last_frame_; | 358 bool did_request_swap_in_last_frame_; |
| 345 bool did_perform_swap_in_last_draw_; | 359 bool did_perform_swap_in_last_draw_; |
| 346 | 360 |
| 347 private: | 361 private: |
| 348 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 362 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
| 349 }; | 363 }; |
| 350 | 364 |
| 351 } // namespace cc | 365 } // namespace cc |
| 352 | 366 |
| 353 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 367 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
| OLD | NEW |