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