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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 185 |
186 base::TimeDelta | 186 base::TimeDelta |
187 SOCKSClientSocketPool::SOCKSConnectJobFactory::ConnectionTimeout() const { | 187 SOCKSClientSocketPool::SOCKSConnectJobFactory::ConnectionTimeout() const { |
188 return transport_pool_->ConnectionTimeout() + | 188 return transport_pool_->ConnectionTimeout() + |
189 base::TimeDelta::FromSeconds(kSOCKSConnectJobTimeoutInSeconds); | 189 base::TimeDelta::FromSeconds(kSOCKSConnectJobTimeoutInSeconds); |
190 } | 190 } |
191 | 191 |
192 SOCKSClientSocketPool::SOCKSClientSocketPool( | 192 SOCKSClientSocketPool::SOCKSClientSocketPool( |
193 int max_sockets, | 193 int max_sockets, |
194 int max_sockets_per_group, | 194 int max_sockets_per_group, |
195 ClientSocketPoolHistograms* histograms, | |
196 HostResolver* host_resolver, | 195 HostResolver* host_resolver, |
197 TransportClientSocketPool* transport_pool, | 196 TransportClientSocketPool* transport_pool, |
198 NetLog* net_log) | 197 NetLog* net_log) |
199 : transport_pool_(transport_pool), | 198 : transport_pool_(transport_pool), |
200 base_(this, max_sockets, max_sockets_per_group, histograms, | 199 base_( |
201 ClientSocketPool::unused_idle_socket_timeout(), | 200 this, |
202 ClientSocketPool::used_idle_socket_timeout(), | 201 max_sockets, |
203 new SOCKSConnectJobFactory(transport_pool, | 202 max_sockets_per_group, |
204 host_resolver, | 203 ClientSocketPool::unused_idle_socket_timeout(), |
205 net_log)) { | 204 ClientSocketPool::used_idle_socket_timeout(), |
| 205 new SOCKSConnectJobFactory(transport_pool, host_resolver, net_log)) { |
206 // We should always have a |transport_pool_| except in unit tests. | 206 // We should always have a |transport_pool_| except in unit tests. |
207 if (transport_pool_) | 207 if (transport_pool_) |
208 base_.AddLowerLayeredPool(transport_pool_); | 208 base_.AddLowerLayeredPool(transport_pool_); |
209 } | 209 } |
210 | 210 |
211 SOCKSClientSocketPool::~SOCKSClientSocketPool() { | 211 SOCKSClientSocketPool::~SOCKSClientSocketPool() { |
212 } | 212 } |
213 | 213 |
214 int SOCKSClientSocketPool::RequestSocket( | 214 int SOCKSClientSocketPool::RequestSocket( |
215 const std::string& group_name, const void* socket_params, | 215 const std::string& group_name, const void* socket_params, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 false)); | 278 false)); |
279 dict->Set("nested_pools", list); | 279 dict->Set("nested_pools", list); |
280 } | 280 } |
281 return dict; | 281 return dict; |
282 } | 282 } |
283 | 283 |
284 base::TimeDelta SOCKSClientSocketPool::ConnectionTimeout() const { | 284 base::TimeDelta SOCKSClientSocketPool::ConnectionTimeout() const { |
285 return base_.ConnectionTimeout(); | 285 return base_.ConnectionTimeout(); |
286 } | 286 } |
287 | 287 |
288 ClientSocketPoolHistograms* SOCKSClientSocketPool::histograms() const { | |
289 return base_.histograms(); | |
290 }; | |
291 | |
292 bool SOCKSClientSocketPool::IsStalled() const { | 288 bool SOCKSClientSocketPool::IsStalled() const { |
293 return base_.IsStalled(); | 289 return base_.IsStalled(); |
294 } | 290 } |
295 | 291 |
296 void SOCKSClientSocketPool::AddHigherLayeredPool( | 292 void SOCKSClientSocketPool::AddHigherLayeredPool( |
297 HigherLayeredPool* higher_pool) { | 293 HigherLayeredPool* higher_pool) { |
298 base_.AddHigherLayeredPool(higher_pool); | 294 base_.AddHigherLayeredPool(higher_pool); |
299 } | 295 } |
300 | 296 |
301 void SOCKSClientSocketPool::RemoveHigherLayeredPool( | 297 void SOCKSClientSocketPool::RemoveHigherLayeredPool( |
302 HigherLayeredPool* higher_pool) { | 298 HigherLayeredPool* higher_pool) { |
303 base_.RemoveHigherLayeredPool(higher_pool); | 299 base_.RemoveHigherLayeredPool(higher_pool); |
304 } | 300 } |
305 | 301 |
306 bool SOCKSClientSocketPool::CloseOneIdleConnection() { | 302 bool SOCKSClientSocketPool::CloseOneIdleConnection() { |
307 if (base_.CloseOneIdleSocket()) | 303 if (base_.CloseOneIdleSocket()) |
308 return true; | 304 return true; |
309 return base_.CloseOneIdleConnectionInHigherLayeredPool(); | 305 return base_.CloseOneIdleConnectionInHigherLayeredPool(); |
310 } | 306 } |
311 | 307 |
312 } // namespace net | 308 } // namespace net |
OLD | NEW |