| 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 PPAPI_PPB_BUFFER_PROXY_H_ | 5 #ifndef PPAPI_PPB_BUFFER_PROXY_H_ |
| 6 #define PPAPI_PPB_BUFFER_PROXY_H_ | 6 #define PPAPI_PPB_BUFFER_PROXY_H_ |
| 7 | 7 |
| 8 #include "base/shared_memory.h" | 8 #include "base/shared_memory.h" |
| 9 #include "ppapi/c/pp_instance.h" | 9 #include "ppapi/c/pp_instance.h" |
| 10 #include "ppapi/proxy/interface_proxy.h" | 10 #include "ppapi/proxy/interface_proxy.h" |
| 11 #include "ppapi/proxy/plugin_resource.h" | 11 #include "ppapi/proxy/plugin_resource.h" |
| 12 #include "ppapi/thunk/ppb_buffer_api.h" | 12 #include "ppapi/thunk/ppb_buffer_api.h" |
| 13 | 13 |
| 14 struct PPB_Buffer_Dev; | 14 struct PPB_Buffer_Dev; |
| 15 | 15 |
| 16 namespace ppapi { |
| 17 class HostResource; |
| 18 } |
| 19 |
| 16 namespace pp { | 20 namespace pp { |
| 17 namespace proxy { | 21 namespace proxy { |
| 18 | 22 |
| 19 class HostResource; | |
| 20 | |
| 21 class Buffer : public ppapi::thunk::PPB_Buffer_API, | 23 class Buffer : public ppapi::thunk::PPB_Buffer_API, |
| 22 public PluginResource { | 24 public PluginResource { |
| 23 public: | 25 public: |
| 24 Buffer(const HostResource& resource, | 26 Buffer(const ppapi::HostResource& resource, |
| 25 const base::SharedMemoryHandle& shm_handle, | 27 const base::SharedMemoryHandle& shm_handle, |
| 26 uint32_t size); | 28 uint32_t size); |
| 27 virtual ~Buffer(); | 29 virtual ~Buffer(); |
| 28 | 30 |
| 29 // ResourceObjectBase overrides. | 31 // ResourceObjectBase overrides. |
| 30 virtual ppapi::thunk::PPB_Buffer_API* AsPPB_Buffer_API() OVERRIDE; | 32 virtual ppapi::thunk::PPB_Buffer_API* AsPPB_Buffer_API() OVERRIDE; |
| 31 | 33 |
| 32 // PPB_Buffer_API implementation. | 34 // PPB_Buffer_API implementation. |
| 33 virtual PP_Bool Describe(uint32_t* size_in_bytes) OVERRIDE; | 35 virtual PP_Bool Describe(uint32_t* size_in_bytes) OVERRIDE; |
| 34 virtual PP_Bool IsMapped() OVERRIDE; | 36 virtual PP_Bool IsMapped() OVERRIDE; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 46 | 48 |
| 47 class PPB_Buffer_Proxy : public InterfaceProxy { | 49 class PPB_Buffer_Proxy : public InterfaceProxy { |
| 48 public: | 50 public: |
| 49 PPB_Buffer_Proxy(Dispatcher* dispatcher, const void* target_interface); | 51 PPB_Buffer_Proxy(Dispatcher* dispatcher, const void* target_interface); |
| 50 virtual ~PPB_Buffer_Proxy(); | 52 virtual ~PPB_Buffer_Proxy(); |
| 51 | 53 |
| 52 static const Info* GetInfo(); | 54 static const Info* GetInfo(); |
| 53 | 55 |
| 54 static PP_Resource CreateProxyResource(PP_Instance instance, | 56 static PP_Resource CreateProxyResource(PP_Instance instance, |
| 55 uint32_t size); | 57 uint32_t size); |
| 56 static PP_Resource AddProxyResource(const HostResource& resource, | 58 static PP_Resource AddProxyResource(const ppapi::HostResource& resource, |
| 57 base::SharedMemoryHandle shm_handle, | 59 base::SharedMemoryHandle shm_handle, |
| 58 uint32_t size); | 60 uint32_t size); |
| 59 | 61 |
| 60 const PPB_Buffer_Dev* ppb_buffer_target() const { | 62 const PPB_Buffer_Dev* ppb_buffer_target() const { |
| 61 return static_cast<const PPB_Buffer_Dev*>(target_interface()); | 63 return static_cast<const PPB_Buffer_Dev*>(target_interface()); |
| 62 } | 64 } |
| 63 | 65 |
| 64 // InterfaceProxy implementation. | 66 // InterfaceProxy implementation. |
| 65 virtual bool OnMessageReceived(const IPC::Message& msg); | 67 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 66 | 68 |
| 67 private: | 69 private: |
| 68 // Message handlers. | 70 // Message handlers. |
| 69 void OnMsgCreate(PP_Instance instance, | 71 void OnMsgCreate(PP_Instance instance, |
| 70 uint32_t size, | 72 uint32_t size, |
| 71 HostResource* result_resource, | 73 ppapi::HostResource* result_resource, |
| 72 base::SharedMemoryHandle* result_shm_handle); | 74 base::SharedMemoryHandle* result_shm_handle); |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 } // namespace proxy | 77 } // namespace proxy |
| 76 } // namespace pp | 78 } // namespace pp |
| 77 | 79 |
| 78 #endif // PPAPI_PPB_BUFFER_PROXY_H_ | 80 #endif // PPAPI_PPB_BUFFER_PROXY_H_ |
| OLD | NEW |