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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 PostAbortIfNecessary(&connect_callback_); | 305 PostAbortIfNecessary(&connect_callback_); |
306 PostAbortIfNecessary(&ssl_handshake_callback_); | 306 PostAbortIfNecessary(&ssl_handshake_callback_); |
307 PostAbortIfNecessary(&read_callback_); | 307 PostAbortIfNecessary(&read_callback_); |
308 PostAbortIfNecessary(&write_callback_); | 308 PostAbortIfNecessary(&write_callback_); |
309 read_buffer_ = NULL; | 309 read_buffer_ = NULL; |
310 bytes_to_read_ = -1; | 310 bytes_to_read_ = -1; |
311 server_certificate_ = NULL; | 311 server_certificate_ = NULL; |
312 } | 312 } |
313 | 313 |
314 int32_t TCPSocketShared::SetOptionImpl( | 314 int32_t TCPSocketShared::SetOptionImpl( |
315 PP_TCPSocket_Option_Dev name, | 315 PP_TCPSocket_Option name, |
316 const PP_Var& value, | 316 const PP_Var& value, |
317 scoped_refptr<TrackedCallback> callback) { | 317 scoped_refptr<TrackedCallback> callback) { |
318 if (!IsConnected()) | 318 if (!IsConnected()) |
319 return PP_ERROR_FAILED; | 319 return PP_ERROR_FAILED; |
320 | 320 |
321 SocketOptionData option_data; | 321 SocketOptionData option_data; |
322 switch (name) { | 322 switch (name) { |
323 case PP_TCPSOCKET_OPTION_NO_DELAY: { | 323 case PP_TCPSOCKET_OPTION_NO_DELAY: { |
324 if (value.type != PP_VARTYPE_BOOL) | 324 if (value.type != PP_VARTYPE_BOOL) |
325 return PP_ERROR_BADARGUMENT; | 325 return PP_ERROR_BADARGUMENT; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 return connection_state_ == CONNECTED || connection_state_ == SSL_CONNECTED; | 363 return connection_state_ == CONNECTED || connection_state_ == SSL_CONNECTED; |
364 } | 364 } |
365 | 365 |
366 void TCPSocketShared::PostAbortIfNecessary( | 366 void TCPSocketShared::PostAbortIfNecessary( |
367 scoped_refptr<TrackedCallback>* callback) { | 367 scoped_refptr<TrackedCallback>* callback) { |
368 if (TrackedCallback::IsPending(*callback)) | 368 if (TrackedCallback::IsPending(*callback)) |
369 (*callback)->PostAbort(); | 369 (*callback)->PostAbort(); |
370 } | 370 } |
371 | 371 |
372 } // namespace ppapi | 372 } // namespace ppapi |
OLD | NEW |