| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 177 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 180 scoped_ptr<BeginFrameSource> external_begin_frame_source, | 178 scoped_ptr<BeginFrameSource> external_begin_frame_source, |
| 181 SchedulerFrameSourcesConstructor* frame_sources_constructor); | 179 SchedulerFrameSourcesConstructor* frame_sources_constructor); |
| 182 | 180 |
| 183 // virtual for testing - Don't call these in the constructor or | 181 // virtual for testing - Don't call these in the constructor or |
| 184 // destructor! | 182 // destructor! |
| 185 virtual base::TimeTicks Now() const; | 183 virtual base::TimeTicks Now() const; |
| 186 | 184 |
| 187 scoped_ptr<BeginFrameSourceMultiplexer> frame_source_; | 185 scoped_ptr<BeginFrameSourceMultiplexer> frame_source_; |
| 188 BeginFrameSource* primary_frame_source_; | 186 BeginFrameSource* primary_frame_source_; |
| 189 BeginFrameSource* background_frame_source_; | |
| 190 BeginFrameSource* unthrottled_frame_source_; | 187 BeginFrameSource* unthrottled_frame_source_; |
| 191 | 188 |
| 192 // Storage when frame sources are internal | 189 // Storage when frame sources are internal |
| 193 scoped_ptr<BeginFrameSource> primary_frame_source_internal_; | 190 scoped_ptr<BeginFrameSource> primary_frame_source_internal_; |
| 194 scoped_ptr<SyntheticBeginFrameSource> background_frame_source_internal_; | |
| 195 scoped_ptr<BeginFrameSource> unthrottled_frame_source_internal_; | 191 scoped_ptr<BeginFrameSource> unthrottled_frame_source_internal_; |
| 196 | 192 |
| 197 VSyncParameterObserver* vsync_observer_; | 193 VSyncParameterObserver* vsync_observer_; |
| 198 base::TimeDelta authoritative_vsync_interval_; | 194 base::TimeDelta authoritative_vsync_interval_; |
| 199 base::TimeTicks last_vsync_timebase_; | 195 base::TimeTicks last_vsync_timebase_; |
| 200 | 196 |
| 201 bool throttle_frame_production_; | 197 bool throttle_frame_production_; |
| 202 | 198 |
| 203 const SchedulerSettings settings_; | 199 const SchedulerSettings settings_; |
| 204 SchedulerClient* client_; | 200 SchedulerClient* client_; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 234 bool CanCommitAndActivateBeforeDeadline() const; | 230 bool CanCommitAndActivateBeforeDeadline() const; |
| 235 void AdvanceCommitStateIfPossible(); | 231 void AdvanceCommitStateIfPossible(); |
| 236 bool IsBeginMainFrameSentOrStarted() const; | 232 bool IsBeginMainFrameSentOrStarted() const; |
| 237 void BeginRetroFrame(); | 233 void BeginRetroFrame(); |
| 238 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); | 234 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); |
| 239 void BeginImplFrameSynchronous(const BeginFrameArgs& args); | 235 void BeginImplFrameSynchronous(const BeginFrameArgs& args); |
| 240 void BeginImplFrame(const BeginFrameArgs& args); | 236 void BeginImplFrame(const BeginFrameArgs& args); |
| 241 void FinishImplFrame(); | 237 void FinishImplFrame(); |
| 242 void OnBeginImplFrameDeadline(); | 238 void OnBeginImplFrameDeadline(); |
| 243 void PollToAdvanceCommitState(); | 239 void PollToAdvanceCommitState(); |
| 244 void UpdateActiveFrameSource(); | |
| 245 | 240 |
| 246 base::TimeDelta EstimatedParentDrawTime() { | 241 base::TimeDelta EstimatedParentDrawTime() { |
| 247 return estimated_parent_draw_time_; | 242 return estimated_parent_draw_time_; |
| 248 } | 243 } |
| 249 | 244 |
| 250 bool IsInsideAction(SchedulerStateMachine::Action action) { | 245 bool IsInsideAction(SchedulerStateMachine::Action action) { |
| 251 return inside_action_ == action; | 246 return inside_action_ == action; |
| 252 } | 247 } |
| 253 | 248 |
| 254 base::WeakPtrFactory<Scheduler> weak_factory_; | 249 base::WeakPtrFactory<Scheduler> weak_factory_; |
| 255 | 250 |
| 256 friend class SchedulerFrameSourcesConstructor; | 251 friend class SchedulerFrameSourcesConstructor; |
| 257 friend class TestSchedulerFrameSourcesConstructor; | 252 friend class TestSchedulerFrameSourcesConstructor; |
| 258 | 253 |
| 259 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 254 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
| 260 }; | 255 }; |
| 261 | 256 |
| 262 } // namespace cc | 257 } // namespace cc |
| 263 | 258 |
| 264 #endif // CC_SCHEDULER_SCHEDULER_H_ | 259 #endif // CC_SCHEDULER_SCHEDULER_H_ |
| OLD | NEW |