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_tcp_socket_private.h" | 7 #include "ppapi/c/private/ppb_tcp_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/thunk.h" | 10 #include "ppapi/thunk/thunk.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 return enter.SetResult(enter.object()->Write(buffer, bytes_to_write, | 114 return enter.SetResult(enter.object()->Write(buffer, bytes_to_write, |
115 enter.callback())); | 115 enter.callback())); |
116 } | 116 } |
117 | 117 |
118 void Disconnect(PP_Resource tcp_socket) { | 118 void Disconnect(PP_Resource tcp_socket) { |
119 EnterTCP enter(tcp_socket, true); | 119 EnterTCP enter(tcp_socket, true); |
120 if (enter.succeeded()) | 120 if (enter.succeeded()) |
121 enter.object()->Disconnect(); | 121 enter.object()->Disconnect(); |
122 } | 122 } |
123 | 123 |
| 124 int32_t SetOption(PP_Resource tcp_socket, |
| 125 PP_TCPSocketOption_Private name, |
| 126 PP_Var value, |
| 127 PP_CompletionCallback callback) { |
| 128 EnterTCP enter(tcp_socket, callback, true); |
| 129 if (enter.failed()) |
| 130 return enter.retval(); |
| 131 return enter.SetResult( |
| 132 enter.object()->SetOption(name, value, enter.callback())); |
| 133 } |
| 134 |
124 const PPB_TCPSocket_Private_0_3 g_ppb_tcp_socket_thunk_0_3 = { | 135 const PPB_TCPSocket_Private_0_3 g_ppb_tcp_socket_thunk_0_3 = { |
125 &Create, | 136 &Create, |
126 &IsTCPSocket, | 137 &IsTCPSocket, |
127 &Connect, | 138 &Connect, |
128 &ConnectWithNetAddress, | 139 &ConnectWithNetAddress, |
129 &GetLocalAddress, | 140 &GetLocalAddress, |
130 &GetRemoteAddress, | 141 &GetRemoteAddress, |
131 &SSLHandshake, | 142 &SSLHandshake, |
132 &Read, | 143 &Read, |
133 &Write, | 144 &Write, |
134 &Disconnect | 145 &Disconnect |
135 }; | 146 }; |
136 | 147 |
137 const PPB_TCPSocket_Private g_ppb_tcp_socket_thunk_0_4 = { | 148 const PPB_TCPSocket_Private_0_4 g_ppb_tcp_socket_thunk_0_4 = { |
138 &Create, | 149 &Create, |
139 &IsTCPSocket, | 150 &IsTCPSocket, |
140 &Connect, | 151 &Connect, |
141 &ConnectWithNetAddress, | 152 &ConnectWithNetAddress, |
142 &GetLocalAddress, | 153 &GetLocalAddress, |
143 &GetRemoteAddress, | 154 &GetRemoteAddress, |
144 &SSLHandshake, | 155 &SSLHandshake, |
145 &GetServerCertificate, | 156 &GetServerCertificate, |
146 &AddChainBuildingCertificate, | 157 &AddChainBuildingCertificate, |
147 &Read, | 158 &Read, |
148 &Write, | 159 &Write, |
149 &Disconnect | 160 &Disconnect |
150 }; | 161 }; |
151 | 162 |
| 163 const PPB_TCPSocket_Private_0_5 g_ppb_tcp_socket_thunk_0_5 = { |
| 164 &Create, |
| 165 &IsTCPSocket, |
| 166 &Connect, |
| 167 &ConnectWithNetAddress, |
| 168 &GetLocalAddress, |
| 169 &GetRemoteAddress, |
| 170 &SSLHandshake, |
| 171 &GetServerCertificate, |
| 172 &AddChainBuildingCertificate, |
| 173 &Read, |
| 174 &Write, |
| 175 &Disconnect, |
| 176 &SetOption |
| 177 }; |
| 178 |
152 } // namespace | 179 } // namespace |
153 | 180 |
154 const PPB_TCPSocket_Private_0_3* GetPPB_TCPSocket_Private_0_3_Thunk() { | 181 const PPB_TCPSocket_Private_0_3* GetPPB_TCPSocket_Private_0_3_Thunk() { |
155 return &g_ppb_tcp_socket_thunk_0_3; | 182 return &g_ppb_tcp_socket_thunk_0_3; |
156 } | 183 } |
157 | 184 |
158 const PPB_TCPSocket_Private_0_4* GetPPB_TCPSocket_Private_0_4_Thunk() { | 185 const PPB_TCPSocket_Private_0_4* GetPPB_TCPSocket_Private_0_4_Thunk() { |
159 return &g_ppb_tcp_socket_thunk_0_4; | 186 return &g_ppb_tcp_socket_thunk_0_4; |
160 } | 187 } |
161 | 188 |
| 189 const PPB_TCPSocket_Private_0_5* GetPPB_TCPSocket_Private_0_5_Thunk() { |
| 190 return &g_ppb_tcp_socket_thunk_0_5; |
| 191 } |
| 192 |
162 } // namespace thunk | 193 } // namespace thunk |
163 } // namespace ppapi | 194 } // namespace ppapi |
OLD | NEW |