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_H_ | 5 #ifndef CC_SCHEDULER_SCHEDULER_H_ |
6 #define CC_SCHEDULER_SCHEDULER_H_ | 6 #define CC_SCHEDULER_SCHEDULER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 int layer_tree_host_id_; | 156 int layer_tree_host_id_; |
157 base::SingleThreadTaskRunner* task_runner_; | 157 base::SingleThreadTaskRunner* task_runner_; |
158 | 158 |
159 // Not owned. May be null. | 159 // Not owned. May be null. |
160 BeginFrameSource* begin_frame_source_; | 160 BeginFrameSource* begin_frame_source_; |
161 bool observing_begin_frame_source_; | 161 bool observing_begin_frame_source_; |
162 | 162 |
163 std::unique_ptr<CompositorTimingHistory> compositor_timing_history_; | 163 std::unique_ptr<CompositorTimingHistory> compositor_timing_history_; |
164 base::TimeDelta estimated_parent_draw_time_; | 164 base::TimeDelta estimated_parent_draw_time_; |
165 | 165 |
166 std::deque<BeginFrameArgs> begin_retro_frame_args_; | |
167 SchedulerStateMachine::BeginImplFrameDeadlineMode | 166 SchedulerStateMachine::BeginImplFrameDeadlineMode |
168 begin_impl_frame_deadline_mode_; | 167 begin_impl_frame_deadline_mode_; |
169 BeginFrameTracker begin_impl_frame_tracker_; | 168 BeginFrameTracker begin_impl_frame_tracker_; |
170 BeginFrameArgs begin_main_frame_args_; | 169 BeginFrameArgs begin_main_frame_args_; |
171 | 170 |
172 base::Closure begin_retro_frame_closure_; | |
173 base::Closure begin_impl_frame_deadline_closure_; | 171 base::Closure begin_impl_frame_deadline_closure_; |
174 base::CancelableClosure begin_retro_frame_task_; | |
175 base::CancelableClosure begin_impl_frame_deadline_task_; | 172 base::CancelableClosure begin_impl_frame_deadline_task_; |
| 173 base::CancelableClosure missed_begin_frame_task_; |
176 | 174 |
177 SchedulerStateMachine state_machine_; | 175 SchedulerStateMachine state_machine_; |
178 bool inside_process_scheduled_actions_; | 176 bool inside_process_scheduled_actions_; |
179 SchedulerStateMachine::Action inside_action_; | 177 SchedulerStateMachine::Action inside_action_; |
180 | 178 |
181 private: | 179 private: |
182 void ScheduleBeginImplFrameDeadline(); | 180 void ScheduleBeginImplFrameDeadline(); |
183 void ScheduleBeginImplFrameDeadlineIfNeeded(); | 181 void ScheduleBeginImplFrameDeadlineIfNeeded(); |
184 void BeginImplFrameNotExpectedSoon(); | 182 void BeginImplFrameNotExpectedSoon(); |
185 void SetupNextBeginFrameIfNeeded(); | 183 void SetupNextBeginFrameIfNeeded(); |
186 void PostBeginRetroFrameIfNeeded(); | |
187 void DrawAndSwapIfPossible(); | 184 void DrawAndSwapIfPossible(); |
188 void DrawAndSwapForced(); | 185 void DrawAndSwapForced(); |
189 void ProcessScheduledActions(); | 186 void ProcessScheduledActions(); |
190 void UpdateCompositorTimingHistoryRecordingEnabled(); | 187 void UpdateCompositorTimingHistoryRecordingEnabled(); |
191 bool ShouldRecoverMainLatency(const BeginFrameArgs& args, | 188 bool ShouldRecoverMainLatency(const BeginFrameArgs& args, |
192 bool can_activate_before_deadline) const; | 189 bool can_activate_before_deadline) const; |
193 bool ShouldRecoverImplLatency(const BeginFrameArgs& args, | 190 bool ShouldRecoverImplLatency(const BeginFrameArgs& args, |
194 bool can_activate_before_deadline) const; | 191 bool can_activate_before_deadline) const; |
195 bool CanBeginMainFrameAndActivateBeforeDeadline( | 192 bool CanBeginMainFrameAndActivateBeforeDeadline( |
196 const BeginFrameArgs& args, | 193 const BeginFrameArgs& args, |
197 base::TimeDelta bmf_to_activate_estimate) const; | 194 base::TimeDelta bmf_to_activate_estimate) const; |
198 void AdvanceCommitStateIfPossible(); | 195 void AdvanceCommitStateIfPossible(); |
199 bool IsBeginMainFrameSentOrStarted() const; | 196 bool IsBeginMainFrameSentOrStarted() const; |
200 void BeginRetroFrame(); | |
201 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); | 197 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); |
202 void BeginImplFrameSynchronous(const BeginFrameArgs& args); | 198 void BeginImplFrameSynchronous(const BeginFrameArgs& args); |
203 void BeginImplFrame(const BeginFrameArgs& args); | 199 void BeginImplFrame(const BeginFrameArgs& args); |
204 void FinishImplFrame(); | 200 void FinishImplFrame(); |
205 void OnBeginImplFrameDeadline(); | 201 void OnBeginImplFrameDeadline(); |
206 void PollToAdvanceCommitState(); | 202 void PollToAdvanceCommitState(); |
207 | 203 |
208 base::TimeDelta EstimatedParentDrawTime() { | 204 base::TimeDelta EstimatedParentDrawTime() { |
209 return estimated_parent_draw_time_; | 205 return estimated_parent_draw_time_; |
210 } | 206 } |
211 | 207 |
212 bool IsInsideAction(SchedulerStateMachine::Action action) { | 208 bool IsInsideAction(SchedulerStateMachine::Action action) { |
213 return inside_action_ == action; | 209 return inside_action_ == action; |
214 } | 210 } |
215 | 211 |
216 base::WeakPtrFactory<Scheduler> weak_factory_; | 212 base::WeakPtrFactory<Scheduler> weak_factory_; |
217 | 213 |
218 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 214 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
219 }; | 215 }; |
220 | 216 |
221 } // namespace cc | 217 } // namespace cc |
222 | 218 |
223 #endif // CC_SCHEDULER_SCHEDULER_H_ | 219 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |