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_; |
166 SchedulerStateMachine::BeginImplFrameDeadlineMode | 167 SchedulerStateMachine::BeginImplFrameDeadlineMode |
167 begin_impl_frame_deadline_mode_; | 168 begin_impl_frame_deadline_mode_; |
168 BeginFrameTracker begin_impl_frame_tracker_; | 169 BeginFrameTracker begin_impl_frame_tracker_; |
169 BeginFrameArgs begin_main_frame_args_; | 170 BeginFrameArgs begin_main_frame_args_; |
170 | 171 |
| 172 base::Closure begin_retro_frame_closure_; |
171 base::Closure begin_impl_frame_deadline_closure_; | 173 base::Closure begin_impl_frame_deadline_closure_; |
| 174 base::CancelableClosure begin_retro_frame_task_; |
172 base::CancelableClosure begin_impl_frame_deadline_task_; | 175 base::CancelableClosure begin_impl_frame_deadline_task_; |
173 base::CancelableClosure missed_begin_frame_task_; | |
174 | 176 |
175 SchedulerStateMachine state_machine_; | 177 SchedulerStateMachine state_machine_; |
176 bool inside_process_scheduled_actions_; | 178 bool inside_process_scheduled_actions_; |
177 SchedulerStateMachine::Action inside_action_; | 179 SchedulerStateMachine::Action inside_action_; |
178 | 180 |
179 private: | 181 private: |
180 void ScheduleBeginImplFrameDeadline(); | 182 void ScheduleBeginImplFrameDeadline(); |
181 void ScheduleBeginImplFrameDeadlineIfNeeded(); | 183 void ScheduleBeginImplFrameDeadlineIfNeeded(); |
182 void BeginImplFrameNotExpectedSoon(); | 184 void BeginImplFrameNotExpectedSoon(); |
183 void SetupNextBeginFrameIfNeeded(); | 185 void SetupNextBeginFrameIfNeeded(); |
| 186 void PostBeginRetroFrameIfNeeded(); |
184 void DrawAndSwapIfPossible(); | 187 void DrawAndSwapIfPossible(); |
185 void DrawAndSwapForced(); | 188 void DrawAndSwapForced(); |
186 void ProcessScheduledActions(); | 189 void ProcessScheduledActions(); |
187 void UpdateCompositorTimingHistoryRecordingEnabled(); | 190 void UpdateCompositorTimingHistoryRecordingEnabled(); |
188 bool ShouldRecoverMainLatency(const BeginFrameArgs& args, | 191 bool ShouldRecoverMainLatency(const BeginFrameArgs& args, |
189 bool can_activate_before_deadline) const; | 192 bool can_activate_before_deadline) const; |
190 bool ShouldRecoverImplLatency(const BeginFrameArgs& args, | 193 bool ShouldRecoverImplLatency(const BeginFrameArgs& args, |
191 bool can_activate_before_deadline) const; | 194 bool can_activate_before_deadline) const; |
192 bool CanBeginMainFrameAndActivateBeforeDeadline( | 195 bool CanBeginMainFrameAndActivateBeforeDeadline( |
193 const BeginFrameArgs& args, | 196 const BeginFrameArgs& args, |
194 base::TimeDelta bmf_to_activate_estimate) const; | 197 base::TimeDelta bmf_to_activate_estimate) const; |
195 void AdvanceCommitStateIfPossible(); | 198 void AdvanceCommitStateIfPossible(); |
196 bool IsBeginMainFrameSentOrStarted() const; | 199 bool IsBeginMainFrameSentOrStarted() const; |
| 200 void BeginRetroFrame(); |
197 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); | 201 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); |
198 void BeginImplFrameSynchronous(const BeginFrameArgs& args); | 202 void BeginImplFrameSynchronous(const BeginFrameArgs& args); |
199 void BeginImplFrame(const BeginFrameArgs& args); | 203 void BeginImplFrame(const BeginFrameArgs& args); |
200 void FinishImplFrame(); | 204 void FinishImplFrame(); |
201 void OnBeginImplFrameDeadline(); | 205 void OnBeginImplFrameDeadline(); |
202 void PollToAdvanceCommitState(); | 206 void PollToAdvanceCommitState(); |
203 | 207 |
204 base::TimeDelta EstimatedParentDrawTime() { | 208 base::TimeDelta EstimatedParentDrawTime() { |
205 return estimated_parent_draw_time_; | 209 return estimated_parent_draw_time_; |
206 } | 210 } |
207 | 211 |
208 bool IsInsideAction(SchedulerStateMachine::Action action) { | 212 bool IsInsideAction(SchedulerStateMachine::Action action) { |
209 return inside_action_ == action; | 213 return inside_action_ == action; |
210 } | 214 } |
211 | 215 |
212 base::WeakPtrFactory<Scheduler> weak_factory_; | 216 base::WeakPtrFactory<Scheduler> weak_factory_; |
213 | 217 |
214 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 218 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
215 }; | 219 }; |
216 | 220 |
217 } // namespace cc | 221 } // namespace cc |
218 | 222 |
219 #endif // CC_SCHEDULER_SCHEDULER_H_ | 223 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |