Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Unified Diff: cc/surfaces/primary_begin_frame_source.h

Issue 2880023002: cc::SurfaceDependencyTracker should not crash when a Display goes away (Closed)
Patch Set: Fix LayerTreeHostImpl unit tests Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/surfaces/frame_sink_manager.cc ('k') | cc/surfaces/primary_begin_frame_source.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « cc/surfaces/frame_sink_manager.cc ('k') | cc/surfaces/primary_begin_frame_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698