OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef GPU_IPC_SERVICE_GPU_VSYNC_PROVIDER_H_ | 5 #ifndef GPU_IPC_SERVICE_GPU_VSYNC_PROVIDER_H_ |
6 #define GPU_IPC_SERVICE_GPU_VSYNC_PROVIDER_H_ | 6 #define GPU_IPC_SERVICE_GPU_VSYNC_PROVIDER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // The call is made on background thread to avoid increased latency due to | 23 // The call is made on background thread to avoid increased latency due to |
24 // serializing callback invocation with other GPU tasks. The code that | 24 // serializing callback invocation with other GPU tasks. The code that |
25 // implements the callback function is expected to handle that. | 25 // implements the callback function is expected to handle that. |
26 using VSyncCallback = base::Callback<void(base::TimeTicks timestamp)>; | 26 using VSyncCallback = base::Callback<void(base::TimeTicks timestamp)>; |
27 | 27 |
28 ~GpuVSyncProvider(); | 28 ~GpuVSyncProvider(); |
29 | 29 |
30 static std::unique_ptr<GpuVSyncProvider> Create(const VSyncCallback& callback, | 30 static std::unique_ptr<GpuVSyncProvider> Create(const VSyncCallback& callback, |
31 SurfaceHandle surface_handle); | 31 SurfaceHandle surface_handle); |
32 | 32 |
33 // Enable or disable VSync production. | 33 // Start or stop VSync production. |
34 void EnableVSync(bool enabled); | 34 void SetNeedsVSync(bool needs_vsync); |
35 | 35 |
36 private: | 36 private: |
37 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
38 GpuVSyncProvider(const VSyncCallback& callback, SurfaceHandle surface_handle); | 38 GpuVSyncProvider(const VSyncCallback& callback, SurfaceHandle surface_handle); |
39 | 39 |
40 std::unique_ptr<GpuVSyncWorker> vsync_worker_; | 40 std::unique_ptr<GpuVSyncWorker> vsync_worker_; |
41 #endif // defined(OS_WIN) | 41 #endif // defined(OS_WIN) |
42 | 42 |
43 DISALLOW_COPY_AND_ASSIGN(GpuVSyncProvider); | 43 DISALLOW_COPY_AND_ASSIGN(GpuVSyncProvider); |
44 }; | 44 }; |
45 | 45 |
46 } // namespace gpu | 46 } // namespace gpu |
47 | 47 |
48 #endif // GPU_IPC_SERVICE_GPU_VSYNC_PROVIDER_H_ | 48 #endif // GPU_IPC_SERVICE_GPU_VSYNC_PROVIDER_H_ |
OLD | NEW |