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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
194 BeginFrameArgs::BeginFrameArgsType type); | 194 BeginFrameArgs::BeginFrameArgsType type); |
195 | 195 |
196 std::unique_ptr<DelayBasedTimeSource> time_source_; | 196 std::unique_ptr<DelayBasedTimeSource> time_source_; |
197 std::unordered_set<BeginFrameObserver*> observers_; | 197 std::unordered_set<BeginFrameObserver*> observers_; |
198 base::TimeTicks last_timebase_; | 198 base::TimeTicks last_timebase_; |
199 base::TimeDelta authoritative_interval_; | 199 base::TimeDelta authoritative_interval_; |
200 | 200 |
201 DISALLOW_COPY_AND_ASSIGN(DelayBasedBeginFrameSource); | 201 DISALLOW_COPY_AND_ASSIGN(DelayBasedBeginFrameSource); |
202 }; | 202 }; |
203 | 203 |
204 class CC_EXPORT ExternalBeginFrameSourceClient { | |
205 public: | |
206 // Only called when changed. Assumed false by default. | |
207 virtual void OnNeedsBeginFrames(bool needs_begin_frames) = 0; | |
208 }; | |
209 | |
210 // A begin frame source that is only ticked manually. Usually the endpoint | |
danakj
2016/08/26 22:39:13
"A BeginFrameSource"
| |
211 // of messages from some other thread/process that send OnBeginFrame and | |
212 // receive SetNeedsBeginFrame messages. This turns such messages back into | |
213 // an observable BeginFrameSource. | |
214 class CC_EXPORT ExternalBeginFrameSource : public BeginFrameSource { | |
215 public: | |
216 // Client lifetime must be preserved by owner past the lifetime of this class. | |
217 explicit ExternalBeginFrameSource(ExternalBeginFrameSourceClient* client); | |
218 ~ExternalBeginFrameSource() override; | |
219 | |
220 // BeginFrameSource implementation. | |
221 void AddObserver(BeginFrameObserver* obs) override; | |
222 void RemoveObserver(BeginFrameObserver* obs) override; | |
223 void DidFinishFrame(BeginFrameObserver* obs, | |
224 size_t remaining_frames) override {} | |
225 | |
226 void OnSetBeginFrameSourcePaused(bool paused); | |
227 void OnBeginFrame(const BeginFrameArgs& args); | |
228 | |
229 protected: | |
danakj
2016/08/26 22:39:13
private?
| |
230 BeginFrameArgs missed_begin_frame_args_; | |
231 std::unordered_set<BeginFrameObserver*> observers_; | |
232 ExternalBeginFrameSourceClient* client_; | |
233 bool paused_ = false; | |
234 | |
235 private: | |
236 DISALLOW_COPY_AND_ASSIGN(ExternalBeginFrameSource); | |
237 }; | |
238 | |
204 } // namespace cc | 239 } // namespace cc |
205 | 240 |
206 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ | 241 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ |
OLD | NEW |