Chromium Code Reviews| 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 WEBKIT_PLUGINS_PPAPI_PPB_BUFFER_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_BUFFER_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_BUFFER_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_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/shared_memory.h" | 11 #include "base/shared_memory.h" |
| 12 #include "ppapi/thunk/ppb_buffer_api.h" | 12 #include "ppapi/thunk/ppb_buffer_api.h" |
| 13 #include "ppapi/thunk/ppb_buffer_trusted_api.h" | 13 #include "ppapi/thunk/ppb_buffer_trusted_api.h" |
| 14 #include "ppapi/shared_impl/resource.h" | 14 #include "ppapi/shared_impl/resource.h" |
| 15 #include "webkit/plugins/webkit_plugins_export.h" | 15 #include "webkit/plugins/webkit_plugins_export.h" |
| 16 | 16 |
| 17 namespace webkit { | 17 namespace webkit { |
| 18 namespace ppapi { | 18 namespace ppapi { |
| 19 | 19 |
| 20 class WEBKIT_PLUGINS_EXPORT PPB_Buffer_Impl : | 20 class WEBKIT_PLUGINS_EXPORT PPB_Buffer_Impl : |
| 21 public ::ppapi::Resource, | 21 public ::ppapi::Resource, |
| 22 public ::ppapi::thunk::PPB_Buffer_API, | 22 public ::ppapi::thunk::PPB_Buffer_API { |
| 23 public ::ppapi::thunk::PPB_BufferTrusted_API { | |
| 24 public: | 23 public: |
| 25 virtual ~PPB_Buffer_Impl(); | 24 virtual ~PPB_Buffer_Impl(); |
| 26 | 25 |
| 27 static PP_Resource Create(PP_Instance instance, uint32_t size); | 26 static PP_Resource Create(PP_Instance instance, uint32_t size); |
| 28 static scoped_refptr<PPB_Buffer_Impl> CreateResource(PP_Instance instance, | 27 static scoped_refptr<PPB_Buffer_Impl> CreateResource(PP_Instance instance, |
| 29 uint32_t size); | 28 uint32_t size); |
| 30 | 29 |
| 31 virtual PPB_Buffer_Impl* AsPPB_Buffer_Impl(); | 30 virtual PPB_Buffer_Impl* AsPPB_Buffer_Impl(); |
| 32 | 31 |
| 33 base::SharedMemory* shared_memory() const { return shared_memory_.get(); } | 32 base::SharedMemory* shared_memory() const { return shared_memory_.get(); } |
| 34 uint32_t size() const { return size_; } | 33 uint32_t size() const { return size_; } |
| 35 | 34 |
| 36 // Resource overrides. | 35 // Resource overrides. |
| 37 virtual ::ppapi::thunk::PPB_Buffer_API* AsPPB_Buffer_API() OVERRIDE; | 36 virtual ::ppapi::thunk::PPB_Buffer_API* AsPPB_Buffer_API() OVERRIDE; |
| 38 virtual ::ppapi::thunk::PPB_BufferTrusted_API* AsPPB_BufferTrusted_API(); | |
| 39 | 37 |
| 40 // PPB_Buffer_API implementation. | 38 // PPB_Buffer_API implementation. |
| 41 virtual PP_Bool Describe(uint32_t* size_in_bytes) OVERRIDE; | 39 virtual PP_Bool Describe(uint32_t* size_in_bytes) OVERRIDE; |
| 42 virtual PP_Bool IsMapped() OVERRIDE; | 40 virtual PP_Bool IsMapped() OVERRIDE; |
| 43 virtual void* Map() OVERRIDE; | 41 virtual void* Map() OVERRIDE; |
| 44 virtual void Unmap() OVERRIDE; | 42 virtual void Unmap() OVERRIDE; |
| 45 | |
| 46 // PPB_BufferTrusted_API implementation. | |
|
dmichael (off chromium)
2013/03/20 16:50:37
I think it's worth still commenting that this is T
teravest
2013/03/20 17:03:27
Done.
| |
| 47 virtual int32_t GetSharedMemory(int* handle) OVERRIDE; | 43 virtual int32_t GetSharedMemory(int* handle) OVERRIDE; |
| 48 | 44 |
| 49 private: | 45 private: |
| 50 explicit PPB_Buffer_Impl(PP_Instance instance); | 46 explicit PPB_Buffer_Impl(PP_Instance instance); |
| 51 bool Init(uint32_t size); | 47 bool Init(uint32_t size); |
| 52 | 48 |
| 53 scoped_ptr<base::SharedMemory> shared_memory_; | 49 scoped_ptr<base::SharedMemory> shared_memory_; |
| 54 uint32_t size_; | 50 uint32_t size_; |
| 55 int map_count_; | 51 int map_count_; |
| 56 | 52 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 76 void* data_; | 72 void* data_; |
| 77 uint32_t size_; | 73 uint32_t size_; |
| 78 | 74 |
| 79 DISALLOW_COPY_AND_ASSIGN(BufferAutoMapper); | 75 DISALLOW_COPY_AND_ASSIGN(BufferAutoMapper); |
| 80 }; | 76 }; |
| 81 | 77 |
| 82 } // namespace ppapi | 78 } // namespace ppapi |
| 83 } // namespace webkit | 79 } // namespace webkit |
| 84 | 80 |
| 85 #endif // WEBKIT_PLUGINS_PPAPI_PPB_BUFFER_IMPL_H_ | 81 #endif // WEBKIT_PLUGINS_PPAPI_PPB_BUFFER_IMPL_H_ |
| OLD | NEW |