diff options
author | mbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-05 20:49:02 +0000 |
---|---|---|
committer | mbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-05 20:49:02 +0000 |
commit | 4a5e1780401366315132683fa5079c6690e50156 (patch) | |
tree | 10d6a63b7b52345bcc58dba71a7c8bcf697de003 /net | |
parent | 2539acbc3e92658bd4a6178896de85650e18860b (diff) | |
download | chromium_src-4a5e1780401366315132683fa5079c6690e50156.zip chromium_src-4a5e1780401366315132683fa5079c6690e50156.tar.gz chromium_src-4a5e1780401366315132683fa5079c6690e50156.tar.bz2 |
Add command line option for changing the max number of SPDY sessions per
domain. The default remains at 1.
Command line usage to set it to 13:
chrome.exe --use-spdy --max-spdy-sessions-per-domain=13
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/669169
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40775 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/spdy/spdy_session_pool.cc | 6 | ||||
-rw-r--r-- | net/spdy/spdy_session_pool.h | 8 |
2 files changed, 12 insertions, 2 deletions
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc index 0f012fb..5cfd62c 100644 --- a/net/spdy/spdy_session_pool.cc +++ b/net/spdy/spdy_session_pool.cc @@ -12,6 +12,8 @@ namespace net { // The maximum number of sessions to open to a single domain. static const size_t kMaxSessionsPerDomain = 1; +int SpdySessionPool::g_max_sessions_per_domain = kMaxSessionsPerDomain; + SpdySessionPool::SpdySessionPool() {} SpdySessionPool::~SpdySessionPool() { CloseAllSessions(); @@ -22,7 +24,7 @@ scoped_refptr<SpdySession> SpdySessionPool::Get( scoped_refptr<SpdySession> spdy_session; SpdySessionList* list = GetSessionList(host_port_pair); if (list) { - if (list->size() >= kMaxSessionsPerDomain) { + if (list->size() >= static_cast<unsigned int>(g_max_sessions_per_domain)) { spdy_session = list->front(); list->pop_front(); } @@ -36,7 +38,7 @@ scoped_refptr<SpdySession> SpdySessionPool::Get( DCHECK(spdy_session); list->push_back(spdy_session); - DCHECK(list->size() <= kMaxSessionsPerDomain); + DCHECK_LE(list->size(), static_cast<unsigned int>(g_max_sessions_per_domain)); return spdy_session; } diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h index 8cf8c60..8c50577 100644 --- a/net/spdy/spdy_session_pool.h +++ b/net/spdy/spdy_session_pool.h @@ -47,6 +47,12 @@ class SpdySessionPool : public base::RefCounted<SpdySessionPool> { scoped_refptr<SpdySession> Get( const HostPortPair& host_port_pair, HttpNetworkSession* session); + // Set the maximum concurrent sessions per domain. + static void set_max_sessions_per_domain(int max) { + if (max >= 1) + g_max_sessions_per_domain = max; + } + // Builds a SpdySession from an existing SSL socket. Users should try // calling Get() first to use an existing SpdySession so we don't get // multiple SpdySessions per domain. Note that ownership of |connection| is @@ -86,6 +92,8 @@ class SpdySessionPool : public base::RefCounted<SpdySessionPool> { // This is our weak session pool - one session per domain. SpdySessionsMap sessions_; + static int g_max_sessions_per_domain; + DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); }; |