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