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

Unified Diff: cc/surfaces/primary_begin_frame_source.h

Issue 2880023002: cc::SurfaceDependencyTracker should not crash when a Display goes away (Closed)
Patch Set: StrictMock => NiceMock 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_observer.h ('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..555cf158ba67bd7ce4a1994b654df794eb34b2cc
--- /dev/null
+++ b/cc/surfaces/primary_begin_frame_source.h
@@ -0,0 +1,62 @@
+// 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"
+#include "cc/surfaces/frame_sink_observer.h"
+
+namespace cc {
+
+class FrameSinkManager;
+
+// 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 FrameSinkObserver {
+ public:
+ PrimaryBeginFrameSource();
+ ~PrimaryBeginFrameSource() override;
+
+ void Init(FrameSinkManager* frame_sink_manager);
+
+ // 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;
+
+ // FrameSinkObserver implementation.
+ void OnBeginFrameSourceAdded(BeginFrameSource* begin_frame_source) override;
enne (OOO) 2017/05/24 17:55:17 This is a tiny design nit in this class, but I fee
Fady Samuel 2017/05/24 18:36:51 Done.
+ void OnBeginFrameSourceRemoved(BeginFrameSource* begin_frame_source) override;
+
+ private:
+ FrameSinkManager* frame_sink_manager_ = nullptr;
+ std::unique_ptr<ExternalBeginFrameSource> begin_frame_source_;
enne (OOO) 2017/05/24 17:55:17 Maybe just make this a member instead of a heap al
Fady Samuel 2017/05/24 18:36:51 Done.
+ BeginFrameSource* primary_begin_frame_source_ = nullptr;
enne (OOO) 2017/05/24 17:55:17 There's a lot of "primary" verbage everywhere. Ma
Fady Samuel 2017/05/24 18:36:52 Done.
+
+ // The last begin frame args generated by the begin frame source.
+ BeginFrameArgs last_begin_frame_args_;
+
+ bool needs_begin_frames_ = false;
+
+ DISALLOW_COPY_AND_ASSIGN(PrimaryBeginFrameSource);
+};
+
+} // namespace cc
+
+#endif // CC_SURFACES_PRIMARY_BEGIN_FRAME_SOURCE_H_
« no previous file with comments | « cc/surfaces/frame_sink_observer.h ('k') | cc/surfaces/primary_begin_frame_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698