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

Unified Diff: net/http/http_proxy_client_socket_pool.cc

Issue 2899313006: Plumb NQP to context and to http_proxy_client_socket_pool (Closed)
Patch Set: fix compile error Created 3 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_proxy_client_socket_pool.h ('k') | net/http/http_proxy_client_socket_pool_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_proxy_client_socket_pool.cc
diff --git a/net/http/http_proxy_client_socket_pool.cc b/net/http/http_proxy_client_socket_pool.cc
index 7375920d8a2daa0b4e83ed0a2447d5243913c7a5..37a23bd63d6bf4b040e3f51518fc19415b8710e4 100644
--- a/net/http/http_proxy_client_socket_pool.cc
+++ b/net/http/http_proxy_client_socket_pool.cc
@@ -32,6 +32,20 @@
namespace net {
+namespace {
+
+// HttpProxyConnectJobs will time out after this many seconds. Note this is on
+// top of the timeout for the transport socket.
+// TODO(kundaji): Proxy connect timeout should be independent of platform and be
+// based on proxy. Bug http://crbug.com/407446.
+#if defined(OS_ANDROID) || defined(OS_IOS)
+static const int kHttpProxyConnectJobTimeoutInSeconds = 10;
+#else
+static const int kHttpProxyConnectJobTimeoutInSeconds = 30;
+#endif
+
+} // namespace
+
HttpProxySocketParams::HttpProxySocketParams(
const scoped_refptr<TransportSocketParams>& transport_params,
const scoped_refptr<SSLSocketParams>& ssl_params,
@@ -65,16 +79,6 @@ const HostResolver::RequestInfo& HttpProxySocketParams::destination() const {
HttpProxySocketParams::~HttpProxySocketParams() {}
-// HttpProxyConnectJobs will time out after this many seconds. Note this is on
-// top of the timeout for the transport socket.
-// TODO(kundaji): Proxy connect timeout should be independent of platform and be
-// based on proxy. Bug http://crbug.com/407446.
-#if defined(OS_ANDROID) || defined(OS_IOS)
-static const int kHttpProxyConnectJobTimeoutInSeconds = 10;
-#else
-static const int kHttpProxyConnectJobTimeoutInSeconds = 30;
-#endif
-
HttpProxyConnectJob::HttpProxyConnectJob(
const std::string& group_name,
RequestPriority priority,
@@ -149,29 +153,15 @@ int HttpProxyConnectJob::HandleConnectResult(int result) {
return result;
}
-HttpProxyClientSocketPool::
-HttpProxyConnectJobFactory::HttpProxyConnectJobFactory(
- TransportClientSocketPool* transport_pool,
- SSLClientSocketPool* ssl_pool,
- NetLog* net_log)
+HttpProxyClientSocketPool::HttpProxyConnectJobFactory::
+ HttpProxyConnectJobFactory(TransportClientSocketPool* transport_pool,
+ SSLClientSocketPool* ssl_pool,
+ NetworkQualityProvider* network_quality_provider,
+ NetLog* net_log)
: transport_pool_(transport_pool),
ssl_pool_(ssl_pool),
- net_log_(net_log) {
- base::TimeDelta max_pool_timeout = base::TimeDelta();
-
-// TODO(kundaji): Proxy connect timeout should be independent of platform and be
-// based on proxy. Bug http://crbug.com/407446.
-#if (defined(OS_ANDROID) || defined(OS_IOS))
-#else
- if (transport_pool_)
- max_pool_timeout = transport_pool_->ConnectionTimeout();
- if (ssl_pool_)
- max_pool_timeout = std::max(max_pool_timeout,
- ssl_pool_->ConnectionTimeout());
-#endif
- timeout_ = max_pool_timeout +
- base::TimeDelta::FromSeconds(kHttpProxyConnectJobTimeoutInSeconds);
-}
+ network_quality_provider_(network_quality_provider),
+ net_log_(net_log) {}
std::unique_ptr<ConnectJob>
HttpProxyClientSocketPool::HttpProxyConnectJobFactory::NewConnectJob(
@@ -187,7 +177,23 @@ HttpProxyClientSocketPool::HttpProxyConnectJobFactory::NewConnectJob(
base::TimeDelta
HttpProxyClientSocketPool::HttpProxyConnectJobFactory::ConnectionTimeout(
) const {
- return timeout_;
+ // TODO(tbansal): https://crbug.com/704339. Use |network_quality_provider_|
+ // and field trial to determine the connection timeout.
+ ALLOW_UNUSED_LOCAL(network_quality_provider_);
+
+ // Return the default proxy connection timeout.
+ base::TimeDelta max_pool_timeout = base::TimeDelta();
+#if (!defined(OS_ANDROID) && !defined(OS_IOS))
+ if (transport_pool_)
+ max_pool_timeout = transport_pool_->ConnectionTimeout();
+ if (ssl_pool_) {
+ max_pool_timeout =
+ std::max(max_pool_timeout, ssl_pool_->ConnectionTimeout());
+ }
+#endif // !defined(OS_ANDROID) && !defined(OS_IOS)
+
+ return max_pool_timeout +
+ base::TimeDelta::FromSeconds(kHttpProxyConnectJobTimeoutInSeconds);
}
HttpProxyClientSocketPool::HttpProxyClientSocketPool(
@@ -195,6 +201,7 @@ HttpProxyClientSocketPool::HttpProxyClientSocketPool(
int max_sockets_per_group,
TransportClientSocketPool* transport_pool,
SSLClientSocketPool* ssl_pool,
+ NetworkQualityProvider* network_quality_provider,
NetLog* net_log)
: transport_pool_(transport_pool),
ssl_pool_(ssl_pool),
@@ -203,7 +210,10 @@ HttpProxyClientSocketPool::HttpProxyClientSocketPool(
max_sockets_per_group,
ClientSocketPool::unused_idle_socket_timeout(),
ClientSocketPool::used_idle_socket_timeout(),
- new HttpProxyConnectJobFactory(transport_pool, ssl_pool, net_log)) {
+ new HttpProxyConnectJobFactory(transport_pool,
+ ssl_pool,
+ network_quality_provider,
+ net_log)) {
// We should always have a |transport_pool_| except in unit tests.
if (transport_pool_)
base_.AddLowerLayeredPool(transport_pool_);
« no previous file with comments | « net/http/http_proxy_client_socket_pool.h ('k') | net/http/http_proxy_client_socket_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698