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" |
(...skipping 28 matching lines...) Expand all Loading... |
39 base::SharedMemory shm_; | 39 base::SharedMemory shm_; |
40 uint32_t size_; | 40 uint32_t size_; |
41 void* mapped_data_; | 41 void* mapped_data_; |
42 int map_count_; | 42 int map_count_; |
43 | 43 |
44 DISALLOW_COPY_AND_ASSIGN(Buffer); | 44 DISALLOW_COPY_AND_ASSIGN(Buffer); |
45 }; | 45 }; |
46 | 46 |
47 class PPB_Buffer_Proxy : public InterfaceProxy { | 47 class PPB_Buffer_Proxy : public InterfaceProxy { |
48 public: | 48 public: |
49 PPB_Buffer_Proxy(Dispatcher* dispatcher); | 49 PPB_Buffer_Proxy(Dispatcher* dispatcher, const void* target_interface); |
50 virtual ~PPB_Buffer_Proxy(); | 50 virtual ~PPB_Buffer_Proxy(); |
51 | 51 |
| 52 static const Info* GetInfo(); |
| 53 |
52 static PP_Resource CreateProxyResource(PP_Instance instance, | 54 static PP_Resource CreateProxyResource(PP_Instance instance, |
53 uint32_t size); | 55 uint32_t size); |
54 static PP_Resource AddProxyResource(const HostResource& resource, | 56 static PP_Resource AddProxyResource(const HostResource& resource, |
55 base::SharedMemoryHandle shm_handle, | 57 base::SharedMemoryHandle shm_handle, |
56 uint32_t size); | 58 uint32_t size); |
57 | 59 |
| 60 const PPB_Buffer_Dev* ppb_buffer_target() const { |
| 61 return static_cast<const PPB_Buffer_Dev*>(target_interface()); |
| 62 } |
| 63 |
58 // InterfaceProxy implementation. | 64 // InterfaceProxy implementation. |
59 virtual bool OnMessageReceived(const IPC::Message& msg); | 65 virtual bool OnMessageReceived(const IPC::Message& msg); |
60 | 66 |
61 static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_BUFFER; | |
62 | |
63 private: | 67 private: |
64 // Message handlers. | 68 // Message handlers. |
65 void OnMsgCreate(PP_Instance instance, | 69 void OnMsgCreate(PP_Instance instance, |
66 uint32_t size, | 70 uint32_t size, |
67 HostResource* result_resource, | 71 HostResource* result_resource, |
68 base::SharedMemoryHandle* result_shm_handle); | 72 base::SharedMemoryHandle* result_shm_handle); |
69 }; | 73 }; |
70 | 74 |
71 } // namespace proxy | 75 } // namespace proxy |
72 } // namespace ppapi | 76 } // namespace ppapi |
73 | 77 |
74 #endif // PPAPI_PPB_BUFFER_PROXY_H_ | 78 #endif // PPAPI_PPB_BUFFER_PROXY_H_ |
OLD | NEW |