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 <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "cc/base/cc_export.h" | 15 #include "cc/base/cc_export.h" |
16 #include "cc/output/begin_frame_args.h" | 16 #include "cc/output/begin_frame_args.h" |
17 #include "cc/output/vsync_parameter_observer.h" | 17 #include "cc/output/vsync_parameter_observer.h" |
18 #include "cc/scheduler/begin_frame_source.h" | 18 #include "cc/scheduler/begin_frame_source.h" |
19 #include "cc/scheduler/begin_frame_tracker.h" | |
20 #include "cc/scheduler/delay_based_time_source.h" | 19 #include "cc/scheduler/delay_based_time_source.h" |
21 #include "cc/scheduler/draw_result.h" | 20 #include "cc/scheduler/draw_result.h" |
22 #include "cc/scheduler/scheduler_settings.h" | 21 #include "cc/scheduler/scheduler_settings.h" |
23 #include "cc/scheduler/scheduler_state_machine.h" | 22 #include "cc/scheduler/scheduler_state_machine.h" |
24 | 23 |
25 namespace base { | 24 namespace base { |
26 namespace trace_event { | 25 namespace trace_event { |
27 class ConvertableToTraceFormat; | 26 class ConvertableToTraceFormat; |
28 } | 27 } |
29 class SingleThreadTaskRunner; | 28 class SingleThreadTaskRunner; |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 bool throttle_frame_production_; | 199 bool throttle_frame_production_; |
201 | 200 |
202 const SchedulerSettings settings_; | 201 const SchedulerSettings settings_; |
203 SchedulerClient* client_; | 202 SchedulerClient* client_; |
204 int layer_tree_host_id_; | 203 int layer_tree_host_id_; |
205 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 204 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
206 | 205 |
207 base::TimeDelta estimated_parent_draw_time_; | 206 base::TimeDelta estimated_parent_draw_time_; |
208 | 207 |
209 std::deque<BeginFrameArgs> begin_retro_frame_args_; | 208 std::deque<BeginFrameArgs> begin_retro_frame_args_; |
| 209 BeginFrameArgs begin_impl_frame_args_; |
210 SchedulerStateMachine::BeginImplFrameDeadlineMode | 210 SchedulerStateMachine::BeginImplFrameDeadlineMode |
211 begin_impl_frame_deadline_mode_; | 211 begin_impl_frame_deadline_mode_; |
212 BeginFrameTracker begin_impl_frame_tracker_; | |
213 | 212 |
214 base::Closure begin_retro_frame_closure_; | 213 base::Closure begin_retro_frame_closure_; |
215 base::Closure begin_impl_frame_deadline_closure_; | 214 base::Closure begin_impl_frame_deadline_closure_; |
216 base::Closure advance_commit_state_closure_; | 215 base::Closure advance_commit_state_closure_; |
217 base::CancelableClosure begin_retro_frame_task_; | 216 base::CancelableClosure begin_retro_frame_task_; |
218 base::CancelableClosure begin_impl_frame_deadline_task_; | 217 base::CancelableClosure begin_impl_frame_deadline_task_; |
219 base::CancelableClosure advance_commit_state_task_; | 218 base::CancelableClosure advance_commit_state_task_; |
220 | 219 |
221 SchedulerStateMachine state_machine_; | 220 SchedulerStateMachine state_machine_; |
222 bool inside_process_scheduled_actions_; | 221 bool inside_process_scheduled_actions_; |
223 SchedulerStateMachine::Action inside_action_; | 222 SchedulerStateMachine::Action inside_action_; |
224 | 223 |
225 private: | 224 private: |
226 void ScheduleBeginImplFrameDeadline(); | 225 void ScheduleBeginImplFrameDeadline(); |
227 void ScheduleBeginImplFrameDeadlineIfNeeded(); | 226 void ScheduleBeginImplFrameDeadlineIfNeeded(); |
228 void SetupNextBeginFrameIfNeeded(); | 227 void SetupNextBeginFrameIfNeeded(); |
229 void PostBeginRetroFrameIfNeeded(); | 228 void PostBeginRetroFrameIfNeeded(); |
230 void SetupPollingMechanisms(); | 229 void SetupPollingMechanisms(); |
231 void DrawAndSwapIfPossible(); | 230 void DrawAndSwapIfPossible(); |
232 void ProcessScheduledActions(); | 231 void ProcessScheduledActions(); |
233 bool CanCommitAndActivateBeforeDeadline() const; | 232 bool CanCommitAndActivateBeforeDeadline() const; |
234 void AdvanceCommitStateIfPossible(); | 233 void AdvanceCommitStateIfPossible(); |
235 bool IsBeginMainFrameSentOrStarted() const; | 234 bool IsBeginMainFrameSentOrStarted() const; |
236 void BeginRetroFrame(); | 235 void BeginRetroFrame(); |
237 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); | 236 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); |
238 void BeginImplFrameSynchronous(const BeginFrameArgs& args); | 237 void BeginImplFrameSynchronous(const BeginFrameArgs& args); |
239 void BeginImplFrame(const BeginFrameArgs& args); | 238 void BeginImplFrame(); |
240 void FinishImplFrame(); | 239 void FinishImplFrame(); |
241 void OnBeginImplFrameDeadline(); | 240 void OnBeginImplFrameDeadline(); |
242 void PollToAdvanceCommitState(); | 241 void PollToAdvanceCommitState(); |
243 | 242 |
244 base::TimeDelta EstimatedParentDrawTime() { | 243 base::TimeDelta EstimatedParentDrawTime() { |
245 return estimated_parent_draw_time_; | 244 return estimated_parent_draw_time_; |
246 } | 245 } |
247 | 246 |
248 bool IsInsideAction(SchedulerStateMachine::Action action) { | 247 bool IsInsideAction(SchedulerStateMachine::Action action) { |
249 return inside_action_ == action; | 248 return inside_action_ == action; |
250 } | 249 } |
251 | 250 |
252 base::WeakPtrFactory<Scheduler> weak_factory_; | 251 base::WeakPtrFactory<Scheduler> weak_factory_; |
253 | 252 |
254 friend class SchedulerFrameSourcesConstructor; | 253 friend class SchedulerFrameSourcesConstructor; |
255 friend class TestSchedulerFrameSourcesConstructor; | 254 friend class TestSchedulerFrameSourcesConstructor; |
256 | 255 |
257 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 256 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
258 }; | 257 }; |
259 | 258 |
260 } // namespace cc | 259 } // namespace cc |
261 | 260 |
262 #endif // CC_SCHEDULER_SCHEDULER_H_ | 261 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |