| 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..4a0668cd9fb4534deea2cb214e39c917ea70ee12 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 BeginFrameSource that is only ticked manually. Usually the endpoint
|
| +// 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:
|
| + 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_
|
|
|