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

Unified Diff: gpu/ipc/service/gpu_vsync_provider.h

Issue 2596123002: GpuVSyncProvider with unit test (Closed)
Patch Set: Added comment for GpuVSyncWorker destructor 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
« no previous file with comments | « gpu/ipc/service/BUILD.gn ('k') | gpu/ipc/service/gpu_vsync_provider_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/ipc/service/gpu_vsync_provider.h
diff --git a/gpu/ipc/service/gpu_vsync_provider.h b/gpu/ipc/service/gpu_vsync_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..13d0ac210a1fc96b1961e0c94bee62039e3e6f32
--- /dev/null
+++ b/gpu/ipc/service/gpu_vsync_provider.h
@@ -0,0 +1,48 @@
+// Copyright (c) 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 GPU_IPC_SERVICE_GPU_VSYNC_PROVIDER_H_
+#define GPU_IPC_SERVICE_GPU_VSYNC_PROVIDER_H_
+
+#include <memory>
+
+#include "base/callback.h"
+#include "base/time/time.h"
+#include "gpu/gpu_export.h"
+#include "gpu/ipc/common/surface_handle.h"
+
+namespace gpu {
+
+class GpuVSyncWorker;
+
+// Implements waiting for VSync signal on background thread.
+class GPU_EXPORT GpuVSyncProvider {
+ public:
+ // Once VSync is enabled, this callback is repeatedly invoked on every VSync.
+ // The call is made on background thread to avoid increased latency due to
+ // serializing callback invocation with other GPU tasks. The code that
+ // implements the callback function is expected to handle that.
+ using VSyncCallback = base::Callback<void(base::TimeTicks timestamp)>;
+
+ ~GpuVSyncProvider();
+
+ static std::unique_ptr<GpuVSyncProvider> Create(const VSyncCallback& callback,
+ SurfaceHandle surface_handle);
+
+ // Enable or disable VSync production.
+ void EnableVSync(bool enabled);
+
+ private:
+#if defined(OS_WIN)
+ GpuVSyncProvider(const VSyncCallback& callback, SurfaceHandle surface_handle);
+
+ std::unique_ptr<GpuVSyncWorker> vsync_worker_;
+#endif // defined(OS_WIN)
+
+ DISALLOW_COPY_AND_ASSIGN(GpuVSyncProvider);
+};
+
+} // namespace gpu
+
+#endif // GPU_IPC_SERVICE_GPU_VSYNC_PROVIDER_H_
« no previous file with comments | « gpu/ipc/service/BUILD.gn ('k') | gpu/ipc/service/gpu_vsync_provider_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698