OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BEGIN_FRAME_SOURCE_H_ | 5 #ifndef CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ |
6 #define CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ | 6 #define CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 private: | 201 private: |
202 base::WeakPtrFactory<BackToBackBeginFrameSource> weak_factory_; | 202 base::WeakPtrFactory<BackToBackBeginFrameSource> weak_factory_; |
203 | 203 |
204 DISALLOW_COPY_AND_ASSIGN(BackToBackBeginFrameSource); | 204 DISALLOW_COPY_AND_ASSIGN(BackToBackBeginFrameSource); |
205 }; | 205 }; |
206 | 206 |
207 // A frame source which is locked to an external parameters provides from a | 207 // A frame source which is locked to an external parameters provides from a |
208 // vsync source and generates BeginFrameArgs for it. | 208 // vsync source and generates BeginFrameArgs for it. |
209 class CC_EXPORT SyntheticBeginFrameSource : public BeginFrameSourceBase, | 209 class CC_EXPORT SyntheticBeginFrameSource : public BeginFrameSourceBase, |
210 public TimeSourceClient { | 210 public DelayBasedTimeSourceClient { |
211 public: | 211 public: |
212 static scoped_ptr<SyntheticBeginFrameSource> Create( | 212 static scoped_ptr<SyntheticBeginFrameSource> Create( |
213 base::SingleThreadTaskRunner* task_runner, | 213 base::SingleThreadTaskRunner* task_runner, |
214 base::TimeDelta initial_vsync_interval); | 214 base::TimeDelta initial_vsync_interval); |
215 ~SyntheticBeginFrameSource() override; | 215 ~SyntheticBeginFrameSource() override; |
216 | 216 |
217 void OnUpdateVSyncParameters(base::TimeTicks new_vsync_timebase, | 217 void OnUpdateVSyncParameters(base::TimeTicks new_vsync_timebase, |
218 base::TimeDelta new_vsync_interval); | 218 base::TimeDelta new_vsync_interval); |
219 | 219 |
220 // Tracing | 220 // Tracing |
221 void AsValueInto(base::trace_event::TracedValue* dict) const override; | 221 void AsValueInto(base::trace_event::TracedValue* dict) const override; |
222 | 222 |
223 // TimeSourceClient | 223 // DelayBasedTimeSourceClient |
| 224 void OnMissedTick() override; |
224 void OnTimerTick() override; | 225 void OnTimerTick() override; |
225 | 226 |
226 protected: | 227 protected: |
227 explicit SyntheticBeginFrameSource( | 228 explicit SyntheticBeginFrameSource( |
| 229 base::SingleThreadTaskRunner* task_runner, |
228 scoped_ptr<DelayBasedTimeSource> time_source); | 230 scoped_ptr<DelayBasedTimeSource> time_source); |
229 | 231 |
230 BeginFrameArgs CreateBeginFrameArgs(base::TimeTicks frame_time, | 232 BeginFrameArgs CreateBeginFrameArgs(base::TimeTicks frame_time, |
231 BeginFrameArgs::BeginFrameArgsType type); | 233 BeginFrameArgs::BeginFrameArgsType type); |
232 | 234 |
233 // BeginFrameSourceBase | 235 // BeginFrameSourceBase |
234 void OnNeedsBeginFramesChange(bool needs_begin_frames) override; | 236 void OnNeedsBeginFramesChange(bool needs_begin_frames) override; |
235 | 237 |
| 238 base::SingleThreadTaskRunner* task_runner_; |
236 scoped_ptr<DelayBasedTimeSource> time_source_; | 239 scoped_ptr<DelayBasedTimeSource> time_source_; |
237 | 240 |
238 private: | 241 private: |
| 242 base::WeakPtrFactory<SyntheticBeginFrameSource> weak_factory_; |
| 243 |
239 DISALLOW_COPY_AND_ASSIGN(SyntheticBeginFrameSource); | 244 DISALLOW_COPY_AND_ASSIGN(SyntheticBeginFrameSource); |
240 }; | 245 }; |
241 | 246 |
242 // A "virtual" frame source which lets you switch between multiple other frame | 247 // A "virtual" frame source which lets you switch between multiple other frame |
243 // sources while making sure the BeginFrameArgs stays increasing (possibly | 248 // sources while making sure the BeginFrameArgs stays increasing (possibly |
244 // enforcing minimum boundry between BeginFrameArgs messages). | 249 // enforcing minimum boundry between BeginFrameArgs messages). |
245 class CC_EXPORT BeginFrameSourceMultiplexer : public BeginFrameSourceBase, | 250 class CC_EXPORT BeginFrameSourceMultiplexer : public BeginFrameSourceBase, |
246 public BeginFrameObserver { | 251 public BeginFrameObserver { |
247 public: | 252 public: |
248 static scoped_ptr<BeginFrameSourceMultiplexer> Create(); | 253 static scoped_ptr<BeginFrameSourceMultiplexer> Create(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 BeginFrameSource* active_source_; | 288 BeginFrameSource* active_source_; |
284 std::set<BeginFrameSource*> source_list_; | 289 std::set<BeginFrameSource*> source_list_; |
285 | 290 |
286 private: | 291 private: |
287 DISALLOW_COPY_AND_ASSIGN(BeginFrameSourceMultiplexer); | 292 DISALLOW_COPY_AND_ASSIGN(BeginFrameSourceMultiplexer); |
288 }; | 293 }; |
289 | 294 |
290 } // namespace cc | 295 } // namespace cc |
291 | 296 |
292 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ | 297 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ |
OLD | NEW |