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 EnterUDP enter(udp_socket, true); |
| 37 if (enter.failed()) |
| 38 return PP_ERROR_BADRESOURCE; |
| 39 return enter.object()->SetSocketFeature(name, value); |
| 40 } |
| 41 |
33 int32_t Bind(PP_Resource udp_socket, | 42 int32_t Bind(PP_Resource udp_socket, |
34 const PP_NetAddress_Private *addr, | 43 const PP_NetAddress_Private *addr, |
35 PP_CompletionCallback callback) { | 44 PP_CompletionCallback callback) { |
36 EnterUDP enter(udp_socket, callback, true); | 45 EnterUDP enter(udp_socket, callback, true); |
37 if (enter.failed()) | 46 if (enter.failed()) |
38 return enter.retval(); | 47 return enter.retval(); |
39 return enter.SetResult(enter.object()->Bind(addr, enter.callback())); | 48 return enter.SetResult(enter.object()->Bind(addr, enter.callback())); |
40 } | 49 } |
41 | 50 |
42 PP_Bool GetBoundAddress(PP_Resource udp_socket, | 51 PP_Bool GetBoundAddress(PP_Resource udp_socket, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 &Create, | 111 &Create, |
103 &IsUDPSocket, | 112 &IsUDPSocket, |
104 &Bind, | 113 &Bind, |
105 &GetBoundAddress, | 114 &GetBoundAddress, |
106 &RecvFrom, | 115 &RecvFrom, |
107 &GetRecvFromAddress, | 116 &GetRecvFromAddress, |
108 &SendTo, | 117 &SendTo, |
109 &Close | 118 &Close |
110 }; | 119 }; |
111 | 120 |
| 121 const PPB_UDPSocket_Private_0_4 g_ppb_udp_socket_thunk_0_4 = { |
| 122 &Create, |
| 123 &IsUDPSocket, |
| 124 &SetSocketFeature, |
| 125 &Bind, |
| 126 &GetBoundAddress, |
| 127 &RecvFrom, |
| 128 &GetRecvFromAddress, |
| 129 &SendTo, |
| 130 &Close |
| 131 }; |
| 132 |
112 } // namespace | 133 } // namespace |
113 | 134 |
114 const PPB_UDPSocket_Private_0_2* GetPPB_UDPSocket_Private_0_2_Thunk() { | 135 const PPB_UDPSocket_Private_0_2* GetPPB_UDPSocket_Private_0_2_Thunk() { |
115 return &g_ppb_udp_socket_thunk_0_2; | 136 return &g_ppb_udp_socket_thunk_0_2; |
116 } | 137 } |
117 | 138 |
118 const PPB_UDPSocket_Private_0_3* GetPPB_UDPSocket_Private_0_3_Thunk() { | 139 const PPB_UDPSocket_Private_0_3* GetPPB_UDPSocket_Private_0_3_Thunk() { |
119 return &g_ppb_udp_socket_thunk_0_3; | 140 return &g_ppb_udp_socket_thunk_0_3; |
120 } | 141 } |
121 | 142 |
| 143 const PPB_UDPSocket_Private_0_4* GetPPB_UDPSocket_Private_0_4_Thunk() { |
| 144 return &g_ppb_udp_socket_thunk_0_4; |
| 145 } |
| 146 |
122 } // namespace thunk | 147 } // namespace thunk |
123 } // namespace ppapi | 148 } // namespace ppapi |
OLD | NEW |