| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_MOJO_GPU_MEMORY_BUFFER_H_ | 5 #ifndef COMPONENTS_MUS_GLES2_MOJO_GPU_MEMORY_BUFFER_H_ |
| 6 #define COMPONENTS_MUS_GLES2_MOJO_GPU_MEMORY_BUFFER_H_ | 6 #define COMPONENTS_MUS_GLES2_MOJO_GPU_MEMORY_BUFFER_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 "base/memory/scoped_ptr.h" | |
| 12 #include "components/mus/gles2/gpu_memory_buffer_impl.h" | 13 #include "components/mus/gles2/gpu_memory_buffer_impl.h" |
| 13 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
| 14 #include "ui/gfx/gpu_memory_buffer.h" | 15 #include "ui/gfx/gpu_memory_buffer.h" |
| 15 | 16 |
| 16 namespace mus { | 17 namespace mus { |
| 17 | 18 |
| 18 class MojoGpuMemoryBufferImpl : public mus::GpuMemoryBufferImpl { | 19 class MojoGpuMemoryBufferImpl : public mus::GpuMemoryBufferImpl { |
| 19 public: | 20 public: |
| 20 MojoGpuMemoryBufferImpl(const gfx::Size& size, | 21 MojoGpuMemoryBufferImpl(const gfx::Size& size, |
| 21 gfx::BufferFormat format, | 22 gfx::BufferFormat format, |
| 22 scoped_ptr<base::SharedMemory> shared_memory); | 23 std::unique_ptr<base::SharedMemory> shared_memory); |
| 23 ~MojoGpuMemoryBufferImpl() override; | 24 ~MojoGpuMemoryBufferImpl() override; |
| 24 | 25 |
| 25 static scoped_ptr<gfx::GpuMemoryBuffer> Create(const gfx::Size& size, | 26 static std::unique_ptr<gfx::GpuMemoryBuffer> Create(const gfx::Size& size, |
| 26 gfx::BufferFormat format, | 27 gfx::BufferFormat format, |
| 27 gfx::BufferUsage usage); | 28 gfx::BufferUsage usage); |
| 28 | 29 |
| 29 static MojoGpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer); | 30 static MojoGpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer); |
| 30 | 31 |
| 31 const unsigned char* GetMemory() const; | 32 const unsigned char* GetMemory() const; |
| 32 | 33 |
| 33 // Overridden from gfx::GpuMemoryBuffer: | 34 // Overridden from gfx::GpuMemoryBuffer: |
| 34 bool Map() override; | 35 bool Map() override; |
| 35 void* memory(size_t plane) override; | 36 void* memory(size_t plane) override; |
| 36 void Unmap() override; | 37 void Unmap() override; |
| 37 int stride(size_t plane) const override; | 38 int stride(size_t plane) const override; |
| 38 gfx::GpuMemoryBufferHandle GetHandle() const override; | 39 gfx::GpuMemoryBufferHandle GetHandle() const override; |
| 39 | 40 |
| 40 // Overridden from gfx::GpuMemoryBufferImpl | 41 // Overridden from gfx::GpuMemoryBufferImpl |
| 41 gfx::GpuMemoryBufferType GetBufferType() const override; | 42 gfx::GpuMemoryBufferType GetBufferType() const override; |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 scoped_ptr<base::SharedMemory> shared_memory_; | 45 std::unique_ptr<base::SharedMemory> shared_memory_; |
| 45 | 46 |
| 46 DISALLOW_COPY_AND_ASSIGN(MojoGpuMemoryBufferImpl); | 47 DISALLOW_COPY_AND_ASSIGN(MojoGpuMemoryBufferImpl); |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 } // namespace mus | 50 } // namespace mus |
| 50 | 51 |
| 51 #endif // COMPONENTS_MUS_GLES2_MOJO_GPU_MEMORY_BUFFER_H_ | 52 #endif // COMPONENTS_MUS_GLES2_MOJO_GPU_MEMORY_BUFFER_H_ |
| OLD | NEW |