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, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 128 |
128 void BeginFrame(const BeginFrameArgs& args); | 129 void BeginFrame(const BeginFrameArgs& args); |
129 | 130 |
130 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; | 131 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; |
131 void AsValueInto(base::debug::TracedValue* state) const; | 132 void AsValueInto(base::debug::TracedValue* state) const; |
132 | 133 |
133 void SetContinuousPainting(bool continuous_painting) { | 134 void SetContinuousPainting(bool continuous_painting) { |
134 state_machine_.SetContinuousPainting(continuous_painting); | 135 state_machine_.SetContinuousPainting(continuous_painting); |
135 } | 136 } |
136 | 137 |
| 138 // SetChildrenNeedBeginFrames() is only used when this Scheduler is acting |
| 139 // as the publisher. |
| 140 void SetChildrenNeedBeginFrames(bool need_begin_frame); |
| 141 void SetAuthoritativeVSyncInterval(base::TimeDelta interval); |
| 142 |
137 protected: | 143 protected: |
138 class CC_EXPORT SyntheticBeginFrameSource : public TimeSourceClient { | 144 class CC_EXPORT SyntheticBeginFrameSource : public TimeSourceClient { |
139 public: | 145 public: |
140 SyntheticBeginFrameSource(Scheduler* scheduler, | 146 SyntheticBeginFrameSource(Scheduler* scheduler, |
141 scoped_refptr<DelayBasedTimeSource> time_source); | 147 scoped_refptr<DelayBasedTimeSource> time_source); |
142 virtual ~SyntheticBeginFrameSource(); | 148 virtual ~SyntheticBeginFrameSource(); |
143 | 149 |
144 // Updates the phase and frequency of the timer. | 150 // Updates the phase and frequency of the timer. |
145 void CommitVSyncParameters(base::TimeTicks timebase, | 151 void CommitVSyncParameters(base::TimeTicks timebase, |
146 base::TimeDelta interval); | 152 base::TimeDelta interval); |
(...skipping 23 matching lines...) Expand all Loading... |
170 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 176 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
171 | 177 |
172 virtual base::TimeTicks Now() const; | 178 virtual base::TimeTicks Now() const; |
173 | 179 |
174 const SchedulerSettings settings_; | 180 const SchedulerSettings settings_; |
175 SchedulerClient* client_; | 181 SchedulerClient* client_; |
176 int layer_tree_host_id_; | 182 int layer_tree_host_id_; |
177 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 183 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
178 | 184 |
179 base::TimeDelta vsync_interval_; | 185 base::TimeDelta vsync_interval_; |
| 186 base::TimeDelta authoritative_vsync_interval_; |
| 187 base::TimeTicks last_timebase_; |
| 188 |
180 base::TimeDelta estimated_parent_draw_time_; | 189 base::TimeDelta estimated_parent_draw_time_; |
181 | 190 |
182 bool last_set_needs_begin_frame_; | 191 bool last_set_needs_begin_frame_; |
183 bool begin_unthrottled_frame_posted_; | 192 bool begin_unthrottled_frame_posted_; |
184 bool begin_retro_frame_posted_; | 193 bool begin_retro_frame_posted_; |
185 std::deque<BeginFrameArgs> begin_retro_frame_args_; | 194 std::deque<BeginFrameArgs> begin_retro_frame_args_; |
186 BeginFrameArgs begin_impl_frame_args_; | 195 BeginFrameArgs begin_impl_frame_args_; |
187 | 196 |
188 scoped_ptr<SyntheticBeginFrameSource> synthetic_begin_frame_source_; | 197 scoped_ptr<SyntheticBeginFrameSource> synthetic_begin_frame_source_; |
189 | 198 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 } | 244 } |
236 | 245 |
237 base::WeakPtrFactory<Scheduler> weak_factory_; | 246 base::WeakPtrFactory<Scheduler> weak_factory_; |
238 | 247 |
239 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 248 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
240 }; | 249 }; |
241 | 250 |
242 } // namespace cc | 251 } // namespace cc |
243 | 252 |
244 #endif // CC_SCHEDULER_SCHEDULER_H_ | 253 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |