| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_MANAGER_H_ |
| 6 #define GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "gpu/gpu_export.h" | 10 #include "gpu/gpu_export.h" |
| 11 #include "gpu/ipc/common/surface_handle.h" | 11 #include "gpu/ipc/common/surface_handle.h" |
| 12 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
| 13 #include "ui/gfx/gpu_fence.h" |
| 13 #include "ui/gfx/gpu_memory_buffer.h" | 14 #include "ui/gfx/gpu_memory_buffer.h" |
| 14 | 15 |
| 15 namespace gpu { | 16 namespace gpu { |
| 16 | 17 |
| 17 struct SyncToken; | 18 struct SyncToken; |
| 18 | 19 |
| 19 class GPU_EXPORT GpuMemoryBufferManager { | 20 class GPU_EXPORT GpuMemoryBufferManager { |
| 20 public: | 21 public: |
| 21 GpuMemoryBufferManager(); | 22 GpuMemoryBufferManager(); |
| 22 | 23 |
| 23 // Allocates a GpuMemoryBuffer that can be shared with another process. | 24 // Allocates a GpuMemoryBuffer that can be shared with another process. |
| 24 virtual std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( | 25 virtual std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( |
| 25 const gfx::Size& size, | 26 const gfx::Size& size, |
| 26 gfx::BufferFormat format, | 27 gfx::BufferFormat format, |
| 27 gfx::BufferUsage usage, | 28 gfx::BufferUsage usage, |
| 28 gpu::SurfaceHandle surface_handle) = 0; | 29 gpu::SurfaceHandle surface_handle) = 0; |
| 29 | 30 |
| 30 // Creates a GpuMemoryBuffer from existing handle. | 31 // Creates a GpuMemoryBuffer from existing handle. |
| 31 virtual std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromHandle( | 32 virtual std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromHandle( |
| 32 const gfx::GpuMemoryBufferHandle& handle, | 33 const gfx::GpuMemoryBufferHandle& handle, |
| 33 const gfx::Size& size, | 34 const gfx::Size& size, |
| 34 gfx::BufferFormat format) = 0; | 35 gfx::BufferFormat format) = 0; |
| 35 | 36 |
| 36 // Associates destruction sync point with |buffer|. | 37 // Associates destruction sync point with |buffer|. |
| 37 virtual void SetDestructionSyncToken(gfx::GpuMemoryBuffer* buffer, | 38 virtual void SetDestructionSyncToken(gfx::GpuMemoryBuffer* buffer, |
| 38 const gpu::SyncToken& sync_token) = 0; | 39 const gpu::SyncToken& sync_token) = 0; |
| 39 | 40 |
| 41 // Creates a GpuFence that can be shared with another process. |
| 42 virtual std::unique_ptr<gfx::GpuFence> CreateGpuFence() = 0; |
| 43 |
| 44 // Creates a GpuFence from existing handle. |
| 45 virtual std::unique_ptr<gfx::GpuFence> CreateGpuFenceFromHandle( |
| 46 const gfx::GpuFenceHandle& handle) = 0; |
| 47 |
| 48 // Returns a GpuFence instance given a ClientFence. Returns NULL on failure. |
| 49 virtual gfx::GpuFence* GpuFenceFromClientFence(ClientFence fence) = 0; |
| 50 |
| 40 protected: | 51 protected: |
| 41 virtual ~GpuMemoryBufferManager(); | 52 virtual ~GpuMemoryBufferManager(); |
| 42 }; | 53 }; |
| 43 | 54 |
| 44 } // namespace gpu | 55 } // namespace gpu |
| 45 | 56 |
| 46 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_MANAGER_H_ | 57 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_MANAGER_H_ |
| OLD | NEW |