Chromium Code Reviews| Index: cc/scheduler/begin_frame_source.h |
| diff --git a/cc/scheduler/begin_frame_source.h b/cc/scheduler/begin_frame_source.h |
| index 0a8a51f08d7c911d6c1594b1623ae74ad5a9fe43..5dca8961f0ba77d2a2255d79d541e2d02b6d0076 100644 |
| --- a/cc/scheduler/begin_frame_source.h |
| +++ b/cc/scheduler/begin_frame_source.h |
| @@ -201,6 +201,41 @@ class CC_EXPORT DelayBasedBeginFrameSource : public SyntheticBeginFrameSource, |
| DISALLOW_COPY_AND_ASSIGN(DelayBasedBeginFrameSource); |
| }; |
| +class CC_EXPORT ExternalBeginFrameSourceClient { |
| + public: |
| + // Only called when changed. Assumed false by default. |
| + virtual void OnNeedsBeginFrames(bool needs_begin_frames) = 0; |
| +}; |
| + |
| +// A begin frame source that is only ticked manually. Usually the endpoint |
|
danakj
2016/08/26 22:39:13
"A BeginFrameSource"
|
| +// of messages from some other thread/process that send OnBeginFrame and |
| +// receive SetNeedsBeginFrame messages. This turns such messages back into |
| +// an observable BeginFrameSource. |
| +class CC_EXPORT ExternalBeginFrameSource : public BeginFrameSource { |
| + public: |
| + // Client lifetime must be preserved by owner past the lifetime of this class. |
| + explicit ExternalBeginFrameSource(ExternalBeginFrameSourceClient* client); |
| + ~ExternalBeginFrameSource() override; |
| + |
| + // BeginFrameSource implementation. |
| + void AddObserver(BeginFrameObserver* obs) override; |
| + void RemoveObserver(BeginFrameObserver* obs) override; |
| + void DidFinishFrame(BeginFrameObserver* obs, |
| + size_t remaining_frames) override {} |
| + |
| + void OnSetBeginFrameSourcePaused(bool paused); |
| + void OnBeginFrame(const BeginFrameArgs& args); |
| + |
| + protected: |
|
danakj
2016/08/26 22:39:13
private?
|
| + BeginFrameArgs missed_begin_frame_args_; |
| + std::unordered_set<BeginFrameObserver*> observers_; |
| + ExternalBeginFrameSourceClient* client_; |
| + bool paused_ = false; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(ExternalBeginFrameSource); |
| +}; |
| + |
| } // namespace cc |
| #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ |