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 #include "ppapi/proxy/ppb_flash_net_connector_proxy.h" | 5 #include "ppapi/proxy/ppb_flash_net_connector_proxy.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 #include "ppapi/c/private/ppb_flash_net_connector.h" | 10 #include "ppapi/c/private/ppb_flash_net_connector.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 181 |
182 HostResource resource; | 182 HostResource resource; |
183 | 183 |
184 PP_FileHandle handle; | 184 PP_FileHandle handle; |
185 PP_Flash_NetAddress local_addr; | 185 PP_Flash_NetAddress local_addr; |
186 PP_Flash_NetAddress remote_addr; | 186 PP_Flash_NetAddress remote_addr; |
187 }; | 187 }; |
188 | 188 |
189 namespace { | 189 namespace { |
190 | 190 |
191 InterfaceProxy* CreateFlashNetConnectorProxy(Dispatcher* dispatcher) { | 191 InterfaceProxy* CreateFlashNetConnectorProxy(Dispatcher* dispatcher, |
192 return new PPB_Flash_NetConnector_Proxy(dispatcher); | 192 const void* target_interface) { |
| 193 return new PPB_Flash_NetConnector_Proxy(dispatcher, target_interface); |
193 } | 194 } |
194 | 195 |
195 } // namespace | 196 } // namespace |
196 | 197 |
197 PPB_Flash_NetConnector_Proxy::PPB_Flash_NetConnector_Proxy( | 198 PPB_Flash_NetConnector_Proxy::PPB_Flash_NetConnector_Proxy( |
198 Dispatcher* dispatcher) | 199 Dispatcher* dispatcher, const void* target_interface) |
199 : InterfaceProxy(dispatcher), | 200 : InterfaceProxy(dispatcher, target_interface), |
200 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 201 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
201 } | 202 } |
202 | 203 |
203 PPB_Flash_NetConnector_Proxy::~PPB_Flash_NetConnector_Proxy() { | 204 PPB_Flash_NetConnector_Proxy::~PPB_Flash_NetConnector_Proxy() { |
204 } | 205 } |
205 | 206 |
206 // static | 207 // static |
207 const InterfaceProxy::Info* PPB_Flash_NetConnector_Proxy::GetInfo() { | 208 const InterfaceProxy::Info* PPB_Flash_NetConnector_Proxy::GetInfo() { |
208 static const Info info = { | 209 static const Info info = { |
209 ppapi::thunk::GetPPB_Flash_NetConnector_Thunk(), | 210 ppapi::thunk::GetPPB_Flash_NetConnector_Thunk(), |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 OnMsgConnectTcpAddress) | 242 OnMsgConnectTcpAddress) |
242 IPC_MESSAGE_HANDLER(PpapiMsg_PPBFlashNetConnector_ConnectACK, | 243 IPC_MESSAGE_HANDLER(PpapiMsg_PPBFlashNetConnector_ConnectACK, |
243 OnMsgConnectACK) | 244 OnMsgConnectACK) |
244 IPC_MESSAGE_UNHANDLED(handled = false) | 245 IPC_MESSAGE_UNHANDLED(handled = false) |
245 IPC_END_MESSAGE_MAP() | 246 IPC_END_MESSAGE_MAP() |
246 return handled; | 247 return handled; |
247 } | 248 } |
248 | 249 |
249 void PPB_Flash_NetConnector_Proxy::OnMsgCreate(PP_Instance instance, | 250 void PPB_Flash_NetConnector_Proxy::OnMsgCreate(PP_Instance instance, |
250 HostResource* result) { | 251 HostResource* result) { |
251 thunk::EnterResourceCreation enter(instance); | 252 EnterFunctionNoLock<ResourceCreationAPI> enter(instance, true); |
252 if (enter.succeeded()) { | 253 if (enter.succeeded()) { |
253 result->SetHostResource( | 254 result->SetHostResource( |
254 instance, | 255 instance, |
255 enter.functions()->CreateFlashNetConnector(instance)); | 256 enter.functions()->CreateFlashNetConnector(instance)); |
256 } | 257 } |
257 } | 258 } |
258 | 259 |
259 void PPB_Flash_NetConnector_Proxy::OnMsgConnectTcp( | 260 void PPB_Flash_NetConnector_Proxy::OnMsgConnectTcp( |
260 const HostResource& resource, | 261 const HostResource& resource, |
261 const std::string& host, | 262 const std::string& host, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 } else { | 333 } else { |
333 dispatcher()->Send(new PpapiMsg_PPBFlashNetConnector_ConnectACK( | 334 dispatcher()->Send(new PpapiMsg_PPBFlashNetConnector_ConnectACK( |
334 INTERFACE_ID_PPB_FLASH_NETCONNECTOR, | 335 INTERFACE_ID_PPB_FLASH_NETCONNECTOR, |
335 info->resource, result, | 336 info->resource, result, |
336 IPC::InvalidPlatformFileForTransit(), std::string(), std::string())); | 337 IPC::InvalidPlatformFileForTransit(), std::string(), std::string())); |
337 } | 338 } |
338 } | 339 } |
339 | 340 |
340 } // namespace proxy | 341 } // namespace proxy |
341 } // namespace ppapi | 342 } // namespace ppapi |
OLD | NEW |