| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // This class exists to allow tests to override the frame source construction. | 58 // This class exists to allow tests to override the frame source construction. |
| 59 // A virtual method can't be used as this needs to happen in the constructor | 59 // A virtual method can't be used as this needs to happen in the constructor |
| 60 // (see C++ FAQ / Section 23 - http://goo.gl/fnrwom for why). | 60 // (see C++ FAQ / Section 23 - http://goo.gl/fnrwom for why). |
| 61 // This class exists solely long enough to construct the frame sources. | 61 // This class exists solely long enough to construct the frame sources. |
| 62 class CC_EXPORT SchedulerFrameSourcesConstructor { | 62 class CC_EXPORT SchedulerFrameSourcesConstructor { |
| 63 public: | 63 public: |
| 64 virtual ~SchedulerFrameSourcesConstructor() {} | 64 virtual ~SchedulerFrameSourcesConstructor() {} |
| 65 virtual BeginFrameSource* ConstructPrimaryFrameSource(Scheduler* scheduler); | 65 virtual BeginFrameSource* ConstructPrimaryFrameSource(Scheduler* scheduler); |
| 66 virtual BeginFrameSource* ConstructBackgroundFrameSource( | 66 virtual BeginFrameSource* ConstructBackgroundFrameSource( |
| 67 Scheduler* scheduler); | 67 Scheduler* scheduler); |
| 68 virtual BeginFrameSource* ConstructUnthrottledFrameSource( |
| 69 Scheduler* scheduler); |
| 68 | 70 |
| 69 protected: | 71 protected: |
| 70 SchedulerFrameSourcesConstructor() {} | 72 SchedulerFrameSourcesConstructor() {} |
| 71 | 73 |
| 72 friend class Scheduler; | 74 friend class Scheduler; |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 class CC_EXPORT Scheduler : public BeginFrameObserverMixIn, | 77 class CC_EXPORT Scheduler : public BeginFrameObserverMixIn, |
| 76 public base::PowerObserver { | 78 public base::PowerObserver { |
| 77 public: | 79 public: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 105 void CommitVSyncParameters(base::TimeTicks timebase, | 107 void CommitVSyncParameters(base::TimeTicks timebase, |
| 106 base::TimeDelta interval); | 108 base::TimeDelta interval); |
| 107 void SetEstimatedParentDrawTime(base::TimeDelta draw_time); | 109 void SetEstimatedParentDrawTime(base::TimeDelta draw_time); |
| 108 | 110 |
| 109 void SetCanStart(); | 111 void SetCanStart(); |
| 110 | 112 |
| 111 void SetVisible(bool visible); | 113 void SetVisible(bool visible); |
| 112 void SetCanDraw(bool can_draw); | 114 void SetCanDraw(bool can_draw); |
| 113 void NotifyReadyToActivate(); | 115 void NotifyReadyToActivate(); |
| 114 void NotifyReadyToDraw(); | 116 void NotifyReadyToDraw(); |
| 117 void SetThrottleFrameProduction(bool throttle); |
| 115 | 118 |
| 116 void SetNeedsCommit(); | 119 void SetNeedsCommit(); |
| 117 | 120 |
| 118 void SetNeedsRedraw(); | 121 void SetNeedsRedraw(); |
| 119 | 122 |
| 120 void SetNeedsAnimate(); | 123 void SetNeedsAnimate(); |
| 121 | 124 |
| 122 void SetNeedsPrepareTiles(); | 125 void SetNeedsPrepareTiles(); |
| 123 | 126 |
| 124 void SetMaxSwapsPending(int max); | 127 void SetMaxSwapsPending(int max); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 scoped_ptr<BeginFrameSource> external_begin_frame_source, | 180 scoped_ptr<BeginFrameSource> external_begin_frame_source, |
| 178 SchedulerFrameSourcesConstructor* frame_sources_constructor); | 181 SchedulerFrameSourcesConstructor* frame_sources_constructor); |
| 179 | 182 |
| 180 // virtual for testing - Don't call these in the constructor or | 183 // virtual for testing - Don't call these in the constructor or |
| 181 // destructor! | 184 // destructor! |
| 182 virtual base::TimeTicks Now() const; | 185 virtual base::TimeTicks Now() const; |
| 183 | 186 |
| 184 scoped_ptr<BeginFrameSourceMultiplexer> frame_source_; | 187 scoped_ptr<BeginFrameSourceMultiplexer> frame_source_; |
| 185 BeginFrameSource* primary_frame_source_; | 188 BeginFrameSource* primary_frame_source_; |
| 186 BeginFrameSource* background_frame_source_; | 189 BeginFrameSource* background_frame_source_; |
| 190 BeginFrameSource* unthrottled_frame_source_; |
| 187 | 191 |
| 188 // Storage when frame sources are internal | 192 // Storage when frame sources are internal |
| 189 scoped_ptr<BeginFrameSource> primary_frame_source_internal_; | 193 scoped_ptr<BeginFrameSource> primary_frame_source_internal_; |
| 190 scoped_ptr<SyntheticBeginFrameSource> background_frame_source_internal_; | 194 scoped_ptr<SyntheticBeginFrameSource> background_frame_source_internal_; |
| 195 scoped_ptr<BeginFrameSource> unthrottled_frame_source_internal_; |
| 191 | 196 |
| 192 VSyncParameterObserver* vsync_observer_; | 197 VSyncParameterObserver* vsync_observer_; |
| 198 bool throttle_frame_production_; |
| 193 | 199 |
| 194 const SchedulerSettings settings_; | 200 const SchedulerSettings settings_; |
| 195 SchedulerClient* client_; | 201 SchedulerClient* client_; |
| 196 int layer_tree_host_id_; | 202 int layer_tree_host_id_; |
| 197 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 203 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 198 | 204 |
| 199 base::PowerMonitor* power_monitor_; | 205 base::PowerMonitor* power_monitor_; |
| 200 | 206 |
| 201 base::TimeDelta estimated_parent_draw_time_; | 207 base::TimeDelta estimated_parent_draw_time_; |
| 202 | 208 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 229 bool CanCommitAndActivateBeforeDeadline() const; | 235 bool CanCommitAndActivateBeforeDeadline() const; |
| 230 void AdvanceCommitStateIfPossible(); | 236 void AdvanceCommitStateIfPossible(); |
| 231 bool IsBeginMainFrameSentOrStarted() const; | 237 bool IsBeginMainFrameSentOrStarted() const; |
| 232 void BeginRetroFrame(); | 238 void BeginRetroFrame(); |
| 233 void BeginImplFrame(const BeginFrameArgs& args); | 239 void BeginImplFrame(const BeginFrameArgs& args); |
| 234 void OnBeginImplFrameDeadline(); | 240 void OnBeginImplFrameDeadline(); |
| 235 void PollForAnticipatedDrawTriggers(); | 241 void PollForAnticipatedDrawTriggers(); |
| 236 void PollToAdvanceCommitState(); | 242 void PollToAdvanceCommitState(); |
| 237 void SetupPowerMonitoring(); | 243 void SetupPowerMonitoring(); |
| 238 void TeardownPowerMonitoring(); | 244 void TeardownPowerMonitoring(); |
| 245 void UpdateActiveFrameSource(); |
| 239 | 246 |
| 240 base::TimeDelta EstimatedParentDrawTime() { | 247 base::TimeDelta EstimatedParentDrawTime() { |
| 241 return estimated_parent_draw_time_; | 248 return estimated_parent_draw_time_; |
| 242 } | 249 } |
| 243 | 250 |
| 244 bool IsInsideAction(SchedulerStateMachine::Action action) { | 251 bool IsInsideAction(SchedulerStateMachine::Action action) { |
| 245 return inside_action_ == action; | 252 return inside_action_ == action; |
| 246 } | 253 } |
| 247 | 254 |
| 248 base::WeakPtrFactory<Scheduler> weak_factory_; | 255 base::WeakPtrFactory<Scheduler> weak_factory_; |
| 249 | 256 |
| 250 friend class SchedulerFrameSourcesConstructor; | 257 friend class SchedulerFrameSourcesConstructor; |
| 251 friend class TestSchedulerFrameSourcesConstructor; | 258 friend class TestSchedulerFrameSourcesConstructor; |
| 252 | 259 |
| 253 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 260 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
| 254 }; | 261 }; |
| 255 | 262 |
| 256 } // namespace cc | 263 } // namespace cc |
| 257 | 264 |
| 258 #endif // CC_SCHEDULER_SCHEDULER_H_ | 265 #endif // CC_SCHEDULER_SCHEDULER_H_ |
| OLD | NEW |