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

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

Issue 2626413002: Route D3D VSync signal to Compositor (Closed)
Patch Set: Merged with recent BeginFrameSource changes Created 3 years, 10 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..a701f98433f420d3b405aeaa65ef4a4ddaf3bfa6
--- /dev/null
+++ b/content/browser/compositor/gpu_vsync_begin_frame_source.h
@@ -0,0 +1,44 @@
+// 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 {
+ 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,
+ cc::ExternalBeginFrameSourceClient {
+ public:
+ explicit GpuVSyncBeginFrameSource(GpuVSyncControl* vsync_control);
+ ~GpuVSyncBeginFrameSource() override;
+
+ // cc::ExternalBeginFrameSourceClient implementation.
+ void OnNeedsBeginFrames(bool needs_begin_frames) override;
+ void OnDidFinishFrame(const cc::BeginFrameAck& ack) 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