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 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 class Scheduler; | 58 class Scheduler; |
59 // This class exists to allow tests to override the frame source construction. | 59 // This class exists to allow tests to override the frame source construction. |
60 // A virtual method can't be used as this needs to happen in the constructor | 60 // A virtual method can't be used as this needs to happen in the constructor |
61 // (see C++ FAQ / Section 23 - http://goo.gl/fnrwom for why). | 61 // (see C++ FAQ / Section 23 - http://goo.gl/fnrwom for why). |
62 // This class exists solely long enough to construct the frame sources. | 62 // This class exists solely long enough to construct the frame sources. |
63 class CC_EXPORT SchedulerFrameSourcesConstructor { | 63 class CC_EXPORT SchedulerFrameSourcesConstructor { |
64 public: | 64 public: |
65 virtual ~SchedulerFrameSourcesConstructor() {} | 65 virtual ~SchedulerFrameSourcesConstructor() {} |
66 virtual BeginFrameSource* ConstructPrimaryFrameSource(Scheduler* scheduler); | 66 virtual BeginFrameSource* ConstructPrimaryFrameSource(Scheduler* scheduler); |
67 virtual BeginFrameSource* ConstructBackgroundFrameSource( | |
68 Scheduler* scheduler); | |
69 virtual BeginFrameSource* ConstructUnthrottledFrameSource( | 67 virtual BeginFrameSource* ConstructUnthrottledFrameSource( |
70 Scheduler* scheduler); | 68 Scheduler* scheduler); |
71 | 69 |
72 protected: | 70 protected: |
73 SchedulerFrameSourcesConstructor() {} | 71 SchedulerFrameSourcesConstructor() {} |
74 | 72 |
75 friend class Scheduler; | 73 friend class Scheduler; |
76 }; | 74 }; |
77 | 75 |
78 class CC_EXPORT Scheduler : public BeginFrameObserverMixIn { | 76 class CC_EXPORT Scheduler : public BeginFrameObserverMixIn { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 179 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
182 scoped_ptr<BeginFrameSource> external_begin_frame_source, | 180 scoped_ptr<BeginFrameSource> external_begin_frame_source, |
183 SchedulerFrameSourcesConstructor* frame_sources_constructor); | 181 SchedulerFrameSourcesConstructor* frame_sources_constructor); |
184 | 182 |
185 // virtual for testing - Don't call these in the constructor or | 183 // virtual for testing - Don't call these in the constructor or |
186 // destructor! | 184 // destructor! |
187 virtual base::TimeTicks Now() const; | 185 virtual base::TimeTicks Now() const; |
188 | 186 |
189 scoped_ptr<BeginFrameSourceMultiplexer> frame_source_; | 187 scoped_ptr<BeginFrameSourceMultiplexer> frame_source_; |
190 BeginFrameSource* primary_frame_source_; | 188 BeginFrameSource* primary_frame_source_; |
191 BeginFrameSource* background_frame_source_; | |
192 BeginFrameSource* unthrottled_frame_source_; | 189 BeginFrameSource* unthrottled_frame_source_; |
193 | 190 |
194 // Storage when frame sources are internal | 191 // Storage when frame sources are internal |
195 scoped_ptr<BeginFrameSource> primary_frame_source_internal_; | 192 scoped_ptr<BeginFrameSource> primary_frame_source_internal_; |
196 scoped_ptr<SyntheticBeginFrameSource> background_frame_source_internal_; | |
197 scoped_ptr<BeginFrameSource> unthrottled_frame_source_internal_; | 193 scoped_ptr<BeginFrameSource> unthrottled_frame_source_internal_; |
198 | 194 |
199 VSyncParameterObserver* vsync_observer_; | 195 VSyncParameterObserver* vsync_observer_; |
200 base::TimeDelta authoritative_vsync_interval_; | 196 base::TimeDelta authoritative_vsync_interval_; |
201 base::TimeTicks last_vsync_timebase_; | 197 base::TimeTicks last_vsync_timebase_; |
202 | 198 |
203 bool throttle_frame_production_; | 199 bool throttle_frame_production_; |
204 | 200 |
205 const SchedulerSettings settings_; | 201 const SchedulerSettings settings_; |
206 SchedulerClient* client_; | 202 SchedulerClient* client_; |
(...skipping 29 matching lines...) Expand all Loading... |
236 bool CanCommitAndActivateBeforeDeadline() const; | 232 bool CanCommitAndActivateBeforeDeadline() const; |
237 void AdvanceCommitStateIfPossible(); | 233 void AdvanceCommitStateIfPossible(); |
238 bool IsBeginMainFrameSentOrStarted() const; | 234 bool IsBeginMainFrameSentOrStarted() const; |
239 void BeginRetroFrame(); | 235 void BeginRetroFrame(); |
240 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); | 236 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); |
241 void BeginImplFrameSynchronous(const BeginFrameArgs& args); | 237 void BeginImplFrameSynchronous(const BeginFrameArgs& args); |
242 void BeginImplFrame(const BeginFrameArgs& args); | 238 void BeginImplFrame(const BeginFrameArgs& args); |
243 void FinishImplFrame(); | 239 void FinishImplFrame(); |
244 void OnBeginImplFrameDeadline(); | 240 void OnBeginImplFrameDeadline(); |
245 void PollToAdvanceCommitState(); | 241 void PollToAdvanceCommitState(); |
246 void UpdateActiveFrameSource(); | |
247 | 242 |
248 base::TimeDelta EstimatedParentDrawTime() { | 243 base::TimeDelta EstimatedParentDrawTime() { |
249 return estimated_parent_draw_time_; | 244 return estimated_parent_draw_time_; |
250 } | 245 } |
251 | 246 |
252 bool IsInsideAction(SchedulerStateMachine::Action action) { | 247 bool IsInsideAction(SchedulerStateMachine::Action action) { |
253 return inside_action_ == action; | 248 return inside_action_ == action; |
254 } | 249 } |
255 | 250 |
256 base::WeakPtrFactory<Scheduler> weak_factory_; | 251 base::WeakPtrFactory<Scheduler> weak_factory_; |
257 | 252 |
258 friend class SchedulerFrameSourcesConstructor; | 253 friend class SchedulerFrameSourcesConstructor; |
259 friend class TestSchedulerFrameSourcesConstructor; | 254 friend class TestSchedulerFrameSourcesConstructor; |
260 | 255 |
261 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 256 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
262 }; | 257 }; |
263 | 258 |
264 } // namespace cc | 259 } // namespace cc |
265 | 260 |
266 #endif // CC_SCHEDULER_SCHEDULER_H_ | 261 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |