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

Side by Side Diff: webkit/plugins/ppapi/ppb_flash_net_connector_impl.cc

Issue 6899055: PPAPI: Force async callback invocation option. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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
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 "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h" 5 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h"
6 6
7 #include "ppapi/c/pp_completion_callback.h" 7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/private/ppb_flash_net_connector.h" 8 #include "ppapi/c/private/ppb_flash_net_connector.h"
9 #include "webkit/plugins/ppapi/common.h" 9 #include "webkit/plugins/ppapi/common.h"
10 #include "webkit/plugins/ppapi/plugin_delegate.h" 10 #include "webkit/plugins/ppapi/plugin_delegate.h"
(...skipping 22 matching lines...) Expand all
33 int32_t ConnectTcp(PP_Resource connector_id, 33 int32_t ConnectTcp(PP_Resource connector_id,
34 const char* host, 34 const char* host,
35 uint16_t port, 35 uint16_t port,
36 PP_FileHandle* socket_out, 36 PP_FileHandle* socket_out,
37 PP_Flash_NetAddress* local_addr_out, 37 PP_Flash_NetAddress* local_addr_out,
38 PP_Flash_NetAddress* remote_addr_out, 38 PP_Flash_NetAddress* remote_addr_out,
39 PP_CompletionCallback callback) { 39 PP_CompletionCallback callback) {
40 scoped_refptr<PPB_Flash_NetConnector_Impl> connector( 40 scoped_refptr<PPB_Flash_NetConnector_Impl> connector(
41 Resource::GetAs<PPB_Flash_NetConnector_Impl>(connector_id)); 41 Resource::GetAs<PPB_Flash_NetConnector_Impl>(connector_id));
42 if (!connector.get()) 42 if (!connector.get())
43 return PP_ERROR_BADRESOURCE; 43 return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
44 44
45 return connector->ConnectTcp( 45 int32_t result = connector->ConnectTcp(
46 host, port, socket_out, local_addr_out, remote_addr_out, callback); 46 host, port, socket_out, local_addr_out, remote_addr_out, callback);
47 return MayForceCallback(callback, result);
47 } 48 }
48 49
49 int32_t ConnectTcpAddress(PP_Resource connector_id, 50 int32_t ConnectTcpAddress(PP_Resource connector_id,
50 const PP_Flash_NetAddress* addr, 51 const PP_Flash_NetAddress* addr,
51 PP_FileHandle* socket_out, 52 PP_FileHandle* socket_out,
52 PP_Flash_NetAddress* local_addr_out, 53 PP_Flash_NetAddress* local_addr_out,
53 PP_Flash_NetAddress* remote_addr_out, 54 PP_Flash_NetAddress* remote_addr_out,
54 PP_CompletionCallback callback) { 55 PP_CompletionCallback callback) {
55 scoped_refptr<PPB_Flash_NetConnector_Impl> connector( 56 scoped_refptr<PPB_Flash_NetConnector_Impl> connector(
56 Resource::GetAs<PPB_Flash_NetConnector_Impl>(connector_id)); 57 Resource::GetAs<PPB_Flash_NetConnector_Impl>(connector_id));
57 if (!connector.get()) 58 if (!connector.get())
58 return PP_ERROR_BADRESOURCE; 59 return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
59 60
60 return connector->ConnectTcpAddress( 61 int32_t result = connector->ConnectTcpAddress(
61 addr, socket_out, local_addr_out, remote_addr_out, callback); 62 addr, socket_out, local_addr_out, remote_addr_out, callback);
63 return MayForceCallback(callback, result);
62 } 64 }
63 65
64 const PPB_Flash_NetConnector ppb_flash_netconnector = { 66 const PPB_Flash_NetConnector ppb_flash_netconnector = {
65 &Create, 67 &Create,
66 &IsFlashNetConnector, 68 &IsFlashNetConnector,
67 &ConnectTcp, 69 &ConnectTcp,
68 &ConnectTcpAddress, 70 &ConnectTcpAddress,
69 }; 71 };
70 72
71 } // namespace 73 } // namespace
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // Wipe everything else out for safety. 197 // Wipe everything else out for safety.
196 socket_out_ = NULL; 198 socket_out_ = NULL;
197 local_addr_out_ = NULL; 199 local_addr_out_ = NULL;
198 remote_addr_out_ = NULL; 200 remote_addr_out_ = NULL;
199 201
200 callback->Run(rv); // Will complete abortively if necessary. 202 callback->Run(rv); // Will complete abortively if necessary.
201 } 203 }
202 204
203 } // namespace ppapi 205 } // namespace ppapi
204 } // namespace webkit 206 } // namespace webkit
205
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698