summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-25 21:20:27 +0000
committerrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-25 21:20:27 +0000
commitf4580339db115c23098d09545db9c50a83e2e3e2 (patch)
treee94a0872d826a3877bf2dff330ce82b97c107250
parent02b0c3408a241a812a46b20c1cc361cba5d2bf9b (diff)
downloadchromium_src-f4580339db115c23098d09545db9c50a83e2e3e2.zip
chromium_src-f4580339db115c23098d09545db9c50a83e2e3e2.tar.gz
chromium_src-f4580339db115c23098d09545db9c50a83e2e3e2.tar.bz2
Remove the references to HttpNetworkSession in SpdySession
and replace it with a reference to the SpdySessionPool and SpdySettingStorage, which are actually required. Modified SpdySessionPool to take a pointer to SpdySettingsStorage instead of to HttpNetworkSession in both GetSpdySessionFromSocket() Get(). Modified HttpStreamRequest (and various unit tests) accordingly when calling these methods. Review URL: http://codereview.chromium.org/3400024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60590 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--net/http/http_network_transaction_unittest.cc6
-rw-r--r--net/http/http_stream_request.cc9
-rw-r--r--net/spdy/spdy_http_stream_unittest.cc2
-rw-r--r--net/spdy/spdy_network_transaction_unittest.cc3
-rw-r--r--net/spdy/spdy_session.cc17
-rw-r--r--net/spdy/spdy_session.h10
-rw-r--r--net/spdy/spdy_session_pool.cc13
-rw-r--r--net/spdy/spdy_session_pool.h5
-rw-r--r--net/spdy/spdy_session_unittest.cc6
-rw-r--r--net/spdy/spdy_stream_unittest.cc4
10 files changed, 43 insertions, 32 deletions
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index 91e0062..91bd76e 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -6243,7 +6243,8 @@ TEST_F(HttpNetworkTransactionTest,
HostPortPair host_port_pair("www.google.com", 443);
HostPortProxyPair pair(host_port_pair, ProxyServer::Direct());
scoped_refptr<SpdySession> spdy_session =
- session->spdy_session_pool()->Get(pair, session, BoundNetLog());
+ session->spdy_session_pool()->Get(pair, session->mutable_spdy_settings(),
+ BoundNetLog());
scoped_refptr<TCPSocketParams> tcp_params =
new TCPSocketParams("www.google.com", 443, MEDIUM, GURL(), false);
@@ -7418,7 +7419,8 @@ TEST_F(HttpNetworkTransactionTest, PreconnectWithExistingSpdySession) {
HostPortPair host_port_pair("www.google.com", 443);
HostPortProxyPair pair(host_port_pair, ProxyServer::Direct());
scoped_refptr<SpdySession> spdy_session =
- session->spdy_session_pool()->Get(pair, session, BoundNetLog());
+ session->spdy_session_pool()->Get(pair, session->mutable_spdy_settings(),
+ BoundNetLog());
scoped_refptr<TCPSocketParams> tcp_params =
new TCPSocketParams("www.google.com", 443, MEDIUM, GURL(), false);
TestCompletionCallback callback;
diff --git a/net/http/http_stream_request.cc b/net/http/http_stream_request.cc
index d772e9f..2761e1b 100644
--- a/net/http/http_stream_request.cc
+++ b/net/http/http_stream_request.cc
@@ -698,13 +698,14 @@ int HttpStreamRequest::DoCreateStream() {
// We have a SPDY session to the origin server. This might be a direct
// connection, or it might be a SPDY session through an HTTP or HTTPS proxy.
spdy_session =
- spdy_pool->Get(pair, session_, net_log_);
+ spdy_pool->Get(pair, session_->mutable_spdy_settings(), net_log_);
} else if (proxy_info()->is_https()) {
// If we don't have a direct SPDY session, and we're using an HTTPS
// proxy, then we might have a SPDY session to the proxy
pair = HostPortProxyPair(proxy_server.host_port_pair(), proxy_server);
if (spdy_pool->HasSession(pair)) {
- spdy_session = spdy_pool->Get(pair, session_, net_log_);
+ spdy_session =
+ spdy_pool->Get(pair, session_->mutable_spdy_settings(), net_log_);
}
direct = false;
}
@@ -715,8 +716,8 @@ int HttpStreamRequest::DoCreateStream() {
// contain an SSLClientSocket.
CHECK(connection_->socket());
int error = spdy_pool->GetSpdySessionFromSocket(
- pair, session_, connection_.release(), net_log_,
- spdy_certificate_error_, &spdy_session, using_ssl_);
+ pair, session_->mutable_spdy_settings(), connection_.release(),
+ net_log_, spdy_certificate_error_, &spdy_session, using_ssl_);
if (error != OK)
return error;
}
diff --git a/net/spdy/spdy_http_stream_unittest.cc b/net/spdy/spdy_http_stream_unittest.cc
index c3a6fdc..ee1a34e 100644
--- a/net/spdy/spdy_http_stream_unittest.cc
+++ b/net/spdy/spdy_http_stream_unittest.cc
@@ -30,7 +30,7 @@ class SpdyHttpStreamTest : public testing::Test {
session_deps_.socket_factory->AddSocketDataProvider(data_.get());
http_session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_);
session_ = http_session_->spdy_session_pool()->
- Get(pair, http_session_.get(), BoundNetLog());
+ Get(pair, http_session_->mutable_spdy_settings(), BoundNetLog());
tcp_params_ = new TCPSocketParams(host_port_pair.host(),
host_port_pair.port(),
MEDIUM, GURL(), false);
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc
index bed0b08..2131c49 100644
--- a/net/spdy/spdy_network_transaction_unittest.cc
+++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -365,7 +365,8 @@ class SpdyNetworkTransactionTest
const scoped_refptr<HttpNetworkSession>& session = helper.session();
scoped_refptr<SpdySessionPool> pool(session->spdy_session_pool());
EXPECT_TRUE(pool->HasSession(pair));
- scoped_refptr<SpdySession> spdy_session(pool->Get(pair, session, log));
+ scoped_refptr<SpdySession> spdy_session(
+ pool->Get(pair, session->mutable_spdy_settings(), log));
ASSERT_TRUE(spdy_session.get() != NULL);
EXPECT_EQ(0u, spdy_session->num_active_streams());
EXPECT_EQ(0u, spdy_session->num_unclaimed_pushed_streams());
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 304562b..2be38fb 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -216,14 +216,16 @@ bool SpdySession::use_ssl_ = true;
bool SpdySession::use_flow_control_ = false;
SpdySession::SpdySession(const HostPortProxyPair& host_port_proxy_pair,
- HttpNetworkSession* session,
+ SpdySessionPool* spdy_session_pool,
+ SpdySettingsStorage* spdy_settings,
NetLog* net_log)
: ALLOW_THIS_IN_INITIALIZER_LIST(
read_callback_(this, &SpdySession::OnReadComplete)),
ALLOW_THIS_IN_INITIALIZER_LIST(
write_callback_(this, &SpdySession::OnWriteComplete)),
host_port_proxy_pair_(host_port_proxy_pair),
- session_(session),
+ spdy_session_pool_(spdy_session_pool),
+ spdy_settings_(spdy_settings),
connection_(new ClientSocketHandle),
read_buffer_(new IOBuffer(kReadBufferSize)),
read_pending_(false),
@@ -867,7 +869,7 @@ void SpdySession::DeleteStream(spdy::SpdyStreamId id, int status) {
void SpdySession::RemoveFromPool() {
if (in_session_pool_) {
- session_->spdy_session_pool()->Remove(this);
+ spdy_session_pool_->Remove(this);
in_session_pool_ = false;
}
}
@@ -1158,8 +1160,7 @@ void SpdySession::OnSettings(const spdy::SpdySettingsControlFrame& frame) {
spdy::SpdySettings settings;
if (spdy_framer_.ParseSettings(&frame, &settings)) {
HandleSettings(settings);
- SpdySettingsStorage* settings_storage = session_->mutable_spdy_settings();
- settings_storage->Set(host_port_pair(), settings);
+ spdy_settings_->Set(host_port_pair(), settings);
}
received_settings_ = true;
@@ -1217,8 +1218,7 @@ void SpdySession::SendWindowUpdate(spdy::SpdyStreamId stream_id,
}
void SpdySession::SendSettings() {
- const SpdySettingsStorage& settings_storage = session_->spdy_settings();
- const spdy::SpdySettings& settings = settings_storage.Get(host_port_pair());
+ const spdy::SpdySettings& settings = spdy_settings_->Get(host_port_pair());
if (settings.empty())
return;
HandleSettings(settings);
@@ -1268,8 +1268,7 @@ void SpdySession::RecordHistograms() {
if (received_settings_) {
// Enumerate the saved settings, and set histograms for it.
- const SpdySettingsStorage& settings_storage = session_->spdy_settings();
- const spdy::SpdySettings& settings = settings_storage.Get(host_port_pair());
+ const spdy::SpdySettings& settings = spdy_settings_->Get(host_port_pair());
spdy::SpdySettings::const_iterator it;
for (it = settings.begin(); it != settings.end(); ++it) {
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h
index e98a478..2894471 100644
--- a/net/spdy/spdy_session.h
+++ b/net/spdy/spdy_session.h
@@ -39,9 +39,9 @@ namespace net {
const int kMss = 1430;
const int kMaxSpdyFrameChunkSize = (2 * kMss) - spdy::SpdyFrame::size();
-class SpdyStream;
-class HttpNetworkSession;
class BoundNetLog;
+class SpdySettingsStorage;
+class SpdyStream;
class SSLInfo;
class SpdySession : public base::RefCounted<SpdySession>,
@@ -53,7 +53,8 @@ class SpdySession : public base::RefCounted<SpdySession>,
// |session| is the HttpNetworkSession. |net_log| is the NetLog that we log
// network events to.
SpdySession(const HostPortProxyPair& host_port_proxy_pair,
- HttpNetworkSession* session,
+ SpdySessionPool* spdy_session_pool,
+ SpdySettingsStorage* spdy_settings,
NetLog* net_log);
const HostPortPair& host_port_pair() const {
@@ -286,7 +287,8 @@ class SpdySession : public base::RefCounted<SpdySession>,
// The domain this session is connected to.
const HostPortProxyPair host_port_proxy_pair_;
- scoped_refptr<HttpNetworkSession> session_;
+ scoped_refptr<SpdySessionPool> spdy_session_pool_;
+ SpdySettingsStorage* spdy_settings_;
// The socket handle for this session.
scoped_ptr<ClientSocketHandle> connection_;
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc
index 10f54f9..6c4ad52 100644
--- a/net/spdy/spdy_session_pool.cc
+++ b/net/spdy/spdy_session_pool.cc
@@ -5,6 +5,7 @@
#include "net/spdy/spdy_session_pool.h"
#include "base/logging.h"
+#include "net/http/http_network_session.h"
#include "net/spdy/spdy_session.h"
namespace net {
@@ -30,7 +31,8 @@ SpdySessionPool::~SpdySessionPool() {
}
scoped_refptr<SpdySession> SpdySessionPool::Get(
- const HostPortProxyPair& host_port_proxy_pair, HttpNetworkSession* session,
+ const HostPortProxyPair& host_port_proxy_pair,
+ SpdySettingsStorage* spdy_settings,
const BoundNetLog& net_log) {
scoped_refptr<SpdySession> spdy_session;
SpdySessionList* list = GetSessionList(host_port_proxy_pair);
@@ -48,8 +50,7 @@ scoped_refptr<SpdySession> SpdySessionPool::Get(
DCHECK(list);
if (!spdy_session) {
- spdy_session = new SpdySession(host_port_proxy_pair,
- session,
+ spdy_session = new SpdySession(host_port_proxy_pair, this, spdy_settings,
net_log.net_log());
net_log.AddEvent(NetLog::TYPE_SPDY_SESSION_POOL_CREATED_NEW_SESSION,
new NetLogSourceParameter("session",
@@ -64,15 +65,15 @@ scoped_refptr<SpdySession> SpdySessionPool::Get(
net::Error SpdySessionPool::GetSpdySessionFromSocket(
const HostPortProxyPair& host_port_proxy_pair,
- HttpNetworkSession* session,
+ SpdySettingsStorage* spdy_settings,
ClientSocketHandle* connection,
const BoundNetLog& net_log,
int certificate_error_code,
scoped_refptr<SpdySession>* spdy_session,
bool is_secure) {
// Create the SPDY session and add it to the pool.
- *spdy_session = new SpdySession(host_port_proxy_pair,
- session, net_log.net_log());
+ *spdy_session = new SpdySession(host_port_proxy_pair, this, spdy_settings,
+ net_log.net_log());
SpdySessionList* list = GetSessionList(host_port_proxy_pair);
if (!list)
list = AddSessionList(host_port_proxy_pair);
diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h
index 9d8d693..7dc5f27 100644
--- a/net/spdy/spdy_session_pool.h
+++ b/net/spdy/spdy_session_pool.h
@@ -30,6 +30,7 @@ class BoundNetLog;
class ClientSocketHandle;
class HttpNetworkSession;
class SpdySession;
+class SpdySettingsStorage;
// This is a very simple pool for open SpdySessions.
// TODO(mbelshe): Make this production ready.
@@ -44,7 +45,7 @@ class SpdySessionPool
// use.
scoped_refptr<SpdySession> Get(
const HostPortProxyPair& host_port_proxy_pair,
- HttpNetworkSession* session,
+ SpdySettingsStorage* spdy_settings,
const BoundNetLog& net_log);
// Set the maximum concurrent sessions per domain.
@@ -65,7 +66,7 @@ class SpdySessionPool
// Returns an error on failure, and |spdy_session| will be NULL.
net::Error GetSpdySessionFromSocket(
const HostPortProxyPair& host_port_proxy_pair,
- HttpNetworkSession* session,
+ SpdySettingsStorage* spdy_settings,
ClientSocketHandle* connection,
const BoundNetLog& net_log,
int certificate_error_code,
diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc
index faa8433..d39a09e 100644
--- a/net/spdy/spdy_session_unittest.cc
+++ b/net/spdy/spdy_session_unittest.cc
@@ -86,7 +86,8 @@ TEST_F(SpdySessionTest, GoAway) {
http_session->spdy_session_pool());
EXPECT_FALSE(spdy_session_pool->HasSession(pair));
scoped_refptr<SpdySession> session =
- spdy_session_pool->Get(pair, http_session.get(), BoundNetLog());
+ spdy_session_pool->Get(pair, http_session->mutable_spdy_settings(),
+ BoundNetLog());
EXPECT_TRUE(spdy_session_pool->HasSession(pair));
scoped_refptr<TCPSocketParams> tcp_params =
@@ -104,7 +105,8 @@ TEST_F(SpdySessionTest, GoAway) {
EXPECT_FALSE(spdy_session_pool->HasSession(pair));
scoped_refptr<SpdySession> session2 =
- spdy_session_pool->Get(pair, http_session.get(), BoundNetLog());
+ spdy_session_pool->Get(pair, http_session->mutable_spdy_settings(),
+ BoundNetLog());
// Delete the first session.
session = NULL;
diff --git a/net/spdy/spdy_stream_unittest.cc b/net/spdy/spdy_stream_unittest.cc
index 54ea82d..84d21d3 100644
--- a/net/spdy/spdy_stream_unittest.cc
+++ b/net/spdy/spdy_stream_unittest.cc
@@ -116,7 +116,9 @@ class SpdyStreamTest : public testing::Test {
HostPortPair host_port_pair("www.google.com", 80);
HostPortProxyPair pair(host_port_pair, ProxyServer::Direct());
scoped_refptr<SpdySession> session(
- session_->spdy_session_pool()->Get(pair, session_, BoundNetLog()));
+ session_->spdy_session_pool()->Get(pair,
+ session_->mutable_spdy_settings(),
+ BoundNetLog()));
return session;
}