| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
| 12 #include "ppapi/shared_impl/resource.h" | 12 #include "ppapi/shared_impl/resource.h" |
| 13 #include "ppapi/thunk/ppb_buffer_api.h" | 13 #include "ppapi/thunk/ppb_buffer_api.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 class PPB_Buffer_Impl : public ppapi::Resource, | 17 class PPB_Buffer_Impl : public ppapi::Resource, |
| 18 public ppapi::thunk::PPB_Buffer_API { | 18 public ppapi::thunk::PPB_Buffer_API { |
| 19 public: | 19 public: |
| 20 static PP_Resource Create(PP_Instance instance, uint32_t size); | 20 static PP_Resource Create(PP_Instance instance, uint32_t size); |
| 21 static scoped_refptr<PPB_Buffer_Impl> CreateResource(PP_Instance instance, | 21 static scoped_refptr<PPB_Buffer_Impl> CreateResource(PP_Instance instance, |
| 22 uint32_t size); | 22 uint32_t size); |
| 23 | 23 |
| 24 virtual PPB_Buffer_Impl* AsPPB_Buffer_Impl(); | 24 virtual PPB_Buffer_Impl* AsPPB_Buffer_Impl(); |
| 25 | 25 |
| 26 base::SharedMemory* shared_memory() const { return shared_memory_.get(); } | 26 base::SharedMemory* shared_memory() const { return shared_memory_.get(); } |
| 27 uint32_t size() const { return size_; } | 27 uint32_t size() const { return size_; } |
| 28 | 28 |
| 29 // Resource overrides. | 29 // Resource overrides. |
| 30 virtual ppapi::thunk::PPB_Buffer_API* AsPPB_Buffer_API() OVERRIDE; | 30 virtual ppapi::thunk::PPB_Buffer_API* AsPPB_Buffer_API() override; |
| 31 | 31 |
| 32 // PPB_Buffer_API implementation. | 32 // PPB_Buffer_API implementation. |
| 33 virtual PP_Bool Describe(uint32_t* size_in_bytes) OVERRIDE; | 33 virtual PP_Bool Describe(uint32_t* size_in_bytes) override; |
| 34 virtual PP_Bool IsMapped() OVERRIDE; | 34 virtual PP_Bool IsMapped() override; |
| 35 virtual void* Map() OVERRIDE; | 35 virtual void* Map() override; |
| 36 virtual void Unmap() OVERRIDE; | 36 virtual void Unmap() override; |
| 37 | 37 |
| 38 // Trusted. | 38 // Trusted. |
| 39 virtual int32_t GetSharedMemory(int* handle) OVERRIDE; | 39 virtual int32_t GetSharedMemory(int* handle) override; |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 virtual ~PPB_Buffer_Impl(); | 42 virtual ~PPB_Buffer_Impl(); |
| 43 | 43 |
| 44 explicit PPB_Buffer_Impl(PP_Instance instance); | 44 explicit PPB_Buffer_Impl(PP_Instance instance); |
| 45 bool Init(uint32_t size); | 45 bool Init(uint32_t size); |
| 46 | 46 |
| 47 scoped_ptr<base::SharedMemory> shared_memory_; | 47 scoped_ptr<base::SharedMemory> shared_memory_; |
| 48 uint32_t size_; | 48 uint32_t size_; |
| 49 int map_count_; | 49 int map_count_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 69 | 69 |
| 70 void* data_; | 70 void* data_; |
| 71 uint32_t size_; | 71 uint32_t size_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(BufferAutoMapper); | 73 DISALLOW_COPY_AND_ASSIGN(BufferAutoMapper); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 } // namespace content | 76 } // namespace content |
| 77 | 77 |
| 78 #endif // CONTENT_RENDERER_PEPPER_PPB_BUFFER_IMPL_H_ | 78 #endif // CONTENT_RENDERER_PEPPER_PPB_BUFFER_IMPL_H_ |
| OLD | NEW |