| 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_pool.h" | 5 #include "net/socket/socks_client_socket_pool.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 SOCKSConnectJob::SOCKSConnectJob( | 39 SOCKSConnectJob::SOCKSConnectJob( |
| 40 const std::string& group_name, | 40 const std::string& group_name, |
| 41 RequestPriority priority, | 41 RequestPriority priority, |
| 42 ClientSocketPool::RespectLimits respect_limits, | 42 ClientSocketPool::RespectLimits respect_limits, |
| 43 const scoped_refptr<SOCKSSocketParams>& socks_params, | 43 const scoped_refptr<SOCKSSocketParams>& socks_params, |
| 44 const base::TimeDelta& timeout_duration, | 44 const base::TimeDelta& timeout_duration, |
| 45 TransportClientSocketPool* transport_pool, | 45 TransportClientSocketPool* transport_pool, |
| 46 HostResolver* host_resolver, | 46 HostResolver* host_resolver, |
| 47 Delegate* delegate, | 47 Delegate* delegate, |
| 48 NetLog* net_log) | 48 NetLog* net_log) |
| 49 : ConnectJob(group_name, | 49 : ConnectJob( |
| 50 timeout_duration, | 50 group_name, |
| 51 priority, | 51 timeout_duration, |
| 52 respect_limits, | 52 priority, |
| 53 delegate, | 53 respect_limits, |
| 54 BoundNetLog::Make(net_log, NetLogSourceType::CONNECT_JOB)), | 54 delegate, |
| 55 NetLogWithSource::Make(net_log, NetLogSourceType::CONNECT_JOB)), |
| 55 socks_params_(socks_params), | 56 socks_params_(socks_params), |
| 56 transport_pool_(transport_pool), | 57 transport_pool_(transport_pool), |
| 57 resolver_(host_resolver), | 58 resolver_(host_resolver), |
| 58 callback_( | 59 callback_( |
| 59 base::Bind(&SOCKSConnectJob::OnIOComplete, base::Unretained(this))) {} | 60 base::Bind(&SOCKSConnectJob::OnIOComplete, base::Unretained(this))) {} |
| 60 | 61 |
| 61 SOCKSConnectJob::~SOCKSConnectJob() { | 62 SOCKSConnectJob::~SOCKSConnectJob() { |
| 62 // We don't worry about cancelling the tcp socket since the destructor in | 63 // We don't worry about cancelling the tcp socket since the destructor in |
| 63 // std::unique_ptr<ClientSocketHandle> transport_socket_handle_ will take care | 64 // std::unique_ptr<ClientSocketHandle> transport_socket_handle_ will take care |
| 64 // of | 65 // of |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 208 |
| 208 SOCKSClientSocketPool::~SOCKSClientSocketPool() { | 209 SOCKSClientSocketPool::~SOCKSClientSocketPool() { |
| 209 } | 210 } |
| 210 | 211 |
| 211 int SOCKSClientSocketPool::RequestSocket(const std::string& group_name, | 212 int SOCKSClientSocketPool::RequestSocket(const std::string& group_name, |
| 212 const void* socket_params, | 213 const void* socket_params, |
| 213 RequestPriority priority, | 214 RequestPriority priority, |
| 214 RespectLimits respect_limits, | 215 RespectLimits respect_limits, |
| 215 ClientSocketHandle* handle, | 216 ClientSocketHandle* handle, |
| 216 const CompletionCallback& callback, | 217 const CompletionCallback& callback, |
| 217 const BoundNetLog& net_log) { | 218 const NetLogWithSource& net_log) { |
| 218 const scoped_refptr<SOCKSSocketParams>* casted_socket_params = | 219 const scoped_refptr<SOCKSSocketParams>* casted_socket_params = |
| 219 static_cast<const scoped_refptr<SOCKSSocketParams>*>(socket_params); | 220 static_cast<const scoped_refptr<SOCKSSocketParams>*>(socket_params); |
| 220 | 221 |
| 221 return base_.RequestSocket(group_name, *casted_socket_params, priority, | 222 return base_.RequestSocket(group_name, *casted_socket_params, priority, |
| 222 respect_limits, handle, callback, net_log); | 223 respect_limits, handle, callback, net_log); |
| 223 } | 224 } |
| 224 | 225 |
| 225 void SOCKSClientSocketPool::RequestSockets( | 226 void SOCKSClientSocketPool::RequestSockets(const std::string& group_name, |
| 226 const std::string& group_name, | 227 const void* params, |
| 227 const void* params, | 228 int num_sockets, |
| 228 int num_sockets, | 229 const NetLogWithSource& net_log) { |
| 229 const BoundNetLog& net_log) { | |
| 230 const scoped_refptr<SOCKSSocketParams>* casted_params = | 230 const scoped_refptr<SOCKSSocketParams>* casted_params = |
| 231 static_cast<const scoped_refptr<SOCKSSocketParams>*>(params); | 231 static_cast<const scoped_refptr<SOCKSSocketParams>*>(params); |
| 232 | 232 |
| 233 base_.RequestSockets(group_name, *casted_params, num_sockets, net_log); | 233 base_.RequestSockets(group_name, *casted_params, num_sockets, net_log); |
| 234 } | 234 } |
| 235 | 235 |
| 236 void SOCKSClientSocketPool::CancelRequest(const std::string& group_name, | 236 void SOCKSClientSocketPool::CancelRequest(const std::string& group_name, |
| 237 ClientSocketHandle* handle) { | 237 ClientSocketHandle* handle) { |
| 238 base_.CancelRequest(group_name, handle); | 238 base_.CancelRequest(group_name, handle); |
| 239 } | 239 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 base_.RemoveHigherLayeredPool(higher_pool); | 299 base_.RemoveHigherLayeredPool(higher_pool); |
| 300 } | 300 } |
| 301 | 301 |
| 302 bool SOCKSClientSocketPool::CloseOneIdleConnection() { | 302 bool SOCKSClientSocketPool::CloseOneIdleConnection() { |
| 303 if (base_.CloseOneIdleSocket()) | 303 if (base_.CloseOneIdleSocket()) |
| 304 return true; | 304 return true; |
| 305 return base_.CloseOneIdleConnectionInHigherLayeredPool(); | 305 return base_.CloseOneIdleConnectionInHigherLayeredPool(); |
| 306 } | 306 } |
| 307 | 307 |
| 308 } // namespace net | 308 } // namespace net |
| OLD | NEW |