| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 void DidFinishFrame(size_t remaining_frames) override; | 178 void DidFinishFrame(size_t remaining_frames) override; |
| 179 | 179 |
| 180 // Tracing | 180 // Tracing |
| 181 void AsValueInto(base::debug::TracedValue* dict) const override; | 181 void AsValueInto(base::debug::TracedValue* dict) const override; |
| 182 | 182 |
| 183 protected: | 183 protected: |
| 184 explicit BackToBackBeginFrameSource( | 184 explicit BackToBackBeginFrameSource( |
| 185 base::SingleThreadTaskRunner* task_runner); | 185 base::SingleThreadTaskRunner* task_runner); |
| 186 virtual base::TimeTicks Now(); // Now overridable for testing | 186 virtual base::TimeTicks Now(); // Now overridable for testing |
| 187 | 187 |
| 188 base::WeakPtrFactory<BackToBackBeginFrameSource> weak_factory_; | |
| 189 base::SingleThreadTaskRunner* task_runner_; | 188 base::SingleThreadTaskRunner* task_runner_; |
| 190 | 189 |
| 191 bool send_begin_frame_posted_; | 190 bool send_begin_frame_posted_; |
| 192 | 191 |
| 193 // BeginFrameSourceMixIn | 192 // BeginFrameSourceMixIn |
| 194 void OnNeedsBeginFramesChange(bool needs_begin_frames) override; | 193 void OnNeedsBeginFramesChange(bool needs_begin_frames) override; |
| 195 | 194 |
| 196 void BeginFrame(); | 195 void BeginFrame(); |
| 196 |
| 197 private: |
| 198 base::WeakPtrFactory<BackToBackBeginFrameSource> weak_factory_; |
| 197 }; | 199 }; |
| 198 | 200 |
| 199 // A frame source which is locked to an external parameters provides from a | 201 // A frame source which is locked to an external parameters provides from a |
| 200 // vsync source and generates BeginFrameArgs for it. | 202 // vsync source and generates BeginFrameArgs for it. |
| 201 class CC_EXPORT SyntheticBeginFrameSource : public BeginFrameSourceMixIn, | 203 class CC_EXPORT SyntheticBeginFrameSource : public BeginFrameSourceMixIn, |
| 202 public VSyncParameterObserver, | 204 public VSyncParameterObserver, |
| 203 public TimeSourceClient { | 205 public TimeSourceClient { |
| 204 public: | 206 public: |
| 205 static scoped_ptr<SyntheticBeginFrameSource> Create( | 207 static scoped_ptr<SyntheticBeginFrameSource> Create( |
| 206 base::SingleThreadTaskRunner* task_runner, | 208 base::SingleThreadTaskRunner* task_runner, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 276 |
| 275 base::TimeDelta minimum_interval_; | 277 base::TimeDelta minimum_interval_; |
| 276 | 278 |
| 277 BeginFrameSource* active_source_; | 279 BeginFrameSource* active_source_; |
| 278 std::set<BeginFrameSource*> source_list_; | 280 std::set<BeginFrameSource*> source_list_; |
| 279 }; | 281 }; |
| 280 | 282 |
| 281 } // namespace cc | 283 } // namespace cc |
| 282 | 284 |
| 283 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ | 285 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ |
| OLD | NEW |