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