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 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
13 #include "cc/output/begin_frame_args.h" | 13 #include "cc/output/begin_frame_args.h" |
14 #include "cc/output/vsync_parameter_observer.h" | |
15 #include "cc/scheduler/delay_based_time_source.h" | 14 #include "cc/scheduler/delay_based_time_source.h" |
16 | 15 |
17 namespace cc { | 16 namespace cc { |
18 | 17 |
19 // (Pure) Interface for observing BeginFrame messages from BeginFrameSource | 18 // (Pure) Interface for observing BeginFrame messages from BeginFrameSource |
20 // objects. | 19 // objects. |
21 class CC_EXPORT BeginFrameObserver { | 20 class CC_EXPORT BeginFrameObserver { |
22 public: | 21 public: |
23 virtual ~BeginFrameObserver() {} | 22 virtual ~BeginFrameObserver() {} |
24 | 23 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 193 |
195 void BeginFrame(); | 194 void BeginFrame(); |
196 | 195 |
197 private: | 196 private: |
198 base::WeakPtrFactory<BackToBackBeginFrameSource> weak_factory_; | 197 base::WeakPtrFactory<BackToBackBeginFrameSource> weak_factory_; |
199 }; | 198 }; |
200 | 199 |
201 // A frame source which is locked to an external parameters provides from a | 200 // A frame source which is locked to an external parameters provides from a |
202 // vsync source and generates BeginFrameArgs for it. | 201 // vsync source and generates BeginFrameArgs for it. |
203 class CC_EXPORT SyntheticBeginFrameSource : public BeginFrameSourceBase, | 202 class CC_EXPORT SyntheticBeginFrameSource : public BeginFrameSourceBase, |
204 public VSyncParameterObserver, | |
205 public TimeSourceClient { | 203 public TimeSourceClient { |
206 public: | 204 public: |
207 static scoped_ptr<SyntheticBeginFrameSource> Create( | 205 static scoped_ptr<SyntheticBeginFrameSource> Create( |
208 base::SingleThreadTaskRunner* task_runner, | 206 base::SingleThreadTaskRunner* task_runner, |
209 base::TimeTicks initial_vsync_timebase, | |
210 base::TimeDelta initial_vsync_interval); | 207 base::TimeDelta initial_vsync_interval); |
211 ~SyntheticBeginFrameSource() override; | 208 ~SyntheticBeginFrameSource() override; |
212 | 209 |
| 210 void OnUpdateVSyncParameters(base::TimeTicks new_vsync_timebase, |
| 211 base::TimeDelta new_vsync_interval); |
| 212 |
213 // Tracing | 213 // Tracing |
214 void AsValueInto(base::trace_event::TracedValue* dict) const override; | 214 void AsValueInto(base::trace_event::TracedValue* dict) const override; |
215 | 215 |
216 // VSyncParameterObserver | |
217 void OnUpdateVSyncParameters(base::TimeTicks new_vsync_timebase, | |
218 base::TimeDelta new_vsync_interval) override; | |
219 | |
220 // TimeSourceClient | 216 // TimeSourceClient |
221 void OnTimerTick() override; | 217 void OnTimerTick() override; |
222 | 218 |
223 protected: | 219 protected: |
224 explicit SyntheticBeginFrameSource( | 220 explicit SyntheticBeginFrameSource( |
225 scoped_refptr<DelayBasedTimeSource> time_source); | 221 scoped_refptr<DelayBasedTimeSource> time_source); |
226 | 222 |
227 BeginFrameArgs CreateBeginFrameArgs(base::TimeTicks frame_time, | 223 BeginFrameArgs CreateBeginFrameArgs(base::TimeTicks frame_time, |
228 BeginFrameArgs::BeginFrameArgsType type); | 224 BeginFrameArgs::BeginFrameArgsType type); |
229 | 225 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 270 |
275 base::TimeDelta minimum_interval_; | 271 base::TimeDelta minimum_interval_; |
276 | 272 |
277 BeginFrameSource* active_source_; | 273 BeginFrameSource* active_source_; |
278 std::set<BeginFrameSource*> source_list_; | 274 std::set<BeginFrameSource*> source_list_; |
279 }; | 275 }; |
280 | 276 |
281 } // namespace cc | 277 } // namespace cc |
282 | 278 |
283 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ | 279 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ |
OLD | NEW |