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 "net/socket/socks_client_socket.h" | 5 #include "net/socket/socks_client_socket.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/profiler/scoped_tracker.h" |
11 #include "base/sys_byteorder.h" | 12 #include "base/sys_byteorder.h" |
12 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
13 #include "net/base/net_log.h" | 14 #include "net/base/net_log.h" |
14 #include "net/base/net_util.h" | 15 #include "net/base/net_util.h" |
15 #include "net/socket/client_socket_handle.h" | 16 #include "net/socket/client_socket_handle.h" |
16 | 17 |
17 namespace net { | 18 namespace net { |
18 | 19 |
19 // Every SOCKS server requests a user-id from the client. It is optional | 20 // Every SOCKS server requests a user-id from the client. It is optional |
20 // and we send an empty string. | 21 // and we send an empty string. |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 DCHECK_NE(ERR_IO_PENDING, result); | 224 DCHECK_NE(ERR_IO_PENDING, result); |
224 DCHECK(!user_callback_.is_null()); | 225 DCHECK(!user_callback_.is_null()); |
225 | 226 |
226 // Since Run() may result in Read being called, | 227 // Since Run() may result in Read being called, |
227 // clear user_callback_ up front. | 228 // clear user_callback_ up front. |
228 DVLOG(1) << "Finished setting up SOCKS handshake"; | 229 DVLOG(1) << "Finished setting up SOCKS handshake"; |
229 base::ResetAndReturn(&user_callback_).Run(result); | 230 base::ResetAndReturn(&user_callback_).Run(result); |
230 } | 231 } |
231 | 232 |
232 void SOCKSClientSocket::OnIOComplete(int result) { | 233 void SOCKSClientSocket::OnIOComplete(int result) { |
| 234 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436634 is fixed. |
| 235 tracked_objects::ScopedTracker tracking_profile( |
| 236 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 237 "436634 SOCKSClientSocket::OnIOComplete")); |
| 238 |
233 DCHECK_NE(STATE_NONE, next_state_); | 239 DCHECK_NE(STATE_NONE, next_state_); |
234 int rv = DoLoop(result); | 240 int rv = DoLoop(result); |
235 if (rv != ERR_IO_PENDING) { | 241 if (rv != ERR_IO_PENDING) { |
236 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SOCKS_CONNECT, rv); | 242 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SOCKS_CONNECT, rv); |
237 DoCallback(rv); | 243 DoCallback(rv); |
238 } | 244 } |
239 } | 245 } |
240 | 246 |
241 void SOCKSClientSocket::OnReadWriteComplete(const CompletionCallback& callback, | 247 void SOCKSClientSocket::OnReadWriteComplete(const CompletionCallback& callback, |
242 int result) { | 248 int result) { |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 | 452 |
447 int SOCKSClientSocket::GetPeerAddress(IPEndPoint* address) const { | 453 int SOCKSClientSocket::GetPeerAddress(IPEndPoint* address) const { |
448 return transport_->socket()->GetPeerAddress(address); | 454 return transport_->socket()->GetPeerAddress(address); |
449 } | 455 } |
450 | 456 |
451 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { | 457 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { |
452 return transport_->socket()->GetLocalAddress(address); | 458 return transport_->socket()->GetLocalAddress(address); |
453 } | 459 } |
454 | 460 |
455 } // namespace net | 461 } // namespace net |
OLD | NEW |