OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // From ppb_tcp_socket.idl modified Sun Sep 15 16:14:21 2013. | 5 // From ppb_tcp_socket.idl modified Sun Sep 15 16:14:21 2013. |
6 | 6 |
7 #include "ppapi/c/pp_completion_callback.h" | 7 #include "ppapi/c/pp_completion_callback.h" |
8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/c/ppb_tcp_socket.h" | 9 #include "ppapi/c/ppb_tcp_socket.h" |
10 #include "ppapi/shared_impl/tracked_callback.h" | 10 #include "ppapi/shared_impl/tracked_callback.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 } | 125 } |
126 | 126 |
127 void Close(PP_Resource tcp_socket) { | 127 void Close(PP_Resource tcp_socket) { |
128 VLOG(4) << "PPB_TCPSocket::Close()"; | 128 VLOG(4) << "PPB_TCPSocket::Close()"; |
129 EnterResource<PPB_TCPSocket_API> enter(tcp_socket, true); | 129 EnterResource<PPB_TCPSocket_API> enter(tcp_socket, true); |
130 if (enter.failed()) | 130 if (enter.failed()) |
131 return; | 131 return; |
132 enter.object()->Close(); | 132 enter.object()->Close(); |
133 } | 133 } |
134 | 134 |
| 135 int32_t SetOption1_1(PP_Resource tcp_socket, |
| 136 PP_TCPSocket_Option name, |
| 137 struct PP_Var value, |
| 138 struct PP_CompletionCallback callback) { |
| 139 VLOG(4) << "PPB_TCPSocket::SetOption1_1()"; |
| 140 EnterResource<PPB_TCPSocket_API> enter(tcp_socket, callback, true); |
| 141 if (enter.failed()) |
| 142 return enter.retval(); |
| 143 return enter.SetResult(enter.object()->SetOption1_1(name, |
| 144 value, |
| 145 enter.callback())); |
| 146 } |
| 147 |
135 int32_t SetOption(PP_Resource tcp_socket, | 148 int32_t SetOption(PP_Resource tcp_socket, |
136 PP_TCPSocket_Option name, | 149 PP_TCPSocket_Option name, |
137 struct PP_Var value, | 150 struct PP_Var value, |
138 struct PP_CompletionCallback callback) { | 151 struct PP_CompletionCallback callback) { |
139 VLOG(4) << "PPB_TCPSocket::SetOption()"; | 152 VLOG(4) << "PPB_TCPSocket::SetOption()"; |
140 EnterResource<PPB_TCPSocket_API> enter(tcp_socket, callback, true); | 153 EnterResource<PPB_TCPSocket_API> enter(tcp_socket, callback, true); |
141 if (enter.failed()) | 154 if (enter.failed()) |
142 return enter.retval(); | 155 return enter.retval(); |
143 return enter.SetResult(enter.object()->SetOption(name, | 156 return enter.SetResult(enter.object()->SetOption(name, |
144 value, | 157 value, |
145 enter.callback())); | 158 enter.callback())); |
146 } | 159 } |
147 | 160 |
148 const PPB_TCPSocket_1_0 g_ppb_tcpsocket_thunk_1_0 = { | 161 const PPB_TCPSocket_1_0 g_ppb_tcpsocket_thunk_1_0 = { |
149 &Create_1_0, | 162 &Create_1_0, |
150 &IsTCPSocket, | 163 &IsTCPSocket, |
151 &Connect, | 164 &Connect, |
152 &GetLocalAddress, | 165 &GetLocalAddress, |
153 &GetRemoteAddress, | 166 &GetRemoteAddress, |
154 &Read, | 167 &Read, |
155 &Write, | 168 &Write, |
156 &Close, | 169 &Close, |
157 &SetOption | 170 &SetOption1_1 |
158 }; | 171 }; |
159 | 172 |
160 const PPB_TCPSocket_1_1 g_ppb_tcpsocket_thunk_1_1 = { | 173 const PPB_TCPSocket_1_1 g_ppb_tcpsocket_thunk_1_1 = { |
161 &Create, | 174 &Create, |
162 &IsTCPSocket, | 175 &IsTCPSocket, |
163 &Bind, | 176 &Bind, |
164 &Connect, | 177 &Connect, |
165 &GetLocalAddress, | 178 &GetLocalAddress, |
166 &GetRemoteAddress, | 179 &GetRemoteAddress, |
167 &Read, | 180 &Read, |
168 &Write, | 181 &Write, |
169 &Listen, | 182 &Listen, |
170 &Accept, | 183 &Accept, |
171 &Close, | 184 &Close, |
| 185 &SetOption1_1 |
| 186 }; |
| 187 |
| 188 const PPB_TCPSocket_1_2 g_ppb_tcpsocket_thunk_1_2 = { |
| 189 &Create, |
| 190 &IsTCPSocket, |
| 191 &Bind, |
| 192 &Connect, |
| 193 &GetLocalAddress, |
| 194 &GetRemoteAddress, |
| 195 &Read, |
| 196 &Write, |
| 197 &Listen, |
| 198 &Accept, |
| 199 &Close, |
172 &SetOption | 200 &SetOption |
173 }; | 201 }; |
174 | 202 |
175 } // namespace | 203 } // namespace |
176 | 204 |
177 const PPB_TCPSocket_1_0* GetPPB_TCPSocket_1_0_Thunk() { | 205 const PPB_TCPSocket_1_0* GetPPB_TCPSocket_1_0_Thunk() { |
178 return &g_ppb_tcpsocket_thunk_1_0; | 206 return &g_ppb_tcpsocket_thunk_1_0; |
179 } | 207 } |
180 | 208 |
181 const PPB_TCPSocket_1_1* GetPPB_TCPSocket_1_1_Thunk() { | 209 const PPB_TCPSocket_1_1* GetPPB_TCPSocket_1_1_Thunk() { |
182 return &g_ppb_tcpsocket_thunk_1_1; | 210 return &g_ppb_tcpsocket_thunk_1_1; |
183 } | 211 } |
184 | 212 |
| 213 const PPB_TCPSocket_1_2* GetPPB_TCPSocket_1_2_Thunk() { |
| 214 return &g_ppb_tcpsocket_thunk_1_2; |
| 215 } |
| 216 |
185 } // namespace thunk | 217 } // namespace thunk |
186 } // namespace ppapi | 218 } // namespace ppapi |
OLD | NEW |