Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: net/socket/socks_client_socket_pool.cc

Issue 8898036: base::Bind: Convert proxy_resolving_client_socket.[cc,h] and deps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Possible test fix. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/socket/socks_client_socket_pool.h ('k') | net/socket/socks_client_socket_pool_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_pool.h" 5 #include "net/socket/socks_client_socket_pool.h"
6 6
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
7 #include "base/time.h" 9 #include "base/time.h"
8 #include "base/values.h" 10 #include "base/values.h"
9 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
10 #include "net/socket/client_socket_factory.h" 12 #include "net/socket/client_socket_factory.h"
11 #include "net/socket/client_socket_handle.h" 13 #include "net/socket/client_socket_handle.h"
12 #include "net/socket/client_socket_pool_base.h" 14 #include "net/socket/client_socket_pool_base.h"
13 #include "net/socket/socks5_client_socket.h" 15 #include "net/socket/socks5_client_socket.h"
14 #include "net/socket/socks_client_socket.h" 16 #include "net/socket/socks_client_socket.h"
15 #include "net/socket/transport_client_socket_pool.h" 17 #include "net/socket/transport_client_socket_pool.h"
16 18
(...skipping 26 matching lines...) Expand all
43 const base::TimeDelta& timeout_duration, 45 const base::TimeDelta& timeout_duration,
44 TransportClientSocketPool* transport_pool, 46 TransportClientSocketPool* transport_pool,
45 HostResolver* host_resolver, 47 HostResolver* host_resolver,
46 Delegate* delegate, 48 Delegate* delegate,
47 NetLog* net_log) 49 NetLog* net_log)
48 : ConnectJob(group_name, timeout_duration, delegate, 50 : ConnectJob(group_name, timeout_duration, delegate,
49 BoundNetLog::Make(net_log, NetLog::SOURCE_CONNECT_JOB)), 51 BoundNetLog::Make(net_log, NetLog::SOURCE_CONNECT_JOB)),
50 socks_params_(socks_params), 52 socks_params_(socks_params),
51 transport_pool_(transport_pool), 53 transport_pool_(transport_pool),
52 resolver_(host_resolver), 54 resolver_(host_resolver),
53 ALLOW_THIS_IN_INITIALIZER_LIST( 55 ALLOW_THIS_IN_INITIALIZER_LIST(callback_(
54 callback_old_(this, &SOCKSConnectJob::OnIOComplete)) { 56 base::Bind(&SOCKSConnectJob::OnIOComplete, base::Unretained(this)))) {
55 } 57 }
56 58
57 SOCKSConnectJob::~SOCKSConnectJob() { 59 SOCKSConnectJob::~SOCKSConnectJob() {
58 // We don't worry about cancelling the tcp socket since the destructor in 60 // We don't worry about cancelling the tcp socket since the destructor in
59 // scoped_ptr<ClientSocketHandle> transport_socket_handle_ will take care of 61 // scoped_ptr<ClientSocketHandle> transport_socket_handle_ will take care of
60 // it. 62 // it.
61 } 63 }
62 64
63 LoadState SOCKSConnectJob::GetLoadState() const { 65 LoadState SOCKSConnectJob::GetLoadState() const {
64 switch (next_state_) { 66 switch (next_state_) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 break; 110 break;
109 } 111 }
110 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); 112 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE);
111 113
112 return rv; 114 return rv;
113 } 115 }
114 116
115 int SOCKSConnectJob::DoTransportConnect() { 117 int SOCKSConnectJob::DoTransportConnect() {
116 next_state_ = STATE_TRANSPORT_CONNECT_COMPLETE; 118 next_state_ = STATE_TRANSPORT_CONNECT_COMPLETE;
117 transport_socket_handle_.reset(new ClientSocketHandle()); 119 transport_socket_handle_.reset(new ClientSocketHandle());
118 return transport_socket_handle_->Init(group_name(), 120 return transport_socket_handle_->Init(
119 socks_params_->transport_params(), 121 group_name(), socks_params_->transport_params(),
120 socks_params_->destination().priority(), 122 socks_params_->destination().priority(), callback_, transport_pool_,
121 &callback_old_, 123 net_log());
122 transport_pool_,
123 net_log());
124 } 124 }
125 125
126 int SOCKSConnectJob::DoTransportConnectComplete(int result) { 126 int SOCKSConnectJob::DoTransportConnectComplete(int result) {
127 if (result != OK) 127 if (result != OK)
128 return ERR_PROXY_CONNECTION_FAILED; 128 return ERR_PROXY_CONNECTION_FAILED;
129 129
130 // Reset the timer to just the length of time allowed for SOCKS handshake 130 // Reset the timer to just the length of time allowed for SOCKS handshake
131 // so that a fast TCP connection plus a slow SOCKS failure doesn't take 131 // so that a fast TCP connection plus a slow SOCKS failure doesn't take
132 // longer to timeout than it should. 132 // longer to timeout than it should.
133 ResetTimer(base::TimeDelta::FromSeconds(kSOCKSConnectJobTimeoutInSeconds)); 133 ResetTimer(base::TimeDelta::FromSeconds(kSOCKSConnectJobTimeoutInSeconds));
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 return base_.histograms(); 301 return base_.histograms();
302 }; 302 };
303 303
304 bool SOCKSClientSocketPool::CloseOneIdleConnection() { 304 bool SOCKSClientSocketPool::CloseOneIdleConnection() {
305 if (base_.CloseOneIdleSocket()) 305 if (base_.CloseOneIdleSocket())
306 return true; 306 return true;
307 return base_.CloseOneIdleConnectionInLayeredPool(); 307 return base_.CloseOneIdleConnectionInLayeredPool();
308 } 308 }
309 309
310 } // namespace net 310 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/socks_client_socket_pool.h ('k') | net/socket/socks_client_socket_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698