| 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/http/http_proxy_client_socket_pool.h" | 5 #include "net/http/http_proxy_client_socket_pool.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 NotifyProxyDelegateOfCompletion(rv); | 388 NotifyProxyDelegateOfCompletion(rv); |
| 389 } | 389 } |
| 390 | 390 |
| 391 return rv; | 391 return rv; |
| 392 } | 392 } |
| 393 | 393 |
| 394 HttpProxyClientSocketPool:: | 394 HttpProxyClientSocketPool:: |
| 395 HttpProxyConnectJobFactory::HttpProxyConnectJobFactory( | 395 HttpProxyConnectJobFactory::HttpProxyConnectJobFactory( |
| 396 TransportClientSocketPool* transport_pool, | 396 TransportClientSocketPool* transport_pool, |
| 397 SSLClientSocketPool* ssl_pool, | 397 SSLClientSocketPool* ssl_pool, |
| 398 HostResolver* host_resolver, | |
| 399 NetLog* net_log) | 398 NetLog* net_log) |
| 400 : transport_pool_(transport_pool), | 399 : transport_pool_(transport_pool), |
| 401 ssl_pool_(ssl_pool), | 400 ssl_pool_(ssl_pool), |
| 402 host_resolver_(host_resolver), | |
| 403 net_log_(net_log) { | 401 net_log_(net_log) { |
| 404 base::TimeDelta max_pool_timeout = base::TimeDelta(); | 402 base::TimeDelta max_pool_timeout = base::TimeDelta(); |
| 405 | 403 |
| 406 // TODO(kundaji): Proxy connect timeout should be independent of platform and be | 404 // TODO(kundaji): Proxy connect timeout should be independent of platform and be |
| 407 // based on proxy. Bug http://crbug.com/407446. | 405 // based on proxy. Bug http://crbug.com/407446. |
| 408 #if (defined(OS_ANDROID) || defined(OS_IOS)) | 406 #if (defined(OS_ANDROID) || defined(OS_IOS)) |
| 409 #else | 407 #else |
| 410 if (transport_pool_) | 408 if (transport_pool_) |
| 411 max_pool_timeout = transport_pool_->ConnectionTimeout(); | 409 max_pool_timeout = transport_pool_->ConnectionTimeout(); |
| 412 if (ssl_pool_) | 410 if (ssl_pool_) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 436 base::TimeDelta | 434 base::TimeDelta |
| 437 HttpProxyClientSocketPool::HttpProxyConnectJobFactory::ConnectionTimeout( | 435 HttpProxyClientSocketPool::HttpProxyConnectJobFactory::ConnectionTimeout( |
| 438 ) const { | 436 ) const { |
| 439 return timeout_; | 437 return timeout_; |
| 440 } | 438 } |
| 441 | 439 |
| 442 HttpProxyClientSocketPool::HttpProxyClientSocketPool( | 440 HttpProxyClientSocketPool::HttpProxyClientSocketPool( |
| 443 int max_sockets, | 441 int max_sockets, |
| 444 int max_sockets_per_group, | 442 int max_sockets_per_group, |
| 445 ClientSocketPoolHistograms* histograms, | 443 ClientSocketPoolHistograms* histograms, |
| 446 HostResolver* host_resolver, | |
| 447 TransportClientSocketPool* transport_pool, | 444 TransportClientSocketPool* transport_pool, |
| 448 SSLClientSocketPool* ssl_pool, | 445 SSLClientSocketPool* ssl_pool, |
| 449 NetLog* net_log) | 446 NetLog* net_log) |
| 450 : transport_pool_(transport_pool), | 447 : transport_pool_(transport_pool), |
| 451 ssl_pool_(ssl_pool), | 448 ssl_pool_(ssl_pool), |
| 452 base_(this, max_sockets, max_sockets_per_group, histograms, | 449 base_(this, max_sockets, max_sockets_per_group, histograms, |
| 453 ClientSocketPool::unused_idle_socket_timeout(), | 450 ClientSocketPool::unused_idle_socket_timeout(), |
| 454 ClientSocketPool::used_idle_socket_timeout(), | 451 ClientSocketPool::used_idle_socket_timeout(), |
| 455 new HttpProxyConnectJobFactory(transport_pool, | 452 new HttpProxyConnectJobFactory(transport_pool, |
| 456 ssl_pool, | 453 ssl_pool, |
| 457 host_resolver, | |
| 458 net_log)) { | 454 net_log)) { |
| 459 // We should always have a |transport_pool_| except in unit tests. | 455 // We should always have a |transport_pool_| except in unit tests. |
| 460 if (transport_pool_) | 456 if (transport_pool_) |
| 461 base_.AddLowerLayeredPool(transport_pool_); | 457 base_.AddLowerLayeredPool(transport_pool_); |
| 462 if (ssl_pool_) | 458 if (ssl_pool_) |
| 463 base_.AddLowerLayeredPool(ssl_pool_); | 459 base_.AddLowerLayeredPool(ssl_pool_); |
| 464 } | 460 } |
| 465 | 461 |
| 466 HttpProxyClientSocketPool::~HttpProxyClientSocketPool() { | 462 HttpProxyClientSocketPool::~HttpProxyClientSocketPool() { |
| 467 } | 463 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 base_.RemoveHigherLayeredPool(higher_pool); | 562 base_.RemoveHigherLayeredPool(higher_pool); |
| 567 } | 563 } |
| 568 | 564 |
| 569 bool HttpProxyClientSocketPool::CloseOneIdleConnection() { | 565 bool HttpProxyClientSocketPool::CloseOneIdleConnection() { |
| 570 if (base_.CloseOneIdleSocket()) | 566 if (base_.CloseOneIdleSocket()) |
| 571 return true; | 567 return true; |
| 572 return base_.CloseOneIdleConnectionInHigherLayeredPool(); | 568 return base_.CloseOneIdleConnectionInHigherLayeredPool(); |
| 573 } | 569 } |
| 574 | 570 |
| 575 } // namespace net | 571 } // namespace net |
| OLD | NEW |