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

Unified Diff: content/browser/compositor/gpu_vsync_begin_frame_source.h

Issue 2626413002: Route D3D VSync signal to Compositor (Closed)
Patch Set: Addressed CR feedback Created 3 years, 11 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
Index: content/browser/compositor/gpu_vsync_begin_frame_source.h
diff --git a/content/browser/compositor/gpu_vsync_begin_frame_source.h b/content/browser/compositor/gpu_vsync_begin_frame_source.h
new file mode 100644
index 0000000000000000000000000000000000000000..a3ddd6b07863833b9d5bb2b267355db53dd4ed59
--- /dev/null
+++ b/content/browser/compositor/gpu_vsync_begin_frame_source.h
@@ -0,0 +1,43 @@
+// Copyright 2016 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 CONTENT_BROWSER_COMPOSITOR_GPU_VSYNC_BEGIN_FRAME_SOURCE_H_
+#define CONTENT_BROWSER_COMPOSITOR_GPU_VSYNC_BEGIN_FRAME_SOURCE_H_
+
+#include "base/memory/weak_ptr.h"
+#include "base/time/time.h"
+#include "cc/scheduler/begin_frame_source.h"
+
+namespace content {
+
+// This class is used to control VSync production on GPU side.
+class GpuVSyncControl {
stanisc 2017/01/24 21:23:25 Should this be moved to the same header file with
enne (OOO) 2017/01/24 21:32:07 Yeah, that seems reasonable.
+ public:
+ virtual void SetNeedsVSync(bool needs_vsync) = 0;
+};
+
+// This is a type of ExternalBeginFrameSource where VSync signals are
+// generated externally on GPU side.
+class GpuVSyncBeginFrameSource : public cc::ExternalBeginFrameSource,
stanisc 2017/01/24 21:23:25 Since this class is so simple now should it be mov
enne (OOO) 2017/01/24 21:32:07 I don't feel strongly. I think it's fine to leave
+ cc::ExternalBeginFrameSourceClient {
+ public:
+ explicit GpuVSyncBeginFrameSource(GpuVSyncControl* vsync_control);
+ ~GpuVSyncBeginFrameSource() override;
+
+ // cc::ExternalBeginFrameSourceClient implementation.
+ void OnNeedsBeginFrames(bool needs_begin_frames) override;
+
+ void OnVSync(base::TimeTicks timestamp, base::TimeDelta interval);
+
+ private:
+ GpuVSyncControl* const vsync_control_;
+ bool needs_begin_frames_;
+ uint64_t next_sequence_number_;
+
+ DISALLOW_COPY_AND_ASSIGN(GpuVSyncBeginFrameSource);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_COMPOSITOR_GPU_VSYNC_BEGIN_FRAME_SOURCE_H_

Powered by Google App Engine
This is Rietveld 408576698