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 #include "ppapi/shared_impl/tcp_socket_shared.h" | 5 #include "ppapi/shared_impl/tcp_socket_shared.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 PostAbortIfNecessary(&connect_callback_); | 297 PostAbortIfNecessary(&connect_callback_); |
298 PostAbortIfNecessary(&ssl_handshake_callback_); | 298 PostAbortIfNecessary(&ssl_handshake_callback_); |
299 PostAbortIfNecessary(&read_callback_); | 299 PostAbortIfNecessary(&read_callback_); |
300 PostAbortIfNecessary(&write_callback_); | 300 PostAbortIfNecessary(&write_callback_); |
301 read_buffer_ = NULL; | 301 read_buffer_ = NULL; |
302 bytes_to_read_ = -1; | 302 bytes_to_read_ = -1; |
303 server_certificate_ = NULL; | 303 server_certificate_ = NULL; |
304 } | 304 } |
305 | 305 |
306 int32_t TCPSocketShared::SetOptionImpl( | 306 int32_t TCPSocketShared::SetOptionImpl( |
307 PP_TCPSocket_Option_Dev name, | 307 PP_TCPSocket_Option name, |
308 const PP_Var& value, | 308 const PP_Var& value, |
309 scoped_refptr<TrackedCallback> callback) { | 309 scoped_refptr<TrackedCallback> callback) { |
310 if (!IsConnected()) | 310 if (!IsConnected()) |
311 return PP_ERROR_FAILED; | 311 return PP_ERROR_FAILED; |
312 | 312 |
313 SocketOptionData option_data; | 313 SocketOptionData option_data; |
314 switch (name) { | 314 switch (name) { |
315 case PP_TCPSOCKET_OPTION_NO_DELAY: { | 315 case PP_TCPSOCKET_OPTION_NO_DELAY: { |
316 if (value.type != PP_VARTYPE_BOOL) | 316 if (value.type != PP_VARTYPE_BOOL) |
317 return PP_ERROR_BADARGUMENT; | 317 return PP_ERROR_BADARGUMENT; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 return connection_state_ == CONNECTED || connection_state_ == SSL_CONNECTED; | 355 return connection_state_ == CONNECTED || connection_state_ == SSL_CONNECTED; |
356 } | 356 } |
357 | 357 |
358 void TCPSocketShared::PostAbortIfNecessary( | 358 void TCPSocketShared::PostAbortIfNecessary( |
359 scoped_refptr<TrackedCallback>* callback) { | 359 scoped_refptr<TrackedCallback>* callback) { |
360 if (TrackedCallback::IsPending(*callback)) | 360 if (TrackedCallback::IsPending(*callback)) |
361 (*callback)->PostAbort(); | 361 (*callback)->PostAbort(); |
362 } | 362 } |
363 | 363 |
364 } // namespace ppapi | 364 } // namespace ppapi |
OLD | NEW |