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