| 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 30 matching lines...) Expand all Loading... |
| 41 virtual void ScheduledActionAnimate() = 0; | 41 virtual void ScheduledActionAnimate() = 0; |
| 42 virtual void ScheduledActionCommit() = 0; | 42 virtual void ScheduledActionCommit() = 0; |
| 43 virtual void ScheduledActionActivateSyncTree() = 0; | 43 virtual void ScheduledActionActivateSyncTree() = 0; |
| 44 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; | 44 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; |
| 45 virtual void ScheduledActionManageTiles() = 0; | 45 virtual void ScheduledActionManageTiles() = 0; |
| 46 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; | 46 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; |
| 47 virtual base::TimeDelta DrawDurationEstimate() = 0; | 47 virtual base::TimeDelta DrawDurationEstimate() = 0; |
| 48 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() = 0; | 48 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() = 0; |
| 49 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0; | 49 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0; |
| 50 virtual void DidBeginImplFrameDeadline() = 0; | 50 virtual void DidBeginImplFrameDeadline() = 0; |
| 51 virtual void SendBeginFramesToChildren(const BeginFrameArgs& args) = 0; |
| 51 | 52 |
| 52 protected: | 53 protected: |
| 53 virtual ~SchedulerClient() {} | 54 virtual ~SchedulerClient() {} |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 class Scheduler; | 57 class Scheduler; |
| 57 // 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. |
| 58 // 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 |
| 59 // (see C++ FAQ / Section 23 - http://goo.gl/fnrwom for why). | 60 // (see C++ FAQ / Section 23 - http://goo.gl/fnrwom for why). |
| 60 // This class exists solely long enough to construct the frame sources. | 61 // This class exists solely long enough to construct the frame sources. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 86 scheduler_settings, | 87 scheduler_settings, |
| 87 layer_tree_host_id, | 88 layer_tree_host_id, |
| 88 task_runner, | 89 task_runner, |
| 89 power_monitor, | 90 power_monitor, |
| 90 external_begin_frame_source.Pass(), | 91 external_begin_frame_source.Pass(), |
| 91 &frame_sources_constructor)); | 92 &frame_sources_constructor)); |
| 92 } | 93 } |
| 93 | 94 |
| 94 ~Scheduler() override; | 95 ~Scheduler() override; |
| 95 | 96 |
| 97 // BeginFrameObserverMixin |
| 98 bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) override; |
| 99 |
| 96 // base::PowerObserver method. | 100 // base::PowerObserver method. |
| 97 void OnPowerStateChange(bool on_battery_power) override; | 101 void OnPowerStateChange(bool on_battery_power) override; |
| 98 | 102 |
| 99 const SchedulerSettings& settings() const { return settings_; } | 103 const SchedulerSettings& settings() const { return settings_; } |
| 100 | 104 |
| 101 void CommitVSyncParameters(base::TimeTicks timebase, | 105 void CommitVSyncParameters(base::TimeTicks timebase, |
| 102 base::TimeDelta interval); | 106 base::TimeDelta interval); |
| 103 void SetEstimatedParentDrawTime(base::TimeDelta draw_time); | 107 void SetEstimatedParentDrawTime(base::TimeDelta draw_time); |
| 104 | 108 |
| 105 void SetCanStart(); | 109 void SetCanStart(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 161 |
| 158 base::TimeTicks LastBeginImplFrameTime(); | 162 base::TimeTicks LastBeginImplFrameTime(); |
| 159 | 163 |
| 160 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; | 164 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; |
| 161 void AsValueInto(base::debug::TracedValue* value) const override; | 165 void AsValueInto(base::debug::TracedValue* value) const override; |
| 162 | 166 |
| 163 void SetContinuousPainting(bool continuous_painting) { | 167 void SetContinuousPainting(bool continuous_painting) { |
| 164 state_machine_.SetContinuousPainting(continuous_painting); | 168 state_machine_.SetContinuousPainting(continuous_painting); |
| 165 } | 169 } |
| 166 | 170 |
| 167 // BeginFrameObserverMixin | 171 void SetChildrenNeedBeginFrames(bool children_need_begin_frames); |
| 168 bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) override; | |
| 169 | 172 |
| 170 protected: | 173 protected: |
| 171 Scheduler(SchedulerClient* client, | 174 Scheduler(SchedulerClient* client, |
| 172 const SchedulerSettings& scheduler_settings, | 175 const SchedulerSettings& scheduler_settings, |
| 173 int layer_tree_host_id, | 176 int layer_tree_host_id, |
| 174 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 177 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 175 base::PowerMonitor* power_monitor, | 178 base::PowerMonitor* power_monitor, |
| 176 scoped_ptr<BeginFrameSource> external_begin_frame_source, | 179 scoped_ptr<BeginFrameSource> external_begin_frame_source, |
| 177 SchedulerFrameSourcesConstructor* frame_sources_constructor); | 180 SchedulerFrameSourcesConstructor* frame_sources_constructor); |
| 178 | 181 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 253 |
| 251 friend class SchedulerFrameSourcesConstructor; | 254 friend class SchedulerFrameSourcesConstructor; |
| 252 friend class TestSchedulerFrameSourcesConstructor; | 255 friend class TestSchedulerFrameSourcesConstructor; |
| 253 | 256 |
| 254 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 257 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
| 255 }; | 258 }; |
| 256 | 259 |
| 257 } // namespace cc | 260 } // namespace cc |
| 258 | 261 |
| 259 #endif // CC_SCHEDULER_SCHEDULER_H_ | 262 #endif // CC_SCHEDULER_SCHEDULER_H_ |
| OLD | NEW |