| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_RENDERER_PEPPER_PPB_BUFFER_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PPB_BUFFER_IMPL_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PPB_BUFFER_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PPB_BUFFER_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 11 |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/memory/shared_memory.h" | 14 #include "base/memory/shared_memory.h" |
| 14 #include "ppapi/shared_impl/resource.h" | 15 #include "ppapi/shared_impl/resource.h" |
| 15 #include "ppapi/thunk/ppb_buffer_api.h" | 16 #include "ppapi/thunk/ppb_buffer_api.h" |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 | 19 |
| 19 class PPB_Buffer_Impl : public ppapi::Resource, | 20 class PPB_Buffer_Impl : public ppapi::Resource, |
| 20 public ppapi::thunk::PPB_Buffer_API { | 21 public ppapi::thunk::PPB_Buffer_API { |
| 21 public: | 22 public: |
| 22 static PP_Resource Create(PP_Instance instance, uint32_t size); | 23 static PP_Resource Create(PP_Instance instance, uint32_t size); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 39 | 40 |
| 40 // Trusted. | 41 // Trusted. |
| 41 int32_t GetSharedMemory(base::SharedMemory** shm) override; | 42 int32_t GetSharedMemory(base::SharedMemory** shm) override; |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 ~PPB_Buffer_Impl() override; | 45 ~PPB_Buffer_Impl() override; |
| 45 | 46 |
| 46 explicit PPB_Buffer_Impl(PP_Instance instance); | 47 explicit PPB_Buffer_Impl(PP_Instance instance); |
| 47 bool Init(uint32_t size); | 48 bool Init(uint32_t size); |
| 48 | 49 |
| 49 scoped_ptr<base::SharedMemory> shared_memory_; | 50 std::unique_ptr<base::SharedMemory> shared_memory_; |
| 50 uint32_t size_; | 51 uint32_t size_; |
| 51 int map_count_; | 52 int map_count_; |
| 52 | 53 |
| 53 DISALLOW_COPY_AND_ASSIGN(PPB_Buffer_Impl); | 54 DISALLOW_COPY_AND_ASSIGN(PPB_Buffer_Impl); |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 // Ensures that the given buffer is mapped, and returns it to its previous | 57 // Ensures that the given buffer is mapped, and returns it to its previous |
| 57 // mapped state in the destructor. | 58 // mapped state in the destructor. |
| 58 class BufferAutoMapper { | 59 class BufferAutoMapper { |
| 59 public: | 60 public: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 71 | 72 |
| 72 void* data_; | 73 void* data_; |
| 73 uint32_t size_; | 74 uint32_t size_; |
| 74 | 75 |
| 75 DISALLOW_COPY_AND_ASSIGN(BufferAutoMapper); | 76 DISALLOW_COPY_AND_ASSIGN(BufferAutoMapper); |
| 76 }; | 77 }; |
| 77 | 78 |
| 78 } // namespace content | 79 } // namespace content |
| 79 | 80 |
| 80 #endif // CONTENT_RENDERER_PEPPER_PPB_BUFFER_IMPL_H_ | 81 #endif // CONTENT_RENDERER_PEPPER_PPB_BUFFER_IMPL_H_ |
| OLD | NEW |