| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 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 COMPONENTS_MUS_GLES2_OZONE_GPU_MEMORY_BUFFER_ | 5 #ifndef COMPONENTS_MUS_GLES2_OZONE_GPU_MEMORY_BUFFER_ |
| 6 #define COMPONENTS_MUS_GLES2_OZONE_GPU_MEMORY_BUFFER_ | 6 #define COMPONENTS_MUS_GLES2_OZONE_GPU_MEMORY_BUFFER_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include <memory> |
| 9 |
| 9 #include "components/mus/gles2/gpu_memory_buffer_impl.h" | 10 #include "components/mus/gles2/gpu_memory_buffer_impl.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 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
| 13 | 14 |
| 14 namespace ui { | 15 namespace ui { |
| 15 class ClientNativePixmap; | 16 class ClientNativePixmap; |
| 16 class NativePixmap; | 17 class NativePixmap; |
| 17 } // namespace ui | 18 } // namespace ui |
| 18 | 19 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 31 void* memory(size_t plane) override; | 32 void* memory(size_t plane) override; |
| 32 int stride(size_t plane) const override; | 33 int stride(size_t plane) const override; |
| 33 gfx::GpuMemoryBufferHandle GetHandle() const override; | 34 gfx::GpuMemoryBufferHandle GetHandle() const override; |
| 34 | 35 |
| 35 // Returns the type of this GpuMemoryBufferImpl. | 36 // Returns the type of this GpuMemoryBufferImpl. |
| 36 gfx::GpuMemoryBufferType GetBufferType() const override; | 37 gfx::GpuMemoryBufferType GetBufferType() const override; |
| 37 scoped_refptr<ui::NativePixmap> GetNativePixmap() override; | 38 scoped_refptr<ui::NativePixmap> GetNativePixmap() override; |
| 38 | 39 |
| 39 // Create a NativeBuffer. The implementation (mus-specific) will call directly | 40 // Create a NativeBuffer. The implementation (mus-specific) will call directly |
| 40 // into ozone to allocate the buffer. See the version in the .cc file. | 41 // into ozone to allocate the buffer. See the version in the .cc file. |
| 41 static scoped_ptr<gfx::GpuMemoryBuffer> CreateOzoneGpuMemoryBuffer( | 42 static std::unique_ptr<gfx::GpuMemoryBuffer> CreateOzoneGpuMemoryBuffer( |
| 42 const gfx::Size& size, | 43 const gfx::Size& size, |
| 43 gfx::BufferFormat format, | 44 gfx::BufferFormat format, |
| 44 gfx::BufferUsage usage, | 45 gfx::BufferUsage usage, |
| 45 gfx::AcceleratedWidget widget); | 46 gfx::AcceleratedWidget widget); |
| 46 | 47 |
| 47 // Cribbed from content/common/gpu/client/gpu_memory_buffer_impl.h | 48 // Cribbed from content/common/gpu/client/gpu_memory_buffer_impl.h |
| 48 static OzoneGpuMemoryBuffer* FromClientBuffer(ClientBuffer buffer); | 49 static OzoneGpuMemoryBuffer* FromClientBuffer(ClientBuffer buffer); |
| 49 | 50 |
| 50 private: | 51 private: |
| 51 // TODO(rjkroege): It is conceivable that we do not need an |id| here. It | 52 // TODO(rjkroege): It is conceivable that we do not need an |id| here. It |
| 52 // would seem to be a legacy of content leaking into gfx. In a mojo context, | 53 // would seem to be a legacy of content leaking into gfx. In a mojo context, |
| 53 // perhaps it should be a mojo handle instead. | 54 // perhaps it should be a mojo handle instead. |
| 54 OzoneGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 55 OzoneGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| 55 const gfx::Size& size, | 56 const gfx::Size& size, |
| 56 gfx::BufferFormat format, | 57 gfx::BufferFormat format, |
| 57 scoped_ptr<ui::ClientNativePixmap> client_pixmap, | 58 std::unique_ptr<ui::ClientNativePixmap> client_pixmap, |
| 58 scoped_refptr<ui::NativePixmap> native_pixmap); | 59 scoped_refptr<ui::NativePixmap> native_pixmap); |
| 59 | 60 |
| 60 // The real backing buffer. | 61 // The real backing buffer. |
| 61 // From content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.h | 62 // From content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.h |
| 62 scoped_ptr<ui::ClientNativePixmap> client_pixmap_; | 63 std::unique_ptr<ui::ClientNativePixmap> client_pixmap_; |
| 63 scoped_refptr<ui::NativePixmap> native_pixmap_; | 64 scoped_refptr<ui::NativePixmap> native_pixmap_; |
| 64 | 65 |
| 65 DISALLOW_COPY_AND_ASSIGN(OzoneGpuMemoryBuffer); | 66 DISALLOW_COPY_AND_ASSIGN(OzoneGpuMemoryBuffer); |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 } // namespace mus | 69 } // namespace mus |
| 69 | 70 |
| 70 #endif // COMPONENTS_MUS_GLES2_OZONE_GPU_MEMORY_BUFFER_ | 71 #endif // COMPONENTS_MUS_GLES2_OZONE_GPU_MEMORY_BUFFER_ |
| OLD | NEW |