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_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_NATIVE_PIXMAP_H_ | 5 #ifndef GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_NATIVE_PIXMAP_H_ |
6 #define GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_NATIVE_PIXMAP_H_ | 6 #define GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_NATIVE_PIXMAP_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "gpu/gpu_export.h" | 13 #include "gpu/gpu_export.h" |
12 #include "gpu/ipc/client/gpu_memory_buffer_impl.h" | 14 #include "gpu/ipc/client/gpu_memory_buffer_impl.h" |
13 | 15 |
14 namespace ui { | 16 namespace ui { |
15 class ClientNativePixmap; | 17 class ClientNativePixmap; |
16 } | 18 } |
17 | 19 |
18 namespace gpu { | 20 namespace gpu { |
19 | 21 |
20 // Implementation of GPU memory buffer based on Ozone native pixmap. | 22 // Implementation of GPU memory buffer based on Ozone native pixmap. |
21 class GPU_EXPORT GpuMemoryBufferImplOzoneNativePixmap | 23 class GPU_EXPORT GpuMemoryBufferImplOzoneNativePixmap |
22 : public GpuMemoryBufferImpl { | 24 : public GpuMemoryBufferImpl { |
23 public: | 25 public: |
24 ~GpuMemoryBufferImplOzoneNativePixmap() override; | 26 ~GpuMemoryBufferImplOzoneNativePixmap() override; |
25 | 27 |
26 static scoped_ptr<GpuMemoryBufferImplOzoneNativePixmap> CreateFromHandle( | 28 static std::unique_ptr<GpuMemoryBufferImplOzoneNativePixmap> CreateFromHandle( |
27 const gfx::GpuMemoryBufferHandle& handle, | 29 const gfx::GpuMemoryBufferHandle& handle, |
28 const gfx::Size& size, | 30 const gfx::Size& size, |
29 gfx::BufferFormat format, | 31 gfx::BufferFormat format, |
30 gfx::BufferUsage usage, | 32 gfx::BufferUsage usage, |
31 const DestructionCallback& callback); | 33 const DestructionCallback& callback); |
32 | 34 |
33 static bool IsConfigurationSupported(gfx::BufferFormat format, | 35 static bool IsConfigurationSupported(gfx::BufferFormat format, |
34 gfx::BufferUsage usage); | 36 gfx::BufferUsage usage); |
35 | 37 |
36 static base::Closure AllocateForTesting(const gfx::Size& size, | 38 static base::Closure AllocateForTesting(const gfx::Size& size, |
37 gfx::BufferFormat format, | 39 gfx::BufferFormat format, |
38 gfx::BufferUsage usage, | 40 gfx::BufferUsage usage, |
39 gfx::GpuMemoryBufferHandle* handle); | 41 gfx::GpuMemoryBufferHandle* handle); |
40 | 42 |
41 // Overridden from gfx::GpuMemoryBuffer: | 43 // Overridden from gfx::GpuMemoryBuffer: |
42 bool Map() override; | 44 bool Map() override; |
43 void* memory(size_t plane) override; | 45 void* memory(size_t plane) override; |
44 void Unmap() override; | 46 void Unmap() override; |
45 int stride(size_t plane) const override; | 47 int stride(size_t plane) const override; |
46 gfx::GpuMemoryBufferHandle GetHandle() const override; | 48 gfx::GpuMemoryBufferHandle GetHandle() const override; |
47 | 49 |
48 private: | 50 private: |
49 GpuMemoryBufferImplOzoneNativePixmap( | 51 GpuMemoryBufferImplOzoneNativePixmap( |
50 gfx::GpuMemoryBufferId id, | 52 gfx::GpuMemoryBufferId id, |
51 const gfx::Size& size, | 53 const gfx::Size& size, |
52 gfx::BufferFormat format, | 54 gfx::BufferFormat format, |
53 const DestructionCallback& callback, | 55 const DestructionCallback& callback, |
54 scoped_ptr<ui::ClientNativePixmap> native_pixmap); | 56 std::unique_ptr<ui::ClientNativePixmap> native_pixmap); |
55 | 57 |
56 scoped_ptr<ui::ClientNativePixmap> pixmap_; | 58 std::unique_ptr<ui::ClientNativePixmap> pixmap_; |
57 void* data_; | 59 void* data_; |
58 | 60 |
59 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplOzoneNativePixmap); | 61 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplOzoneNativePixmap); |
60 }; | 62 }; |
61 | 63 |
62 } // namespace gpu | 64 } // namespace gpu |
63 | 65 |
64 #endif // GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_NATIVE_PIXMAP_H_ | 66 #endif // GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_NATIVE_PIXMAP_H_ |
OLD | NEW |