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/time.h" | 11 #include "base/time.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/scheduler/scheduler_settings.h" | 14 #include "cc/scheduler/scheduler_settings.h" |
14 | 15 |
15 namespace cc { | 16 namespace cc { |
16 | 17 |
17 // The SchedulerStateMachine decides how to coordinate main thread activites | 18 // The SchedulerStateMachine decides how to coordinate main thread activites |
18 // like painting/running javascript with rendering and input activities on the | 19 // like painting/running javascript with rendering and input activities on the |
19 // impl thread. | 20 // impl thread. |
20 // | 21 // |
21 // The state machine tracks internal state but is also influenced by external | 22 // The state machine tracks internal state but is also influenced by external |
22 // state. Internal state includes things like whether a frame has been | 23 // state. Internal state includes things like whether a frame has been |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 void UpdateState(Action action); | 73 void UpdateState(Action action); |
73 | 74 |
74 // Indicates whether the main thread needs a begin frame callback in order to | 75 // Indicates whether the main thread needs a begin frame callback in order to |
75 // make progress. | 76 // make progress. |
76 bool BeginFrameNeededToDrawByImplThread() const; | 77 bool BeginFrameNeededToDrawByImplThread() const; |
77 bool ProactiveBeginFrameWantedByImplThread() const; | 78 bool ProactiveBeginFrameWantedByImplThread() const; |
78 | 79 |
79 // Indicates that the system has entered and left a BeginFrame callback. | 80 // Indicates that the system has entered and left a BeginFrame callback. |
80 // The scheduler will not draw more than once in a given BeginFrame | 81 // The scheduler will not draw more than once in a given BeginFrame |
81 // callback. | 82 // callback. |
82 void DidEnterBeginFrame(); | 83 void DidEnterBeginFrame(const BeginFrameArgs& args); |
83 void SetFrameTime(base::TimeTicks frame_time); | |
84 void DidLeaveBeginFrame(); | 84 void DidLeaveBeginFrame(); |
85 bool inside_begin_frame() const { return inside_begin_frame_; } | 85 bool inside_begin_frame() const { return inside_begin_frame_; } |
86 | 86 |
87 // Indicates whether the LayerTreeHostImpl is visible. | 87 // Indicates whether the LayerTreeHostImpl is visible. |
88 void SetVisible(bool visible); | 88 void SetVisible(bool visible); |
89 | 89 |
90 // Indicates that a redraw is required, either due to the impl tree changing | 90 // Indicates that a redraw is required, either due to the impl tree changing |
91 // or the screen being damaged and simply needing redisplay. | 91 // or the screen being damaged and simply needing redisplay. |
92 void SetNeedsRedraw(); | 92 void SetNeedsRedraw(); |
93 | 93 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 int maximum_number_of_failed_draws_before_draw_is_forced_; | 182 int maximum_number_of_failed_draws_before_draw_is_forced_; |
183 bool needs_redraw_; | 183 bool needs_redraw_; |
184 bool swap_used_incomplete_tile_; | 184 bool swap_used_incomplete_tile_; |
185 bool needs_forced_redraw_; | 185 bool needs_forced_redraw_; |
186 bool needs_forced_redraw_after_next_commit_; | 186 bool needs_forced_redraw_after_next_commit_; |
187 bool needs_commit_; | 187 bool needs_commit_; |
188 bool needs_forced_commit_; | 188 bool needs_forced_commit_; |
189 bool expect_immediate_begin_frame_for_main_thread_; | 189 bool expect_immediate_begin_frame_for_main_thread_; |
190 bool main_thread_needs_layer_textures_; | 190 bool main_thread_needs_layer_textures_; |
191 bool inside_begin_frame_; | 191 bool inside_begin_frame_; |
192 base::TimeTicks last_frame_time_; | 192 BeginFrameArgs last_begin_frame_args_; |
193 bool visible_; | 193 bool visible_; |
194 bool can_start_; | 194 bool can_start_; |
195 bool can_draw_; | 195 bool can_draw_; |
196 bool has_pending_tree_; | 196 bool has_pending_tree_; |
197 bool draw_if_possible_failed_; | 197 bool draw_if_possible_failed_; |
198 TextureState texture_state_; | 198 TextureState texture_state_; |
199 OutputSurfaceState output_surface_state_; | 199 OutputSurfaceState output_surface_state_; |
200 bool did_create_and_initialize_first_output_surface_; | 200 bool did_create_and_initialize_first_output_surface_; |
201 | 201 |
202 private: | 202 private: |
203 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 203 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
204 }; | 204 }; |
205 | 205 |
206 } // namespace cc | 206 } // namespace cc |
207 | 207 |
208 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 208 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
OLD | NEW |