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