OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_udp_socket_private.h" | 7 #include "ppapi/c/private/ppb_udp_socket_private.h" |
8 #include "ppapi/shared_impl/tracked_callback.h" | 8 #include "ppapi/shared_impl/tracked_callback.h" |
9 #include "ppapi/thunk/enter.h" | 9 #include "ppapi/thunk/enter.h" |
10 #include "ppapi/thunk/ppb_udp_socket_private_api.h" | 10 #include "ppapi/thunk/ppb_udp_socket_private_api.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 if (enter.failed()) | 23 if (enter.failed()) |
24 return 0; | 24 return 0; |
25 return enter.functions()->CreateUDPSocketPrivate(instance); | 25 return enter.functions()->CreateUDPSocketPrivate(instance); |
26 } | 26 } |
27 | 27 |
28 PP_Bool IsUDPSocket(PP_Resource resource) { | 28 PP_Bool IsUDPSocket(PP_Resource resource) { |
29 EnterUDP enter(resource, false); | 29 EnterUDP enter(resource, false); |
30 return PP_FromBool(enter.succeeded()); | 30 return PP_FromBool(enter.succeeded()); |
31 } | 31 } |
32 | 32 |
| 33 int32_t SetSocketFeature(PP_Resource udp_socket, |
| 34 PP_UDPSocketFeature_Private name, |
| 35 PP_Var value, |
| 36 PP_CompletionCallback callback) { |
| 37 EnterUDP enter(udp_socket, callback, true); |
| 38 if (enter.failed()) |
| 39 return enter.retval(); |
| 40 return enter.SetResult( |
| 41 enter.object()->SetSocketFeature(name, value, enter.callback())); |
| 42 } |
| 43 |
33 int32_t Bind(PP_Resource udp_socket, | 44 int32_t Bind(PP_Resource udp_socket, |
34 const PP_NetAddress_Private *addr, | 45 const PP_NetAddress_Private *addr, |
35 PP_CompletionCallback callback) { | 46 PP_CompletionCallback callback) { |
36 EnterUDP enter(udp_socket, callback, true); | 47 EnterUDP enter(udp_socket, callback, true); |
37 if (enter.failed()) | 48 if (enter.failed()) |
38 return enter.retval(); | 49 return enter.retval(); |
39 return enter.SetResult(enter.object()->Bind(addr, enter.callback())); | 50 return enter.SetResult(enter.object()->Bind(addr, enter.callback())); |
40 } | 51 } |
41 | 52 |
42 PP_Bool GetBoundAddress(PP_Resource udp_socket, | 53 PP_Bool GetBoundAddress(PP_Resource udp_socket, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 &Create, | 113 &Create, |
103 &IsUDPSocket, | 114 &IsUDPSocket, |
104 &Bind, | 115 &Bind, |
105 &GetBoundAddress, | 116 &GetBoundAddress, |
106 &RecvFrom, | 117 &RecvFrom, |
107 &GetRecvFromAddress, | 118 &GetRecvFromAddress, |
108 &SendTo, | 119 &SendTo, |
109 &Close | 120 &Close |
110 }; | 121 }; |
111 | 122 |
| 123 const PPB_UDPSocket_Private_0_4 g_ppb_udp_socket_thunk_0_4 = { |
| 124 &Create, |
| 125 &IsUDPSocket, |
| 126 &SetSocketFeature, |
| 127 &Bind, |
| 128 &GetBoundAddress, |
| 129 &RecvFrom, |
| 130 &GetRecvFromAddress, |
| 131 &SendTo, |
| 132 &Close |
| 133 }; |
| 134 |
112 } // namespace | 135 } // namespace |
113 | 136 |
114 const PPB_UDPSocket_Private_0_2* GetPPB_UDPSocket_Private_0_2_Thunk() { | 137 const PPB_UDPSocket_Private_0_2* GetPPB_UDPSocket_Private_0_2_Thunk() { |
115 return &g_ppb_udp_socket_thunk_0_2; | 138 return &g_ppb_udp_socket_thunk_0_2; |
116 } | 139 } |
117 | 140 |
118 const PPB_UDPSocket_Private_0_3* GetPPB_UDPSocket_Private_0_3_Thunk() { | 141 const PPB_UDPSocket_Private_0_3* GetPPB_UDPSocket_Private_0_3_Thunk() { |
119 return &g_ppb_udp_socket_thunk_0_3; | 142 return &g_ppb_udp_socket_thunk_0_3; |
120 } | 143 } |
121 | 144 |
| 145 const PPB_UDPSocket_Private_0_4* GetPPB_UDPSocket_Private_0_4_Thunk() { |
| 146 return &g_ppb_udp_socket_thunk_0_4; |
| 147 } |
| 148 |
122 } // namespace thunk | 149 } // namespace thunk |
123 } // namespace ppapi | 150 } // namespace ppapi |
OLD | NEW |