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