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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 Action NextAction() const; | 72 Action NextAction() const; |
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 BeginFrameNeededByImplThread() const; | 77 bool BeginFrameNeededByImplThread() const; |
77 | 78 |
78 // Indicates that the system has entered and left a BeginFrame callback. | 79 // Indicates that the system has entered and left a BeginFrame callback. |
79 // The scheduler will not draw more than once in a given BeginFrame | 80 // The scheduler will not draw more than once in a given BeginFrame |
80 // callback. | 81 // callback. |
81 void DidEnterBeginFrame(); | 82 void DidEnterBeginFrame(BeginFrameArgs args); |
82 void SetFrameTime(base::TimeTicks frame_time); | |
83 void DidLeaveBeginFrame(); | 83 void DidLeaveBeginFrame(); |
84 bool inside_begin_frame() const { return inside_begin_frame_; } | 84 bool inside_begin_frame() const { return inside_begin_frame_; } |
85 | 85 |
86 // Indicates whether the LayerTreeHostImpl is visible. | 86 // Indicates whether the LayerTreeHostImpl is visible. |
87 void SetVisible(bool visible); | 87 void SetVisible(bool visible); |
88 | 88 |
89 // Indicates that a redraw is required, either due to the impl tree changing | 89 // Indicates that a redraw is required, either due to the impl tree changing |
90 // or the screen being damaged and simply needing redisplay. | 90 // or the screen being damaged and simply needing redisplay. |
91 void SetNeedsRedraw(); | 91 void SetNeedsRedraw(); |
92 | 92 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 int maximum_number_of_failed_draws_before_draw_is_forced_; | 181 int maximum_number_of_failed_draws_before_draw_is_forced_; |
182 bool needs_redraw_; | 182 bool needs_redraw_; |
183 bool swap_used_incomplete_tile_; | 183 bool swap_used_incomplete_tile_; |
184 bool needs_forced_redraw_; | 184 bool needs_forced_redraw_; |
185 bool needs_forced_redraw_after_next_commit_; | 185 bool needs_forced_redraw_after_next_commit_; |
186 bool needs_commit_; | 186 bool needs_commit_; |
187 bool needs_forced_commit_; | 187 bool needs_forced_commit_; |
188 bool expect_immediate_begin_frame_for_main_thread_; | 188 bool expect_immediate_begin_frame_for_main_thread_; |
189 bool main_thread_needs_layer_textures_; | 189 bool main_thread_needs_layer_textures_; |
190 bool inside_begin_frame_; | 190 bool inside_begin_frame_; |
191 base::TimeTicks last_frame_time_; | 191 BeginFrameArgs last_begin_frame_args_; |
192 bool visible_; | 192 bool visible_; |
193 bool can_start_; | 193 bool can_start_; |
194 bool can_draw_; | 194 bool can_draw_; |
195 bool has_pending_tree_; | 195 bool has_pending_tree_; |
196 bool draw_if_possible_failed_; | 196 bool draw_if_possible_failed_; |
197 TextureState texture_state_; | 197 TextureState texture_state_; |
198 OutputSurfaceState output_surface_state_; | 198 OutputSurfaceState output_surface_state_; |
199 bool did_create_and_initialize_first_output_surface_; | 199 bool did_create_and_initialize_first_output_surface_; |
200 | 200 |
201 private: | 201 private: |
202 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 202 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
203 }; | 203 }; |
204 | 204 |
205 } // namespace cc | 205 } // namespace cc |
206 | 206 |
207 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 207 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
OLD | NEW |