| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // is pending at a time. | 115 // is pending at a time. |
| 116 virtual void DidFinishFrame(BeginFrameObserver* obs, | 116 virtual void DidFinishFrame(BeginFrameObserver* obs, |
| 117 size_t remaining_frames) = 0; | 117 size_t remaining_frames) = 0; |
| 118 | 118 |
| 119 // Add/Remove an observer from the source. When no observers are added the BFS | 119 // Add/Remove an observer from the source. When no observers are added the BFS |
| 120 // should shut down its timers, disable vsync, etc. | 120 // should shut down its timers, disable vsync, etc. |
| 121 virtual void AddObserver(BeginFrameObserver* obs) = 0; | 121 virtual void AddObserver(BeginFrameObserver* obs) = 0; |
| 122 virtual void RemoveObserver(BeginFrameObserver* obs) = 0; | 122 virtual void RemoveObserver(BeginFrameObserver* obs) = 0; |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 // A BeginFrameSource that does nothing. |
| 126 class StubBeginFrameSource : public BeginFrameSource { |
| 127 public: |
| 128 void DidFinishFrame(BeginFrameObserver* obs, |
| 129 size_t remaining_frames) override {} |
| 130 void AddObserver(BeginFrameObserver* obs) override {} |
| 131 void RemoveObserver(BeginFrameObserver* obs) override {} |
| 132 }; |
| 133 |
| 125 // Simple base class which implements a BeginFrameSource. | 134 // Simple base class which implements a BeginFrameSource. |
| 126 // Implementation classes should: | 135 // Implementation classes should: |
| 127 // - Implement the pure virtual (Set)NeedsBeginFrames methods from | 136 // - Implement the pure virtual (Set)NeedsBeginFrames methods from |
| 128 // BeginFrameSource. | 137 // BeginFrameSource. |
| 129 // - Use the CallOnBeginFrame method to call to the observer(s). | 138 // - Use the CallOnBeginFrame method to call to the observer(s). |
| 130 class CC_EXPORT BeginFrameSourceBase : public BeginFrameSource { | 139 class CC_EXPORT BeginFrameSourceBase : public BeginFrameSource { |
| 131 public: | 140 public: |
| 132 ~BeginFrameSourceBase() override; | 141 ~BeginFrameSourceBase() override; |
| 133 | 142 |
| 134 // BeginFrameSource | 143 // BeginFrameSource |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 base::TimeTicks last_timebase_; | 228 base::TimeTicks last_timebase_; |
| 220 base::TimeDelta authoritative_interval_; | 229 base::TimeDelta authoritative_interval_; |
| 221 | 230 |
| 222 private: | 231 private: |
| 223 DISALLOW_COPY_AND_ASSIGN(SyntheticBeginFrameSource); | 232 DISALLOW_COPY_AND_ASSIGN(SyntheticBeginFrameSource); |
| 224 }; | 233 }; |
| 225 | 234 |
| 226 } // namespace cc | 235 } // namespace cc |
| 227 | 236 |
| 228 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ | 237 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ |
| OLD | NEW |