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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // processing (rather than toggling SetNeedsBeginFrames every frame). It is | 119 // processing (rather than toggling SetNeedsBeginFrames every frame). It is |
120 // used by systems like the BackToBackFrameSource to make sure only one frame | 120 // used by systems like the BackToBackFrameSource to make sure only one frame |
121 // is pending at a time. | 121 // is pending at a time. |
122 virtual void DidFinishFrame(size_t remaining_frames) = 0; | 122 virtual void DidFinishFrame(size_t remaining_frames) = 0; |
123 | 123 |
124 // Add/Remove an observer from the source. When no observers are added the BFS | 124 // Add/Remove an observer from the source. When no observers are added the BFS |
125 // should shut down its timers, disable vsync, etc. | 125 // should shut down its timers, disable vsync, etc. |
126 virtual void AddObserver(BeginFrameObserver* obs) = 0; | 126 virtual void AddObserver(BeginFrameObserver* obs) = 0; |
127 virtual void RemoveObserver(BeginFrameObserver* obs) = 0; | 127 virtual void RemoveObserver(BeginFrameObserver* obs) = 0; |
128 | 128 |
129 // Tells the Source that client is ready to handle BeginFrames messages. | |
130 virtual void SetClientReady() = 0; | |
131 | |
132 // Tracing support - Recommend (but not required) to call this implementation | 129 // Tracing support - Recommend (but not required) to call this implementation |
133 // in any override. | 130 // in any override. |
134 virtual void AsValueInto(base::trace_event::TracedValue* dict) const = 0; | 131 virtual void AsValueInto(base::trace_event::TracedValue* dict) const = 0; |
135 }; | 132 }; |
136 | 133 |
137 // Simple base class which implements a BeginFrameSource. | 134 // Simple base class which implements a BeginFrameSource. |
138 // Implementation classes should: | 135 // Implementation classes should: |
139 // - Implement the pure virtual (Set)NeedsBeginFrames methods from | 136 // - Implement the pure virtual (Set)NeedsBeginFrames methods from |
140 // BeginFrameSource. | 137 // BeginFrameSource. |
141 // - Use the CallOnBeginFrame method to call to the observer(s). | 138 // - Use the CallOnBeginFrame method to call to the observer(s). |
142 // - Recommended (but not required) to call BeginFrameSourceBase::AsValueInto | 139 // - Recommended (but not required) to call BeginFrameSourceBase::AsValueInto |
143 // in their own AsValueInto implementation. | 140 // in their own AsValueInto implementation. |
144 class CC_EXPORT BeginFrameSourceBase : public BeginFrameSource { | 141 class CC_EXPORT BeginFrameSourceBase : public BeginFrameSource { |
145 public: | 142 public: |
146 ~BeginFrameSourceBase() override; | 143 ~BeginFrameSourceBase() override; |
147 | 144 |
148 // BeginFrameSource | 145 // BeginFrameSource |
149 void DidFinishFrame(size_t remaining_frames) override {} | 146 void DidFinishFrame(size_t remaining_frames) override {} |
150 void AddObserver(BeginFrameObserver* obs) override; | 147 void AddObserver(BeginFrameObserver* obs) override; |
151 void RemoveObserver(BeginFrameObserver* obs) override; | 148 void RemoveObserver(BeginFrameObserver* obs) override; |
152 void SetClientReady() override {} | |
153 | 149 |
154 // Tracing support - Recommend (but not required) to call this implementation | 150 // Tracing support - Recommend (but not required) to call this implementation |
155 // in any override. | 151 // in any override. |
156 void AsValueInto(base::trace_event::TracedValue* dict) const override; | 152 void AsValueInto(base::trace_event::TracedValue* dict) const override; |
157 | 153 |
158 protected: | 154 protected: |
159 BeginFrameSourceBase(); | 155 BeginFrameSourceBase(); |
160 | 156 |
161 // These methods should be used by subclasses to make the call to the | 157 // These methods should be used by subclasses to make the call to the |
162 // observers. | 158 // observers. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 241 |
246 scoped_ptr<DelayBasedTimeSource> time_source_; | 242 scoped_ptr<DelayBasedTimeSource> time_source_; |
247 | 243 |
248 private: | 244 private: |
249 DISALLOW_COPY_AND_ASSIGN(SyntheticBeginFrameSource); | 245 DISALLOW_COPY_AND_ASSIGN(SyntheticBeginFrameSource); |
250 }; | 246 }; |
251 | 247 |
252 } // namespace cc | 248 } // namespace cc |
253 | 249 |
254 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ | 250 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ |
OLD | NEW |