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 "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
12 #include "cc/scheduler/scheduler_settings.h" | 13 #include "cc/scheduler/scheduler_settings.h" |
13 | 14 |
14 namespace cc { | 15 namespace cc { |
15 | 16 |
16 // The SchedulerStateMachine decides how to coordinate main thread activites | 17 // The SchedulerStateMachine decides how to coordinate main thread activites |
17 // like painting/running javascript with rendering and input activities on the | 18 // like painting/running javascript with rendering and input activities on the |
18 // impl thread. | 19 // impl thread. |
19 // | 20 // |
20 // The state machine tracks internal state but is also influenced by external | 21 // The state machine tracks internal state but is also influenced by external |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 void UpdateState(Action action); | 72 void UpdateState(Action action); |
72 | 73 |
73 // Indicates whether the main thread needs a begin frame callback in order to | 74 // Indicates whether the main thread needs a begin frame callback in order to |
74 // make progress. | 75 // make progress. |
75 bool BeginFrameNeededByImplThread() const; | 76 bool BeginFrameNeededByImplThread() const; |
76 | 77 |
77 // Indicates that the system has entered and left a BeginFrame callback. | 78 // Indicates that the system has entered and left a BeginFrame callback. |
78 // The scheduler will not draw more than once in a given BeginFrame | 79 // The scheduler will not draw more than once in a given BeginFrame |
79 // callback. | 80 // callback. |
80 void DidEnterBeginFrame(); | 81 void DidEnterBeginFrame(); |
| 82 void SetFrameTime(base::TimeTicks frame_time); |
81 void DidLeaveBeginFrame(); | 83 void DidLeaveBeginFrame(); |
| 84 bool inside_begin_frame() const { return inside_begin_frame_; } |
82 | 85 |
83 // Indicates whether the LayerTreeHostImpl is visible. | 86 // Indicates whether the LayerTreeHostImpl is visible. |
84 void SetVisible(bool visible); | 87 void SetVisible(bool visible); |
85 | 88 |
86 // 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 |
87 // or the screen being damaged and simply needing redisplay. | 90 // or the screen being damaged and simply needing redisplay. |
88 void SetNeedsRedraw(); | 91 void SetNeedsRedraw(); |
89 | 92 |
90 // As SetNeedsRedraw(), but ensures the draw will definitely happen even if | 93 // As SetNeedsRedraw(), but ensures the draw will definitely happen even if |
91 // we are not visible. | 94 // we are not visible. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 bool ShouldAttemptTreeActivation() const; | 164 bool ShouldAttemptTreeActivation() const; |
162 bool ShouldAcquireLayerTexturesForMainThread() const; | 165 bool ShouldAcquireLayerTexturesForMainThread() const; |
163 bool ShouldCheckForCompletedTileUploads() const; | 166 bool ShouldCheckForCompletedTileUploads() const; |
164 bool HasDrawnThisFrame() const; | 167 bool HasDrawnThisFrame() const; |
165 bool HasAttemptedTreeActivationThisFrame() const; | 168 bool HasAttemptedTreeActivationThisFrame() const; |
166 bool HasCheckedForCompletedTileUploadsThisFrame() const; | 169 bool HasCheckedForCompletedTileUploadsThisFrame() const; |
167 | 170 |
168 const SchedulerSettings settings_; | 171 const SchedulerSettings settings_; |
169 | 172 |
170 CommitState commit_state_; | 173 CommitState commit_state_; |
| 174 int commit_count_; |
171 | 175 |
172 int current_frame_number_; | 176 int current_frame_number_; |
173 int last_frame_number_where_draw_was_called_; | 177 int last_frame_number_where_draw_was_called_; |
174 int last_frame_number_where_tree_activation_attempted_; | 178 int last_frame_number_where_tree_activation_attempted_; |
175 int last_frame_number_where_check_for_completed_tile_uploads_called_; | 179 int last_frame_number_where_check_for_completed_tile_uploads_called_; |
176 int consecutive_failed_draws_; | 180 int consecutive_failed_draws_; |
177 int maximum_number_of_failed_draws_before_draw_is_forced_; | 181 int maximum_number_of_failed_draws_before_draw_is_forced_; |
178 bool needs_redraw_; | 182 bool needs_redraw_; |
179 bool swap_used_incomplete_tile_; | 183 bool swap_used_incomplete_tile_; |
180 bool needs_forced_redraw_; | 184 bool needs_forced_redraw_; |
181 bool needs_forced_redraw_after_next_commit_; | 185 bool needs_forced_redraw_after_next_commit_; |
182 bool needs_commit_; | 186 bool needs_commit_; |
183 bool needs_forced_commit_; | 187 bool needs_forced_commit_; |
184 bool expect_immediate_begin_frame_for_main_thread_; | 188 bool expect_immediate_begin_frame_for_main_thread_; |
185 bool main_thread_needs_layer_textures_; | 189 bool main_thread_needs_layer_textures_; |
186 bool inside_begin_frame_; | 190 bool inside_begin_frame_; |
| 191 base::TimeTicks last_frame_time_; |
187 bool visible_; | 192 bool visible_; |
188 bool can_start_; | 193 bool can_start_; |
189 bool can_draw_; | 194 bool can_draw_; |
190 bool has_pending_tree_; | 195 bool has_pending_tree_; |
191 bool draw_if_possible_failed_; | 196 bool draw_if_possible_failed_; |
192 TextureState texture_state_; | 197 TextureState texture_state_; |
193 OutputSurfaceState output_surface_state_; | 198 OutputSurfaceState output_surface_state_; |
194 bool did_create_and_initialize_first_output_surface_; | 199 bool did_create_and_initialize_first_output_surface_; |
195 | 200 |
| 201 private: |
196 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 202 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
197 }; | 203 }; |
198 | 204 |
199 } // namespace cc | 205 } // namespace cc |
200 | 206 |
201 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 207 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
OLD | NEW |