OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CC_SURFACES_PRIMARY_BEGIN_FRAME_SOURCE_H_ |
| 6 #define CC_SURFACES_PRIMARY_BEGIN_FRAME_SOURCE_H_ |
| 7 |
| 8 #include "cc/scheduler/begin_frame_source.h" |
| 9 |
| 10 namespace cc { |
| 11 |
| 12 // PrimaryBeginFrameSource echos the first BeginFrameSource in the system. |
| 13 // If the first source goes away then it will echo the new first |
| 14 // BeginFrameSource. |
| 15 class PrimaryBeginFrameSource : public BeginFrameSource, |
| 16 public BeginFrameObserver, |
| 17 public ExternalBeginFrameSourceClient { |
| 18 public: |
| 19 PrimaryBeginFrameSource(); |
| 20 ~PrimaryBeginFrameSource() override; |
| 21 |
| 22 void OnBeginFrameSourceAdded(BeginFrameSource* begin_frame_source); |
| 23 void OnBeginFrameSourceRemoved(BeginFrameSource* begin_frame_source); |
| 24 |
| 25 // BeginFrameObserver implementation. |
| 26 void OnBeginFrame(const BeginFrameArgs& args) override; |
| 27 const BeginFrameArgs& LastUsedBeginFrameArgs() const override; |
| 28 void OnBeginFrameSourcePausedChanged(bool paused) override; |
| 29 |
| 30 // BeginFrameSource implementation. |
| 31 void DidFinishFrame(BeginFrameObserver* obs, |
| 32 const BeginFrameAck& ack) override; |
| 33 void AddObserver(BeginFrameObserver* obs) override; |
| 34 void RemoveObserver(BeginFrameObserver* obs) override; |
| 35 bool IsThrottled() const override; |
| 36 |
| 37 // ExternalBeginFrameSourceClient implementation. |
| 38 void OnNeedsBeginFrames(bool needs_begin_frames) override; |
| 39 |
| 40 private: |
| 41 ExternalBeginFrameSource begin_frame_source_; |
| 42 BeginFrameSource* current_begin_frame_source_ = nullptr; |
| 43 |
| 44 // The last begin frame args generated by the begin frame source. |
| 45 BeginFrameArgs last_begin_frame_args_; |
| 46 |
| 47 bool needs_begin_frames_ = false; |
| 48 |
| 49 base::flat_set<BeginFrameSource*> sources_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(PrimaryBeginFrameSource); |
| 52 }; |
| 53 |
| 54 } // namespace cc |
| 55 |
| 56 #endif // CC_SURFACES_PRIMARY_BEGIN_FRAME_SOURCE_H_ |
OLD | NEW |