| 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 COMPONENTS_MUS_GLES2_MOJO_BUFFER_BACKING_H_ | 5 #ifndef COMPONENTS_MUS_GLES2_MOJO_BUFFER_BACKING_H_ |
| 6 #define COMPONENTS_MUS_GLES2_MOJO_BUFFER_BACKING_H_ | 6 #define COMPONENTS_MUS_GLES2_MOJO_BUFFER_BACKING_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 "gpu/command_buffer/common/buffer.h" | 13 #include "gpu/command_buffer/common/buffer.h" |
| 13 #include "mojo/public/cpp/system/core.h" | 14 #include "mojo/public/cpp/system/core.h" |
| 14 | 15 |
| 15 namespace mus { | 16 namespace mus { |
| 16 | 17 |
| 17 class MojoBufferBacking : public gpu::BufferBacking { | 18 class MojoBufferBacking : public gpu::BufferBacking { |
| 18 public: | 19 public: |
| 19 MojoBufferBacking(mojo::ScopedSharedBufferHandle handle, | 20 MojoBufferBacking(mojo::ScopedSharedBufferHandle handle, |
| 20 void* memory, | 21 void* memory, |
| 21 size_t size); | 22 size_t size); |
| 22 ~MojoBufferBacking() override; | 23 ~MojoBufferBacking() override; |
| 23 | 24 |
| 24 static scoped_ptr<gpu::BufferBacking> Create( | 25 static std::unique_ptr<gpu::BufferBacking> Create( |
| 25 mojo::ScopedSharedBufferHandle handle, | 26 mojo::ScopedSharedBufferHandle handle, |
| 26 size_t size); | 27 size_t size); |
| 27 | 28 |
| 28 void* GetMemory() const override; | 29 void* GetMemory() const override; |
| 29 size_t GetSize() const override; | 30 size_t GetSize() const override; |
| 30 | 31 |
| 31 private: | 32 private: |
| 32 mojo::ScopedSharedBufferHandle handle_; | 33 mojo::ScopedSharedBufferHandle handle_; |
| 33 void* memory_; | 34 void* memory_; |
| 34 size_t size_; | 35 size_t size_; |
| 35 | 36 |
| 36 DISALLOW_COPY_AND_ASSIGN(MojoBufferBacking); | 37 DISALLOW_COPY_AND_ASSIGN(MojoBufferBacking); |
| 37 }; | 38 }; |
| 38 | 39 |
| 39 } // namespace mus | 40 } // namespace mus |
| 40 | 41 |
| 41 #endif // COMPONENTS_MUS_GLES2_MOJO_BUFFER_BACKING_H_ | 42 #endif // COMPONENTS_MUS_GLES2_MOJO_BUFFER_BACKING_H_ |
| OLD | NEW |