| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // is pending at a time. | 107 // is pending at a time. |
| 108 virtual void DidFinishFrame(BeginFrameObserver* obs, | 108 virtual void DidFinishFrame(BeginFrameObserver* obs, |
| 109 size_t remaining_frames) = 0; | 109 size_t remaining_frames) = 0; |
| 110 | 110 |
| 111 // Add/Remove an observer from the source. When no observers are added the BFS | 111 // Add/Remove an observer from the source. When no observers are added the BFS |
| 112 // should shut down its timers, disable vsync, etc. | 112 // should shut down its timers, disable vsync, etc. |
| 113 virtual void AddObserver(BeginFrameObserver* obs) = 0; | 113 virtual void AddObserver(BeginFrameObserver* obs) = 0; |
| 114 virtual void RemoveObserver(BeginFrameObserver* obs) = 0; | 114 virtual void RemoveObserver(BeginFrameObserver* obs) = 0; |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 // A BeginFrameSource that does nothing. |
| 118 class StubBeginFrameSource : public BeginFrameSource { |
| 119 public: |
| 120 void DidFinishFrame(BeginFrameObserver* obs, |
| 121 size_t remaining_frames) override {} |
| 122 void AddObserver(BeginFrameObserver* obs) override {} |
| 123 void RemoveObserver(BeginFrameObserver* obs) override {} |
| 124 }; |
| 125 |
| 117 // A frame source which ticks itself independently. | 126 // A frame source which ticks itself independently. |
| 118 class CC_EXPORT SyntheticBeginFrameSource : public BeginFrameSource { | 127 class CC_EXPORT SyntheticBeginFrameSource : public BeginFrameSource { |
| 119 public: | 128 public: |
| 120 ~SyntheticBeginFrameSource() override; | 129 ~SyntheticBeginFrameSource() override; |
| 121 | 130 |
| 122 virtual void OnUpdateVSyncParameters(base::TimeTicks timebase, | 131 virtual void OnUpdateVSyncParameters(base::TimeTicks timebase, |
| 123 base::TimeDelta interval) = 0; | 132 base::TimeDelta interval) = 0; |
| 124 // This overrides any past or future interval from updating vsync parameters. | 133 // This overrides any past or future interval from updating vsync parameters. |
| 125 virtual void SetAuthoritativeVSyncInterval(base::TimeDelta interval) = 0; | 134 virtual void SetAuthoritativeVSyncInterval(base::TimeDelta interval) = 0; |
| 126 }; | 135 }; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 std::unordered_set<BeginFrameObserver*> observers_; | 197 std::unordered_set<BeginFrameObserver*> observers_; |
| 189 base::TimeTicks last_timebase_; | 198 base::TimeTicks last_timebase_; |
| 190 base::TimeDelta authoritative_interval_; | 199 base::TimeDelta authoritative_interval_; |
| 191 | 200 |
| 192 DISALLOW_COPY_AND_ASSIGN(DelayBasedBeginFrameSource); | 201 DISALLOW_COPY_AND_ASSIGN(DelayBasedBeginFrameSource); |
| 193 }; | 202 }; |
| 194 | 203 |
| 195 } // namespace cc | 204 } // namespace cc |
| 196 | 205 |
| 197 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ | 206 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ |
| OLD | NEW |