Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: ppapi/proxy/ppb_flash_net_connector_proxy.cc

Issue 6899055: PPAPI: Force async callback invocation option. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_flash_menu_proxy.cc ('k') | ppapi/proxy/ppb_graphics_2d_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 instance, 258 instance,
259 enter.functions()->CreateFlashNetConnector(instance)); 259 enter.functions()->CreateFlashNetConnector(instance));
260 } 260 }
261 } 261 }
262 262
263 void PPB_Flash_NetConnector_Proxy::OnMsgConnectTcp( 263 void PPB_Flash_NetConnector_Proxy::OnMsgConnectTcp(
264 const HostResource& resource, 264 const HostResource& resource,
265 const std::string& host, 265 const std::string& host,
266 uint16_t port) { 266 uint16_t port) {
267 ConnectCallbackInfo* info = new ConnectCallbackInfo(resource); 267 ConnectCallbackInfo* info = new ConnectCallbackInfo(resource);
268 CompletionCallback callback = callback_factory_.NewCallback( 268 CompletionCallback callback = callback_factory_.NewOptionalCallback(
269 &PPB_Flash_NetConnector_Proxy::OnCompleteCallbackInHost, info); 269 &PPB_Flash_NetConnector_Proxy::OnCompleteCallbackInHost, info);
270 270
271 EnterHostFromHostResource<PPB_Flash_NetConnector_API> enter(resource); 271 EnterHostFromHostResource<PPB_Flash_NetConnector_API> enter(resource);
272 int32_t result = PP_ERROR_BADRESOURCE; 272 int32_t result = PP_ERROR_BADRESOURCE;
273 if (enter.succeeded()) { 273 if (enter.succeeded()) {
274 result = enter.object()->ConnectTcp( 274 result = enter.object()->ConnectTcp(
275 host.c_str(), port, &info->handle, &info->local_addr, 275 host.c_str(), port, &info->handle, &info->local_addr,
276 &info->remote_addr, callback.pp_completion_callback()); 276 &info->remote_addr, callback.pp_completion_callback());
277 } 277 }
278 if (result != PP_OK_COMPLETIONPENDING) 278 if (result != PP_OK_COMPLETIONPENDING)
279 OnCompleteCallbackInHost(result, info); 279 OnCompleteCallbackInHost(result, info);
280 } 280 }
281 281
282 void PPB_Flash_NetConnector_Proxy::OnMsgConnectTcpAddress( 282 void PPB_Flash_NetConnector_Proxy::OnMsgConnectTcpAddress(
283 const HostResource& resource, 283 const HostResource& resource,
284 const std::string& net_address_as_string) { 284 const std::string& net_address_as_string) {
285 ConnectCallbackInfo* info = new ConnectCallbackInfo(resource); 285 ConnectCallbackInfo* info = new ConnectCallbackInfo(resource);
286 CompletionCallback callback = callback_factory_.NewCallback( 286 CompletionCallback callback = callback_factory_.NewOptionalCallback(
287 &PPB_Flash_NetConnector_Proxy::OnCompleteCallbackInHost, info); 287 &PPB_Flash_NetConnector_Proxy::OnCompleteCallbackInHost, info);
288 288
289 PP_Flash_NetAddress net_address; 289 PP_Flash_NetAddress net_address;
290 StringToNetAddress(net_address_as_string, &net_address); 290 StringToNetAddress(net_address_as_string, &net_address);
291 291
292 EnterHostFromHostResource<PPB_Flash_NetConnector_API> enter(resource); 292 EnterHostFromHostResource<PPB_Flash_NetConnector_API> enter(resource);
293 int32_t result = PP_ERROR_BADRESOURCE; 293 int32_t result = PP_ERROR_BADRESOURCE;
294 if (enter.succeeded()) { 294 if (enter.succeeded()) {
295 result = enter.object()->ConnectTcpAddress( 295 result = enter.object()->ConnectTcpAddress(
296 &net_address, &info->handle, &info->local_addr, &info->remote_addr, 296 &net_address, &info->handle, &info->local_addr, &info->remote_addr,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 } else { 336 } else {
337 dispatcher()->Send(new PpapiMsg_PPBFlashNetConnector_ConnectACK( 337 dispatcher()->Send(new PpapiMsg_PPBFlashNetConnector_ConnectACK(
338 INTERFACE_ID_PPB_FLASH_NETCONNECTOR, 338 INTERFACE_ID_PPB_FLASH_NETCONNECTOR,
339 info->resource, result, 339 info->resource, result,
340 IPC::InvalidPlatformFileForTransit(), std::string(), std::string())); 340 IPC::InvalidPlatformFileForTransit(), std::string(), std::string()));
341 } 341 }
342 } 342 }
343 343
344 } // namespace proxy 344 } // namespace proxy
345 } // namespace pp 345 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_flash_menu_proxy.cc ('k') | ppapi/proxy/ppb_graphics_2d_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698