Chromium Code Reviews| 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 28 matching lines...) Expand all Loading... | |
| 39 virtual void ScheduledActionCommit() = 0; | 39 virtual void ScheduledActionCommit() = 0; |
| 40 virtual void ScheduledActionUpdateVisibleTiles() = 0; | 40 virtual void ScheduledActionUpdateVisibleTiles() = 0; |
| 41 virtual void ScheduledActionActivateSyncTree() = 0; | 41 virtual void ScheduledActionActivateSyncTree() = 0; |
| 42 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; | 42 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; |
| 43 virtual void ScheduledActionManageTiles() = 0; | 43 virtual void ScheduledActionManageTiles() = 0; |
| 44 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; | 44 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; |
| 45 virtual base::TimeDelta DrawDurationEstimate() = 0; | 45 virtual base::TimeDelta DrawDurationEstimate() = 0; |
| 46 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() = 0; | 46 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() = 0; |
| 47 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0; | 47 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0; |
| 48 virtual void DidBeginImplFrameDeadline() = 0; | 48 virtual void DidBeginImplFrameDeadline() = 0; |
| 49 virtual void SendBeginFrameToChildren(const BeginFrameArgs& args) = 0; | |
| 49 | 50 |
| 50 protected: | 51 protected: |
| 51 virtual ~SchedulerClient() {} | 52 virtual ~SchedulerClient() {} |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 class CC_EXPORT Scheduler { | 55 class CC_EXPORT Scheduler { |
| 55 public: | 56 public: |
| 56 static scoped_ptr<Scheduler> Create( | 57 static scoped_ptr<Scheduler> Create( |
| 57 SchedulerClient* client, | 58 SchedulerClient* client, |
| 58 const SchedulerSettings& scheduler_settings, | 59 const SchedulerSettings& scheduler_settings, |
| 59 int layer_tree_host_id, | 60 int layer_tree_host_id, |
| 60 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { | 61 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { |
| 61 return make_scoped_ptr(new Scheduler( | 62 return make_scoped_ptr(new Scheduler(client, |
| 62 client, scheduler_settings, layer_tree_host_id, task_runner)); | 63 scheduler_settings, |
| 64 layer_tree_host_id, | |
| 65 task_runner)); | |
| 63 } | 66 } |
| 64 | 67 |
| 65 virtual ~Scheduler(); | 68 virtual ~Scheduler(); |
| 66 | 69 |
| 67 const SchedulerSettings& settings() const { return settings_; } | 70 const SchedulerSettings& settings() const { return settings_; } |
| 68 | 71 |
| 69 void CommitVSyncParameters(base::TimeTicks timebase, | 72 void CommitVSyncParameters(base::TimeTicks timebase, |
| 70 base::TimeDelta interval); | 73 base::TimeDelta interval); |
| 71 void SetEstimatedParentDrawTime(base::TimeDelta draw_time); | 74 void SetEstimatedParentDrawTime(base::TimeDelta draw_time); |
| 72 | 75 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 | 139 |
| 137 bool IsInsideAction(SchedulerStateMachine::Action action) { | 140 bool IsInsideAction(SchedulerStateMachine::Action action) { |
| 138 return inside_action_ == action; | 141 return inside_action_ == action; |
| 139 } | 142 } |
| 140 | 143 |
| 141 bool IsBeginMainFrameSent() const; | 144 bool IsBeginMainFrameSent() const; |
| 142 void SetContinuousPainting(bool continuous_painting) { | 145 void SetContinuousPainting(bool continuous_painting) { |
| 143 state_machine_.SetContinuousPainting(continuous_painting); | 146 state_machine_.SetContinuousPainting(continuous_painting); |
| 144 } | 147 } |
| 145 | 148 |
| 149 // SetChildrenNeedBeginFrames() is only used when this Scheduler is acting | |
| 150 // as the publisher. | |
| 151 void SetChildrenNeedBeginFrames(bool need_begin_frame); | |
| 152 void SetAuthoritativeVSyncInterval(base::TimeDelta interval); | |
| 153 | |
| 146 protected: | 154 protected: |
| 147 class CC_EXPORT SyntheticBeginFrameSource : public TimeSourceClient { | 155 class CC_EXPORT SyntheticBeginFrameSource : public TimeSourceClient { |
| 148 public: | 156 public: |
| 149 SyntheticBeginFrameSource(Scheduler* scheduler, | 157 SyntheticBeginFrameSource(Scheduler* scheduler, |
| 150 base::SingleThreadTaskRunner* task_runner); | 158 base::SingleThreadTaskRunner* task_runner); |
| 151 virtual ~SyntheticBeginFrameSource(); | 159 virtual ~SyntheticBeginFrameSource(); |
| 152 | 160 |
| 153 // Updates the phase and frequency of the timer. | 161 // Updates the phase and frequency of the timer. |
| 154 void CommitVSyncParameters(base::TimeTicks timebase, | 162 void CommitVSyncParameters(base::TimeTicks timebase, |
| 155 base::TimeDelta interval); | 163 base::TimeDelta interval); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 177 const SchedulerSettings& scheduler_settings, | 185 const SchedulerSettings& scheduler_settings, |
| 178 int layer_tree_host_id, | 186 int layer_tree_host_id, |
| 179 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 187 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
| 180 | 188 |
| 181 const SchedulerSettings settings_; | 189 const SchedulerSettings settings_; |
| 182 SchedulerClient* client_; | 190 SchedulerClient* client_; |
| 183 int layer_tree_host_id_; | 191 int layer_tree_host_id_; |
| 184 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 192 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 185 | 193 |
| 186 base::TimeDelta vsync_interval_; | 194 base::TimeDelta vsync_interval_; |
| 195 base::TimeDelta authoritative_vsync_interval_; | |
|
mithro-old
2014/09/09 03:22:37
What is the difference between "authoritative_vsyn
| |
| 196 base::TimeTicks last_timebase_; | |
| 197 | |
| 187 base::TimeDelta estimated_parent_draw_time_; | 198 base::TimeDelta estimated_parent_draw_time_; |
| 188 | 199 |
| 189 bool last_set_needs_begin_frame_; | 200 bool last_set_needs_begin_frame_; |
| 190 bool begin_unthrottled_frame_posted_; | 201 bool begin_unthrottled_frame_posted_; |
| 191 bool begin_retro_frame_posted_; | 202 bool begin_retro_frame_posted_; |
| 192 std::deque<BeginFrameArgs> begin_retro_frame_args_; | 203 std::deque<BeginFrameArgs> begin_retro_frame_args_; |
| 193 BeginFrameArgs begin_impl_frame_args_; | 204 BeginFrameArgs begin_impl_frame_args_; |
| 194 | 205 |
| 195 scoped_ptr<SyntheticBeginFrameSource> synthetic_begin_frame_source_; | 206 scoped_ptr<SyntheticBeginFrameSource> synthetic_begin_frame_source_; |
| 196 | 207 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 226 void SetupSyntheticBeginFrames(); | 237 void SetupSyntheticBeginFrames(); |
| 227 | 238 |
| 228 base::WeakPtrFactory<Scheduler> weak_factory_; | 239 base::WeakPtrFactory<Scheduler> weak_factory_; |
| 229 | 240 |
| 230 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 241 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
| 231 }; | 242 }; |
| 232 | 243 |
| 233 } // namespace cc | 244 } // namespace cc |
| 234 | 245 |
| 235 #endif // CC_SCHEDULER_SCHEDULER_H_ | 246 #endif // CC_SCHEDULER_SCHEDULER_H_ |
| OLD | NEW |