diff options
author | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-20 00:43:22 +0000 |
---|---|---|
committer | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-20 00:43:22 +0000 |
commit | 5fe524efcaf51b401067d936b5ff331249dc99df (patch) | |
tree | 6682f9e38cdce9d6d5f2f8a341d57642d6befe2c /net | |
parent | a04aef09a3b4264a86f52f055c8593d8a8979798 (diff) | |
download | chromium_src-5fe524efcaf51b401067d936b5ff331249dc99df.zip chromium_src-5fe524efcaf51b401067d936b5ff331249dc99df.tar.gz chromium_src-5fe524efcaf51b401067d936b5ff331249dc99df.tar.bz2 |
Make explicit the assumption that SpdySession::InitializeWithSocket takes
an SSLClientSocket by renaming the methods and adding a DCHECK.
R=willchan
BUG=none
TEST=No compilation errors.
Review URL: http://codereview.chromium.org/650085
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39528 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/http/http_network_transaction.cc | 5 | ||||
-rw-r--r-- | net/spdy/spdy_session.cc | 7 | ||||
-rw-r--r-- | net/spdy/spdy_session.h | 4 | ||||
-rw-r--r-- | net/spdy/spdy_session_pool.cc | 4 | ||||
-rw-r--r-- | net/spdy/spdy_session_pool.h | 8 |
5 files changed, 14 insertions, 14 deletions
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index 89325e0..ba8f3c9 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -1136,7 +1136,10 @@ int HttpNetworkTransaction::DoSpdySendRequest() { if (spdy_pool->HasSession(req_info)) { spdy_session = spdy_pool->Get(req_info, session_); } else { - spdy_session = spdy_pool->GetSpdySessionFromSocket( + // SPDY is negotiated using the TLS next protocol negotiation (NPN) + // extension, so |connection_| must contain an SSLClientSocket. + DCHECK(using_ssl_); + spdy_session = spdy_pool->GetSpdySessionFromSSLSocket( req_info, session_, connection_.release()); } diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index 3560fd8e..e8b3238 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -241,7 +241,7 @@ SpdySession::~SpdySession() { 0, 300, 50); } -void SpdySession::InitializeWithSocket(ClientSocketHandle* connection) { +void SpdySession::InitializeWithSSLSocket(ClientSocketHandle* connection) { static StatsCounter spdy_sessions("spdy.sessions"); spdy_sessions.Increment(); @@ -249,10 +249,7 @@ void SpdySession::InitializeWithSocket(ClientSocketHandle* connection) { state_ = CONNECTED; connection_.reset(connection); - // InitializeWithSocket is called only when we use NPN (next protocol - // negotiation), which is a TLS extension, so |connection| must contain an - // SSLClientSocket. - is_secure_ = true; + is_secure_ = true; // |connection| contains an SSLClientSocket. // This is a newly initialized session that no client should have a handle to // yet, so there's no need to start writing data as in OnTCPConnect(), but we diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h index e443580..e173a6a 100644 --- a/net/spdy/spdy_session.h +++ b/net/spdy/spdy_session.h @@ -108,8 +108,8 @@ class SpdySession : public base::RefCounted<SpdySession>, virtual ~SpdySession(); - // Used by SpdySessionPool to initialize with a pre-existing socket. - void InitializeWithSocket(ClientSocketHandle* connection); + // Used by SpdySessionPool to initialize with a pre-existing SSL socket. + void InitializeWithSSLSocket(ClientSocketHandle* connection); // SpdyFramerVisitorInterface virtual void OnError(spdy::SpdyFramer*); diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc index 67625fc..5e60350 100644 --- a/net/spdy/spdy_session_pool.cc +++ b/net/spdy/spdy_session_pool.cc @@ -41,7 +41,7 @@ scoped_refptr<SpdySession> SpdySessionPool::Get( return spdy_session; } -scoped_refptr<SpdySession> SpdySessionPool::GetSpdySessionFromSocket( +scoped_refptr<SpdySession> SpdySessionPool::GetSpdySessionFromSSLSocket( const HostResolver::RequestInfo& info, HttpNetworkSession* session, ClientSocketHandle* connection) { @@ -51,7 +51,7 @@ scoped_refptr<SpdySession> SpdySessionPool::GetSpdySessionFromSocket( list = AddSessionList(domain); DCHECK(list->empty()); scoped_refptr<SpdySession> spdy_session(new SpdySession(domain, session)); - spdy_session->InitializeWithSocket(connection); + spdy_session->InitializeWithSSLSocket(connection); list->push_back(spdy_session); return spdy_session; } diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h index 108f3e7..f118dbd 100644 --- a/net/spdy/spdy_session_pool.h +++ b/net/spdy/spdy_session_pool.h @@ -30,11 +30,11 @@ class SpdySessionPool : public base::RefCounted<SpdySessionPool> { scoped_refptr<SpdySession> Get( const HostResolver::RequestInfo& info, HttpNetworkSession* session); - // Builds a SpdySession from an existing 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 + // 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 // transferred from the caller to the SpdySession. - scoped_refptr<SpdySession> GetSpdySessionFromSocket( + scoped_refptr<SpdySession> GetSpdySessionFromSSLSocket( const HostResolver::RequestInfo& info, HttpNetworkSession* session, ClientSocketHandle* connection); |