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