| Index: cc/surfaces/primary_begin_frame_source.h
|
| diff --git a/cc/surfaces/primary_begin_frame_source.h b/cc/surfaces/primary_begin_frame_source.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e881a29727127e876e572e262fccb2f1c74e4af2
|
| --- /dev/null
|
| +++ b/cc/surfaces/primary_begin_frame_source.h
|
| @@ -0,0 +1,56 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CC_SURFACES_PRIMARY_BEGIN_FRAME_SOURCE_H_
|
| +#define CC_SURFACES_PRIMARY_BEGIN_FRAME_SOURCE_H_
|
| +
|
| +#include "cc/scheduler/begin_frame_source.h"
|
| +
|
| +namespace cc {
|
| +
|
| +// PrimaryBeginFrameSource echos the first BeginFrameSource in the system.
|
| +// If the first source goes away then it will echo the new first
|
| +// BeginFrameSource.
|
| +class PrimaryBeginFrameSource : public BeginFrameSource,
|
| + public BeginFrameObserver,
|
| + public ExternalBeginFrameSourceClient {
|
| + public:
|
| + PrimaryBeginFrameSource();
|
| + ~PrimaryBeginFrameSource() override;
|
| +
|
| + void OnBeginFrameSourceAdded(BeginFrameSource* begin_frame_source);
|
| + void OnBeginFrameSourceRemoved(BeginFrameSource* begin_frame_source);
|
| +
|
| + // BeginFrameObserver implementation.
|
| + void OnBeginFrame(const BeginFrameArgs& args) override;
|
| + const BeginFrameArgs& LastUsedBeginFrameArgs() const override;
|
| + void OnBeginFrameSourcePausedChanged(bool paused) override;
|
| +
|
| + // BeginFrameSource implementation.
|
| + void DidFinishFrame(BeginFrameObserver* obs,
|
| + const BeginFrameAck& ack) override;
|
| + void AddObserver(BeginFrameObserver* obs) override;
|
| + void RemoveObserver(BeginFrameObserver* obs) override;
|
| + bool IsThrottled() const override;
|
| +
|
| + // ExternalBeginFrameSourceClient implementation.
|
| + void OnNeedsBeginFrames(bool needs_begin_frames) override;
|
| +
|
| + private:
|
| + ExternalBeginFrameSource begin_frame_source_;
|
| + BeginFrameSource* current_begin_frame_source_ = nullptr;
|
| +
|
| + // The last begin frame args generated by the begin frame source.
|
| + BeginFrameArgs last_begin_frame_args_;
|
| +
|
| + bool needs_begin_frames_ = false;
|
| +
|
| + base::flat_set<BeginFrameSource*> sources_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(PrimaryBeginFrameSource);
|
| +};
|
| +
|
| +} // namespace cc
|
| +
|
| +#endif // CC_SURFACES_PRIMARY_BEGIN_FRAME_SOURCE_H_
|
|
|