diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-08 04:22:44 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-08 04:22:44 +0000 |
commit | 0d8fa3ecb7ed0a7f6e0d9cd0a750a29bd8bed370 (patch) | |
tree | c4cb5532d0bee1567641c0cc7147d8b1ebbad5f1 /net | |
parent | bb39f362bd5222de3b9f3f7ab2d5bb69c2aeca39 (diff) | |
download | chromium_src-0d8fa3ecb7ed0a7f6e0d9cd0a750a29bd8bed370.zip chromium_src-0d8fa3ecb7ed0a7f6e0d9cd0a750a29bd8bed370.tar.gz chromium_src-0d8fa3ecb7ed0a7f6e0d9cd0a750a29bd8bed370.tar.bz2 |
DNS prefetch experiment extension: Consider different connection count limits
This CL both enables selection of a run-time selected limit
on the number of connections to a single host, and varies
that limit to see how it relates to DNS prefetch latency
in connections.
r=wtc
Review URL: http://codereview.chromium.org/62083
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13339 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/http/http_network_session.cc | 22 | ||||
-rw-r--r-- | net/http/http_network_session.h | 14 | ||||
-rw-r--r-- | net/net.gyp | 1 |
3 files changed, 31 insertions, 6 deletions
diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc new file mode 100644 index 0000000..a498ed0 --- /dev/null +++ b/net/http/http_network_session.cc @@ -0,0 +1,22 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "net/http/http_network_session.h" + +#include "base/logging.h" + +namespace net { + +// static +int HttpNetworkSession::max_sockets_per_group_ = 6; + +// static +void HttpNetworkSession::set_max_sockets_per_group(int socket_count) { + DCHECK(0 < socket_count); + // The following is a sanity check... but we should NEVER be near this value. + DCHECK(100 > socket_count); + max_sockets_per_group_ = socket_count; +} + +} // namespace net diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h index 2dd1b89..7c4ac68 100644 --- a/net/http/http_network_session.h +++ b/net/http/http_network_session.h @@ -17,13 +17,8 @@ class ProxyService; // This class holds session objects used by HttpNetworkTransaction objects. class HttpNetworkSession : public base::RefCounted<HttpNetworkSession> { public: - // Allow up to 6 connections per host. - enum { - MAX_SOCKETS_PER_GROUP = 6 - }; - explicit HttpNetworkSession(ProxyService* proxy_service) - : connection_pool_(new ClientSocketPool(MAX_SOCKETS_PER_GROUP)), + : connection_pool_(new ClientSocketPool(max_sockets_per_group_)), proxy_service_(proxy_service) { DCHECK(proxy_service); } @@ -35,7 +30,14 @@ class HttpNetworkSession : public base::RefCounted<HttpNetworkSession> { SSLConfigService* ssl_config_service() { return &ssl_config_service_; } #endif + static void set_max_sockets_per_group(int socket_count); + private: + // Default to allow up to 6 connections per host. Experiment and tuning may + // try other values (greater than 0). Too large may cause many problems, such + // as home routers blocking the connections!?!? + static int max_sockets_per_group_; + HttpAuthCache auth_cache_; scoped_refptr<ClientSocketPool> connection_pool_; ProxyService* proxy_service_; diff --git a/net/net.gyp b/net/net.gyp index ca972fc..cfd17f6 100644 --- a/net/net.gyp +++ b/net/net.gyp @@ -217,6 +217,7 @@ 'http/http_chunked_decoder.h', 'http/http_network_layer.cc', 'http/http_network_layer.h', + 'http/http_network_session.cc', 'http/http_network_session.h', 'http/http_network_transaction.cc', 'http/http_network_transaction.h', |