| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "net/socket/tcp_client_socket.h" | 5 #include "net/socket/tcp_client_socket.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/profiler/scoped_profile.h" | 9 #include "base/profiler/scoped_tracker.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| 11 #include "net/base/ip_endpoint.h" | 11 #include "net/base/ip_endpoint.h" |
| 12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 13 #include "net/base/net_util.h" | 13 #include "net/base/net_util.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 TCPClientSocket::TCPClientSocket(const AddressList& addresses, | 17 TCPClientSocket::TCPClientSocket(const AddressList& addresses, |
| 18 net::NetLog* net_log, | 18 net::NetLog* net_log, |
| 19 const net::NetLog::Source& source) | 19 const net::NetLog::Source& source) |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 socket_->EndLoggingMultipleConnectAttempts(result); | 300 socket_->EndLoggingMultipleConnectAttempts(result); |
| 301 base::ResetAndReturn(&connect_callback_).Run(result); | 301 base::ResetAndReturn(&connect_callback_).Run(result); |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 void TCPClientSocket::DidCompleteReadWrite(const CompletionCallback& callback, | 305 void TCPClientSocket::DidCompleteReadWrite(const CompletionCallback& callback, |
| 306 int result) { | 306 int result) { |
| 307 if (result > 0) | 307 if (result > 0) |
| 308 use_history_.set_was_used_to_convey_data(); | 308 use_history_.set_was_used_to_convey_data(); |
| 309 | 309 |
| 310 // TODO(vadimt): Remove ScopedProfile below once crbug.com/418183 is fixed. | 310 // TODO(vadimt): Remove ScopedTracker below once crbug.com/418183 is fixed. |
| 311 tracked_objects::ScopedProfile tracking_profile( | 311 tracked_objects::ScopedTracker tracking_profile( |
| 312 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 312 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 313 "TCPClientSocket::DidCompleteReadWrite")); | 313 "TCPClientSocket::DidCompleteReadWrite")); |
| 314 callback.Run(result); | 314 callback.Run(result); |
| 315 } | 315 } |
| 316 | 316 |
| 317 int TCPClientSocket::OpenSocket(AddressFamily family) { | 317 int TCPClientSocket::OpenSocket(AddressFamily family) { |
| 318 DCHECK(!socket_->IsValid()); | 318 DCHECK(!socket_->IsValid()); |
| 319 | 319 |
| 320 int result = socket_->Open(family); | 320 int result = socket_->Open(family); |
| 321 if (result != OK) | 321 if (result != OK) |
| 322 return result; | 322 return result; |
| 323 | 323 |
| 324 socket_->SetDefaultOptionsForClient(); | 324 socket_->SetDefaultOptionsForClient(); |
| 325 | 325 |
| 326 return OK; | 326 return OK; |
| 327 } | 327 } |
| 328 | 328 |
| 329 } // namespace net | 329 } // namespace net |
| OLD | NEW |