| 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/c/pp_completion_callback.h" | 5 #include "ppapi/c/pp_completion_callback.h" |
| 6 #include "ppapi/c/pp_errors.h" | 6 #include "ppapi/c/pp_errors.h" |
| 7 #include "ppapi/c/private/ppb_flash_tcp_socket.h" | 7 #include "ppapi/c/private/ppb_flash_tcp_socket.h" |
| 8 #include "ppapi/thunk/common.h" | 8 #include "ppapi/thunk/common.h" |
| 9 #include "ppapi/thunk/enter.h" | 9 #include "ppapi/thunk/enter.h" |
| 10 #include "ppapi/thunk/thunk.h" | 10 #include "ppapi/thunk/thunk.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 uint16_t port, | 33 uint16_t port, |
| 34 PP_CompletionCallback callback) { | 34 PP_CompletionCallback callback) { |
| 35 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true); | 35 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true); |
| 36 if (enter.failed()) | 36 if (enter.failed()) |
| 37 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); | 37 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); |
| 38 int32_t result = enter.object()->Connect(host, port, callback); | 38 int32_t result = enter.object()->Connect(host, port, callback); |
| 39 return MayForceCallback(callback, result); | 39 return MayForceCallback(callback, result); |
| 40 } | 40 } |
| 41 | 41 |
| 42 int32_t ConnectWithNetAddress(PP_Resource tcp_socket, | 42 int32_t ConnectWithNetAddress(PP_Resource tcp_socket, |
| 43 const PP_Flash_NetAddress* addr, | 43 const PP_NetAddress_Private* addr, |
| 44 PP_CompletionCallback callback) { | 44 PP_CompletionCallback callback) { |
| 45 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true); | 45 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true); |
| 46 if (enter.failed()) | 46 if (enter.failed()) |
| 47 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); | 47 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); |
| 48 int32_t result = enter.object()->ConnectWithNetAddress(addr, callback); | 48 int32_t result = enter.object()->ConnectWithNetAddress(addr, callback); |
| 49 return MayForceCallback(callback, result); | 49 return MayForceCallback(callback, result); |
| 50 } | 50 } |
| 51 | 51 |
| 52 PP_Bool GetLocalAddress(PP_Resource tcp_socket, | 52 PP_Bool GetLocalAddress(PP_Resource tcp_socket, |
| 53 PP_Flash_NetAddress* local_addr) { | 53 PP_NetAddress_Private* local_addr) { |
| 54 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true); | 54 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true); |
| 55 if (enter.failed()) | 55 if (enter.failed()) |
| 56 return PP_FALSE; | 56 return PP_FALSE; |
| 57 return enter.object()->GetLocalAddress(local_addr); | 57 return enter.object()->GetLocalAddress(local_addr); |
| 58 } | 58 } |
| 59 | 59 |
| 60 PP_Bool GetRemoteAddress(PP_Resource tcp_socket, | 60 PP_Bool GetRemoteAddress(PP_Resource tcp_socket, |
| 61 PP_Flash_NetAddress* remote_addr) { | 61 PP_NetAddress_Private* remote_addr) { |
| 62 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true); | 62 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true); |
| 63 if (enter.failed()) | 63 if (enter.failed()) |
| 64 return PP_FALSE; | 64 return PP_FALSE; |
| 65 return enter.object()->GetRemoteAddress(remote_addr); | 65 return enter.object()->GetRemoteAddress(remote_addr); |
| 66 } | 66 } |
| 67 | 67 |
| 68 int32_t SSLHandshake(PP_Resource tcp_socket, | 68 int32_t SSLHandshake(PP_Resource tcp_socket, |
| 69 const char* server_name, | 69 const char* server_name, |
| 70 uint16_t server_port, | 70 uint16_t server_port, |
| 71 PP_CompletionCallback callback) { | 71 PP_CompletionCallback callback) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 } // namespace | 121 } // namespace |
| 122 | 122 |
| 123 const PPB_Flash_TCPSocket* GetPPB_Flash_TCPSocket_Thunk() { | 123 const PPB_Flash_TCPSocket* GetPPB_Flash_TCPSocket_Thunk() { |
| 124 return &g_ppb_flash_tcp_socket_thunk; | 124 return &g_ppb_flash_tcp_socket_thunk; |
| 125 } | 125 } |
| 126 | 126 |
| 127 } // namespace thunk | 127 } // namespace thunk |
| 128 } // namespace ppapi | 128 } // namespace ppapi |
| 129 | 129 |
| OLD | NEW |