| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 200 |
| 202 private: | 201 private: |
| 203 base::WeakPtrFactory<BackToBackBeginFrameSource> weak_factory_; | 202 base::WeakPtrFactory<BackToBackBeginFrameSource> weak_factory_; |
| 204 | 203 |
| 205 DISALLOW_COPY_AND_ASSIGN(BackToBackBeginFrameSource); | 204 DISALLOW_COPY_AND_ASSIGN(BackToBackBeginFrameSource); |
| 206 }; | 205 }; |
| 207 | 206 |
| 208 // 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 |
| 209 // vsync source and generates BeginFrameArgs for it. | 208 // vsync source and generates BeginFrameArgs for it. |
| 210 class CC_EXPORT SyntheticBeginFrameSource : public BeginFrameSourceBase, | 209 class CC_EXPORT SyntheticBeginFrameSource : public BeginFrameSourceBase, |
| 211 public VSyncParameterObserver, | |
| 212 public TimeSourceClient { | 210 public TimeSourceClient { |
| 213 public: | 211 public: |
| 214 static scoped_ptr<SyntheticBeginFrameSource> Create( | 212 static scoped_ptr<SyntheticBeginFrameSource> Create( |
| 215 base::SingleThreadTaskRunner* task_runner, | 213 base::SingleThreadTaskRunner* task_runner, |
| 216 base::TimeTicks initial_vsync_timebase, | |
| 217 base::TimeDelta initial_vsync_interval); | 214 base::TimeDelta initial_vsync_interval); |
| 218 ~SyntheticBeginFrameSource() override; | 215 ~SyntheticBeginFrameSource() override; |
| 219 | 216 |
| 217 void OnUpdateVSyncParameters(base::TimeTicks new_vsync_timebase, |
| 218 base::TimeDelta new_vsync_interval); |
| 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 // VSyncParameterObserver | |
| 224 void OnUpdateVSyncParameters(base::TimeTicks new_vsync_timebase, | |
| 225 base::TimeDelta new_vsync_interval) override; | |
| 226 | |
| 227 // TimeSourceClient | 223 // TimeSourceClient |
| 228 void OnTimerTick() override; | 224 void OnTimerTick() override; |
| 229 | 225 |
| 230 protected: | 226 protected: |
| 231 explicit SyntheticBeginFrameSource( | 227 explicit SyntheticBeginFrameSource( |
| 232 scoped_ptr<DelayBasedTimeSource> time_source); | 228 scoped_ptr<DelayBasedTimeSource> time_source); |
| 233 | 229 |
| 234 BeginFrameArgs CreateBeginFrameArgs(base::TimeTicks frame_time, | 230 BeginFrameArgs CreateBeginFrameArgs(base::TimeTicks frame_time, |
| 235 BeginFrameArgs::BeginFrameArgsType type); | 231 BeginFrameArgs::BeginFrameArgsType type); |
| 236 | 232 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 BeginFrameSource* active_source_; | 283 BeginFrameSource* active_source_; |
| 288 std::set<BeginFrameSource*> source_list_; | 284 std::set<BeginFrameSource*> source_list_; |
| 289 | 285 |
| 290 private: | 286 private: |
| 291 DISALLOW_COPY_AND_ASSIGN(BeginFrameSourceMultiplexer); | 287 DISALLOW_COPY_AND_ASSIGN(BeginFrameSourceMultiplexer); |
| 292 }; | 288 }; |
| 293 | 289 |
| 294 } // namespace cc | 290 } // namespace cc |
| 295 | 291 |
| 296 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ | 292 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ |
| OLD | NEW |