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 "base/memory/scoped_ptr.h" | 8 #include <memory> |
| 9 |
9 #include "gpu/gpu_export.h" | 10 #include "gpu/gpu_export.h" |
10 #include "ui/gfx/geometry/size.h" | 11 #include "ui/gfx/geometry/size.h" |
11 #include "ui/gfx/gpu_memory_buffer.h" | 12 #include "ui/gfx/gpu_memory_buffer.h" |
12 | 13 |
13 namespace gpu { | 14 namespace gpu { |
14 | 15 |
15 struct SyncToken; | 16 struct SyncToken; |
16 | 17 |
17 class GPU_EXPORT GpuMemoryBufferManager { | 18 class GPU_EXPORT GpuMemoryBufferManager { |
18 public: | 19 public: |
19 GpuMemoryBufferManager(); | 20 GpuMemoryBufferManager(); |
20 | 21 |
21 // Allocates a GpuMemoryBuffer that can be shared with another process. | 22 // Allocates a GpuMemoryBuffer that can be shared with another process. |
22 virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( | 23 virtual std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( |
23 const gfx::Size& size, | 24 const gfx::Size& size, |
24 gfx::BufferFormat format, | 25 gfx::BufferFormat format, |
25 gfx::BufferUsage usage, | 26 gfx::BufferUsage usage, |
26 int32_t surface_id) = 0; | 27 int32_t surface_id) = 0; |
27 | 28 |
28 // Creates a GpuMemoryBuffer from existing handle. | 29 // Creates a GpuMemoryBuffer from existing handle. |
29 virtual scoped_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromHandle( | 30 virtual std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromHandle( |
30 const gfx::GpuMemoryBufferHandle& handle, | 31 const gfx::GpuMemoryBufferHandle& handle, |
31 const gfx::Size& size, | 32 const gfx::Size& size, |
32 gfx::BufferFormat format) = 0; | 33 gfx::BufferFormat format) = 0; |
33 | 34 |
34 // Returns a GpuMemoryBuffer instance given a ClientBuffer. Returns NULL on | 35 // Returns a GpuMemoryBuffer instance given a ClientBuffer. Returns NULL on |
35 // failure. | 36 // failure. |
36 virtual gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer( | 37 virtual gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer( |
37 ClientBuffer buffer) = 0; | 38 ClientBuffer buffer) = 0; |
38 | 39 |
39 // Associates destruction sync point with |buffer|. | 40 // Associates destruction sync point with |buffer|. |
40 virtual void SetDestructionSyncToken(gfx::GpuMemoryBuffer* buffer, | 41 virtual void SetDestructionSyncToken(gfx::GpuMemoryBuffer* buffer, |
41 const gpu::SyncToken& sync_token) = 0; | 42 const gpu::SyncToken& sync_token) = 0; |
42 | 43 |
43 protected: | 44 protected: |
44 virtual ~GpuMemoryBufferManager(); | 45 virtual ~GpuMemoryBufferManager(); |
45 }; | 46 }; |
46 | 47 |
47 } // namespace gpu | 48 } // namespace gpu |
48 | 49 |
49 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_MANAGER_H_ | 50 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_MANAGER_H_ |
OLD | NEW |