summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/http/http_network_layer.cc17
-rw-r--r--net/http/http_network_layer.h2
-rw-r--r--net/http/http_network_session.h8
-rw-r--r--net/http/http_network_session_peer.h78
-rw-r--r--net/http/http_network_transaction_unittest.cc62
-rw-r--r--net/http/http_stream_request.cc3
-rw-r--r--net/net.gyp1
-rw-r--r--net/spdy/spdy_network_transaction_unittest.cc14
-rw-r--r--net/spdy/spdy_session.cc5
-rw-r--r--net/spdy/spdy_session.h12
-rw-r--r--net/spdy/spdy_session_pool.cc2
-rw-r--r--net/spdy/spdy_session_pool.h7
-rw-r--r--net/spdy/spdy_session_unittest.cc3
-rw-r--r--net/spdy/spdy_stream_unittest.cc4
-rw-r--r--net/spdy/spdy_test_util.h15
15 files changed, 106 insertions, 127 deletions
diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc
index a883db2..65d2aa3 100644
--- a/net/http/http_network_layer.cc
+++ b/net/http/http_network_layer.cc
@@ -94,7 +94,7 @@ HttpNetworkLayer::HttpNetworkLayer(HttpNetworkSession* session)
: socket_factory_(ClientSocketFactory::GetDefaultFactory()),
ssl_config_service_(NULL),
session_(session),
- spdy_session_pool_(NULL),
+ spdy_session_pool_(session->spdy_session_pool()),
http_auth_handler_factory_(NULL),
network_delegate_(NULL),
net_log_(NULL),
@@ -127,17 +127,10 @@ void HttpNetworkLayer::Suspend(bool suspend) {
HttpNetworkSession* HttpNetworkLayer::GetSession() {
if (!session_) {
DCHECK(proxy_service_);
- if (!spdy_session_pool_.get())
- spdy_session_pool_.reset(new SpdySessionPool(ssl_config_service_));
- session_ = new HttpNetworkSession(
- host_resolver_,
- proxy_service_,
- socket_factory_,
- ssl_config_service_,
- spdy_session_pool_.release(),
- http_auth_handler_factory_,
- network_delegate_,
- net_log_);
+ SpdySessionPool* spdy_pool = new SpdySessionPool(ssl_config_service_);
+ session_ = new HttpNetworkSession(host_resolver_, proxy_service_,
+ socket_factory_, ssl_config_service_, spdy_pool,
+ http_auth_handler_factory_, network_delegate_, net_log_);
// These were just temps for lazy-initializing HttpNetworkSession.
host_resolver_ = NULL;
proxy_service_ = NULL;
diff --git a/net/http/http_network_layer.h b/net/http/http_network_layer.h
index 9d8b838..f4ce1f1 100644
--- a/net/http/http_network_layer.h
+++ b/net/http/http_network_layer.h
@@ -97,7 +97,7 @@ class HttpNetworkLayer : public HttpTransactionFactory, public NonThreadSafe {
scoped_refptr<SSLConfigService> ssl_config_service_;
scoped_refptr<HttpNetworkSession> session_;
- scoped_ptr<SpdySessionPool> spdy_session_pool_;
+ scoped_refptr<SpdySessionPool> spdy_session_pool_;
HttpAuthHandlerFactory* http_auth_handler_factory_;
HttpNetworkDelegate* network_delegate_;
diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h
index 1ee0bc5..3d1211c 100644
--- a/net/http/http_network_session.h
+++ b/net/http/http_network_session.h
@@ -105,7 +105,9 @@ class HttpNetworkSession : public base::RefCounted<HttpNetworkSession>,
HostResolver* host_resolver() { return host_resolver_; }
ProxyService* proxy_service() { return proxy_service_; }
SSLConfigService* ssl_config_service() { return ssl_config_service_; }
- SpdySessionPool* spdy_session_pool() { return spdy_session_pool_.get(); }
+ const scoped_refptr<SpdySessionPool>& spdy_session_pool() {
+ return spdy_session_pool_;
+ }
HttpAuthHandlerFactory* http_auth_handler_factory() {
return http_auth_handler_factory_;
}
@@ -141,9 +143,7 @@ class HttpNetworkSession : public base::RefCounted<HttpNetworkSession>,
scoped_refptr<ProxyService> proxy_service_;
scoped_refptr<SSLConfigService> ssl_config_service_;
ClientSocketPoolManager socket_pool_manager_;
- // TODO(willchan): Move this out to IOThread so it can be shared across
- // URLRequestContexts.
- scoped_ptr<SpdySessionPool> spdy_session_pool_;
+ scoped_refptr<SpdySessionPool> spdy_session_pool_;
scoped_refptr<HttpStreamFactory> http_stream_factory_;
HttpAuthHandlerFactory* http_auth_handler_factory_;
HttpNetworkDelegate* const network_delegate_;
diff --git a/net/http/http_network_session_peer.h b/net/http/http_network_session_peer.h
deleted file mode 100644
index 13f3fa7..0000000
--- a/net/http/http_network_session_peer.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (c) 2010 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.
-
-#ifndef NET_HTTP_HTTP_NETWORK_SESSION_PEER_H_
-#define NET_HTTP_HTTP_NETWORK_SESSION_PEER_H_
-#pragma once
-
-#include "net/http/http_network_session.h"
-#include "net/http/http_proxy_client_socket_pool.h"
-#include "net/socket/socks_client_socket_pool.h"
-#include "net/socket/ssl_client_socket_pool.h"
-
-namespace net {
-
-class HttpNetworkSessionPeer {
- public:
- explicit HttpNetworkSessionPeer(
- const scoped_refptr<HttpNetworkSession>& session)
- : session_(session) {}
-
- void SetTCPSocketPool(TCPClientSocketPool* pool) {
- session_->socket_pool_manager_.tcp_socket_pool_.reset(pool);
- }
-
- void SetSocketPoolForSOCKSProxy(
- const HostPortPair& socks_proxy,
- SOCKSClientSocketPool* pool) {
- ClientSocketPoolManager* socket_pool_manager =
- &session_->socket_pool_manager_;
-
- // Call through the public interface to force initialization of the
- // wrapped socket pools.
- delete socket_pool_manager->GetSocketPoolForSOCKSProxy(socks_proxy);
- socket_pool_manager->socks_socket_pools_[socks_proxy] = pool;
- }
-
- void SetSocketPoolForHTTPProxy(
- const HostPortPair& http_proxy,
- HttpProxyClientSocketPool* pool) {
- ClientSocketPoolManager* socket_pool_manager =
- &session_->socket_pool_manager_;
-
- // Call through the public interface to force initialization of the
- // wrapped socket pools.
- delete socket_pool_manager->GetSocketPoolForHTTPProxy(http_proxy);
- socket_pool_manager->http_proxy_socket_pools_[http_proxy] = pool;
- }
-
- void SetSSLSocketPool(SSLClientSocketPool* pool) {
- session_->socket_pool_manager_.ssl_socket_pool_.reset(pool);
- }
-
- void SetSocketPoolForSSLWithProxy(
- const HostPortPair& proxy_host,
- SSLClientSocketPool* pool) {
- ClientSocketPoolManager* socket_pool_manager =
- &session_->socket_pool_manager_;
-
- // Call through the public interface to force initialization of the
- // wrapped socket pools.
- delete socket_pool_manager->GetSocketPoolForSSLWithProxy(proxy_host);
- socket_pool_manager->ssl_socket_pools_for_proxies_[proxy_host] = pool;
- }
-
- void SetProxyService(ProxyService* proxy_service) {
- session_->proxy_service_ = proxy_service;
- }
-
- private:
- const scoped_refptr<HttpNetworkSession> session_;
-
- DISALLOW_COPY_AND_ASSIGN(HttpNetworkSessionPeer);
-};
-
-} // namespace net
-
-#endif // NET_HTTP_HTTP_NETWORK_SESSION_PEER_H_
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index d8b6ffc..68e4038 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -29,7 +29,6 @@
#include "net/http/http_auth_handler_ntlm.h"
#include "net/http/http_basic_stream.h"
#include "net/http/http_network_session.h"
-#include "net/http/http_network_session_peer.h"
#include "net/http/http_stream.h"
#include "net/http/http_stream_factory.h"
#include "net/http/http_transaction_unittest.h"
@@ -67,6 +66,62 @@ const string16 kWrongPassword(ASCIIToUTF16("wrongpassword"));
namespace net {
+class HttpNetworkSessionPeer {
+ public:
+ explicit HttpNetworkSessionPeer(
+ const scoped_refptr<HttpNetworkSession>& session)
+ : session_(session) {}
+
+ void SetTCPSocketPool(TCPClientSocketPool* pool) {
+ session_->socket_pool_manager_.tcp_socket_pool_.reset(pool);
+ }
+
+ void SetSocketPoolForSOCKSProxy(
+ const HostPortPair& socks_proxy,
+ SOCKSClientSocketPool* pool) {
+ ClientSocketPoolManager* socket_pool_manager =
+ &session_->socket_pool_manager_;
+
+ // Call through the public interface to force initialization of the
+ // wrapped socket pools.
+ delete socket_pool_manager->GetSocketPoolForSOCKSProxy(socks_proxy);
+ socket_pool_manager->socks_socket_pools_[socks_proxy] = pool;
+ }
+
+ void SetSocketPoolForHTTPProxy(
+ const HostPortPair& http_proxy,
+ HttpProxyClientSocketPool* pool) {
+ ClientSocketPoolManager* socket_pool_manager =
+ &session_->socket_pool_manager_;
+
+ // Call through the public interface to force initialization of the
+ // wrapped socket pools.
+ delete socket_pool_manager->GetSocketPoolForHTTPProxy(http_proxy);
+ socket_pool_manager->http_proxy_socket_pools_[http_proxy] = pool;
+ }
+
+ void SetSSLSocketPool(SSLClientSocketPool* pool) {
+ session_->socket_pool_manager_.ssl_socket_pool_.reset(pool);
+ }
+
+ void SetSocketPoolForSSLWithProxy(
+ const HostPortPair& proxy_host,
+ SSLClientSocketPool* pool) {
+ ClientSocketPoolManager* socket_pool_manager =
+ &session_->socket_pool_manager_;
+
+ // Call through the public interface to force initialization of the
+ // wrapped socket pools.
+ delete socket_pool_manager->GetSocketPoolForSSLWithProxy(proxy_host);
+ socket_pool_manager->ssl_socket_pools_for_proxies_[proxy_host] = pool;
+ }
+
+ private:
+ const scoped_refptr<HttpNetworkSession> session_;
+
+ DISALLOW_COPY_AND_ASSIGN(HttpNetworkSessionPeer);
+};
+
// Helper to manage the lifetimes of the dependencies for a
// HttpNetworkTransaction.
struct SessionDependencies {
@@ -77,6 +132,7 @@ struct SessionDependencies {
ssl_config_service(new SSLConfigServiceDefaults),
http_auth_handler_factory(
HttpAuthHandlerFactory::CreateDefault(host_resolver)),
+ spdy_session_pool(new SpdySessionPool(NULL)),
net_log(NULL) {}
// Custom proxy service dependency.
@@ -86,6 +142,7 @@ struct SessionDependencies {
ssl_config_service(new SSLConfigServiceDefaults),
http_auth_handler_factory(
HttpAuthHandlerFactory::CreateDefault(host_resolver)),
+ spdy_session_pool(new SpdySessionPool(NULL)),
net_log(NULL) {}
scoped_refptr<MockHostResolverBase> host_resolver;
@@ -93,6 +150,7 @@ struct SessionDependencies {
scoped_refptr<SSLConfigService> ssl_config_service;
MockClientSocketFactory socket_factory;
scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory;
+ scoped_refptr<SpdySessionPool> spdy_session_pool;
NetLog* net_log;
};
@@ -107,7 +165,7 @@ HttpNetworkSession* CreateSession(SessionDependencies* session_deps) {
session_deps->proxy_service,
&session_deps->socket_factory,
session_deps->ssl_config_service,
- new SpdySessionPool(NULL),
+ session_deps->spdy_session_pool,
session_deps->http_auth_handler_factory.get(),
NULL,
session_deps->net_log);
diff --git a/net/http/http_stream_request.cc b/net/http/http_stream_request.cc
index 86cf0ef..67aefb0 100644
--- a/net/http/http_stream_request.cc
+++ b/net/http/http_stream_request.cc
@@ -694,7 +694,8 @@ int HttpStreamRequest::DoCreateStream() {
CHECK(!stream_.get());
bool direct = true;
- SpdySessionPool* spdy_pool = session_->spdy_session_pool();
+ const scoped_refptr<SpdySessionPool> spdy_pool =
+ session_->spdy_session_pool();
scoped_refptr<SpdySession> spdy_session;
const ProxyServer& proxy_server = proxy_info()->proxy_server();
diff --git a/net/net.gyp b/net/net.gyp
index a8857ac..5bc0bd8 100644
--- a/net/net.gyp
+++ b/net/net.gyp
@@ -425,7 +425,6 @@
'http/http_network_layer.h',
'http/http_network_session.cc',
'http/http_network_session.h',
- 'http/http_network_session_peer.h',
'http/http_network_transaction.cc',
'http/http_network_transaction.h',
'http/http_request_headers.cc',
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc
index 5645ad6..5ddbd40 100644
--- a/net/spdy/spdy_network_transaction_unittest.cc
+++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -6,7 +6,6 @@
#include <vector>
#include "net/base/net_log_unittest.h"
-#include "net/http/http_network_session_peer.h"
#include "net/http/http_transaction_unittest.h"
#include "net/spdy/spdy_http_stream.h"
#include "net/spdy/spdy_session.h"
@@ -364,7 +363,7 @@ class SpdyNetworkTransactionTest
HostPortProxyPair pair(host_port_pair, ProxyServer::Direct());
BoundNetLog log;
const scoped_refptr<HttpNetworkSession>& session = helper.session();
- SpdySessionPool* pool(session->spdy_session_pool());
+ scoped_refptr<SpdySessionPool> pool(session->spdy_session_pool());
EXPECT_TRUE(pool->HasSession(pair));
scoped_refptr<SpdySession> spdy_session(
pool->Get(pair, session->mutable_spdy_settings(), log));
@@ -4244,7 +4243,8 @@ TEST_P(SpdyNetworkTransactionTest, DirectConnectProxyReconnect) {
helper.SetSession(SpdySessionDependencies::SpdyCreateSession(
helper.session_deps().get()));
- SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool();
+ scoped_refptr<SpdySessionPool> spdy_session_pool =
+ helper.session_deps()->spdy_session_pool;
helper.RunPreTestSetup();
// Construct and send a simple GET request.
@@ -4367,15 +4367,15 @@ TEST_P(SpdyNetworkTransactionTest, DirectConnectProxyReconnect) {
request_proxy.method = "GET";
request_proxy.url = GURL("http://www.google.com/foo.dat");
request_proxy.load_flags = 0;
- scoped_ptr<SpdySessionDependencies> ssd_proxy(new SpdySessionDependencies());
+ scoped_ptr<SpdySessionDependencies> ssd_proxy(
+ new SpdySessionDependencies(
+ ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")));
// Ensure that this transaction uses the same SpdySessionPool.
+ ssd_proxy->spdy_session_pool = spdy_session_pool;
scoped_refptr<HttpNetworkSession> session_proxy =
SpdySessionDependencies::SpdyCreateSession(ssd_proxy.get());
NormalSpdyTransactionHelper helper_proxy(request_proxy,
BoundNetLog(), GetParam());
- HttpNetworkSessionPeer session_peer(session_proxy);
- session_peer.SetProxyService(
- ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"));
helper_proxy.session_deps().swap(ssd_proxy);
helper_proxy.SetSession(session_proxy);
helper_proxy.RunPreTestSetup();
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index b00e938..ed3d3462 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -246,6 +246,7 @@ SpdySession::SpdySession(const HostPortProxyPair& host_port_proxy_pair,
frames_received_(0),
sent_settings_(false),
received_settings_(false),
+ in_session_pool_(true),
initial_send_window_size_(spdy::kInitialWindowSize),
initial_recv_window_size_(spdy::kInitialWindowSize),
net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SPDY_SESSION)) {
@@ -872,9 +873,9 @@ void SpdySession::DeleteStream(spdy::SpdyStreamId id, int status) {
}
void SpdySession::RemoveFromPool() {
- if (spdy_session_pool_) {
+ if (in_session_pool_) {
spdy_session_pool_->Remove(this);
- spdy_session_pool_ = NULL;
+ in_session_pool_ = false;
}
}
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h
index 58a2710..313440c 100644
--- a/net/spdy/spdy_session.h
+++ b/net/spdy/spdy_session.h
@@ -51,8 +51,6 @@ class SpdySession : public base::RefCounted<SpdySession>,
// Create a new SpdySession.
// |host_port_proxy_pair| is the host/port that this session connects to, and
// the proxy configuration settings that it's using.
- // |spdy_session_pool| is the SpdySessionPool that owns us. Its lifetime must
- // strictly be greater than |this|.
// |session| is the HttpNetworkSession. |net_log| is the NetLog that we log
// network events to.
SpdySession(const HostPortProxyPair& host_port_proxy_pair,
@@ -161,9 +159,7 @@ class SpdySession : public base::RefCounted<SpdySession>,
return frames_received_ > 0;
}
- void set_spdy_session_pool(SpdySessionPool* pool) {
- spdy_session_pool_ = NULL;
- }
+ void set_in_session_pool(bool val) { in_session_pool_ = val; }
// Access to the number of active and pending streams. These are primarily
// available for testing and diagnostics.
@@ -298,9 +294,7 @@ class SpdySession : public base::RefCounted<SpdySession>,
// The domain this session is connected to.
const HostPortProxyPair host_port_proxy_pair_;
- // |spdy_session_pool_| owns us, therefore its lifetime must exceed ours. We
- // set this to NULL after we are removed from the pool.
- SpdySessionPool* spdy_session_pool_;
+ scoped_refptr<SpdySessionPool> spdy_session_pool_;
SpdySettingsStorage* spdy_settings_;
// The socket handle for this session.
@@ -367,6 +361,8 @@ class SpdySession : public base::RefCounted<SpdySession>,
bool received_settings_; // Did this session receive at least one settings
// frame.
+ bool in_session_pool_; // True if the session is currently in the pool.
+
// Initial send window size for the session; can be changed by an
// arriving SETTINGS frame; newly created streams use this value for the
// initial send window size.
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc
index 086fa9f..6c4ad52 100644
--- a/net/spdy/spdy_session_pool.cc
+++ b/net/spdy/spdy_session_pool.cc
@@ -176,7 +176,7 @@ void SpdySessionPool::CloseCurrentSessions() {
CHECK(list);
const scoped_refptr<SpdySession>& session = list->front();
CHECK(session);
- session->set_spdy_session_pool(NULL);
+ session->set_in_session_pool(false);
}
while (!old_map.empty()) {
diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h
index 49f9e45..7dc5f27 100644
--- a/net/spdy/spdy_session_pool.h
+++ b/net/spdy/spdy_session_pool.h
@@ -35,11 +35,11 @@ class SpdySettingsStorage;
// This is a very simple pool for open SpdySessions.
// TODO(mbelshe): Make this production ready.
class SpdySessionPool
- : public NetworkChangeNotifier::Observer,
+ : public base::RefCounted<SpdySessionPool>,
+ public NetworkChangeNotifier::Observer,
public SSLConfigService::Observer {
public:
explicit SpdySessionPool(SSLConfigService* ssl_config_service);
- virtual ~SpdySessionPool();
// Either returns an existing SpdySession or creates a new SpdySession for
// use.
@@ -101,6 +101,7 @@ class SpdySessionPool
virtual void OnSSLConfigChanged();
private:
+ friend class base::RefCounted<SpdySessionPool>;
friend class SpdySessionPoolPeer; // For testing.
friend class SpdyNetworkTransactionTest; // For testing.
FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, WindowUpdateOverflow);
@@ -108,6 +109,8 @@ class SpdySessionPool
typedef std::list<scoped_refptr<SpdySession> > SpdySessionList;
typedef std::map<HostPortProxyPair, SpdySessionList*> SpdySessionsMap;
+ virtual ~SpdySessionPool();
+
// Helper functions for manipulating the lists.
SpdySessionList* AddSessionList(
const HostPortProxyPair& host_port_proxy_pair);
diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc
index 38de37a..d39a09e 100644
--- a/net/spdy/spdy_session_unittest.cc
+++ b/net/spdy/spdy_session_unittest.cc
@@ -82,7 +82,8 @@ TEST_F(SpdySessionTest, GoAway) {
HostPortPair test_host_port_pair(kTestHost, kTestPort);
HostPortProxyPair pair(test_host_port_pair, ProxyServer::Direct());
- SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool());
+ scoped_refptr<SpdySessionPool> spdy_session_pool(
+ http_session->spdy_session_pool());
EXPECT_FALSE(spdy_session_pool->HasSession(pair));
scoped_refptr<SpdySession> session =
spdy_session_pool->Get(pair, http_session->mutable_spdy_settings(),
diff --git a/net/spdy/spdy_stream_unittest.cc b/net/spdy/spdy_stream_unittest.cc
index 5ece945..84d21d3 100644
--- a/net/spdy/spdy_stream_unittest.cc
+++ b/net/spdy/spdy_stream_unittest.cc
@@ -13,7 +13,7 @@ namespace net {
// TODO(ukai): factor out common part with spdy_http_stream_unittest.cc
class SpdySessionPoolPeer {
public:
- explicit SpdySessionPoolPeer(SpdySessionPool* pool)
+ explicit SpdySessionPoolPeer(const scoped_refptr<SpdySessionPool>& pool)
: pool_(pool) {}
void RemoveSpdySession(const scoped_refptr<SpdySession>& session) {
@@ -21,7 +21,7 @@ class SpdySessionPoolPeer {
}
private:
- SpdySessionPool* const pool_;
+ const scoped_refptr<SpdySessionPool> pool_;
DISALLOW_COPY_AND_ASSIGN(SpdySessionPoolPeer);
};
diff --git a/net/spdy/spdy_test_util.h b/net/spdy/spdy_test_util.h
index 13b3a2f..be2f7d0 100644
--- a/net/spdy/spdy_test_util.h
+++ b/net/spdy/spdy_test_util.h
@@ -304,7 +304,8 @@ class SpdySessionDependencies {
socket_factory(new MockClientSocketFactory),
deterministic_socket_factory(new DeterministicMockClientSocketFactory),
http_auth_handler_factory(
- HttpAuthHandlerFactory::CreateDefault(host_resolver)) {
+ HttpAuthHandlerFactory::CreateDefault(host_resolver)),
+ spdy_session_pool(new SpdySessionPool(NULL)) {
// Note: The CancelledTransaction test does cleanup by running all
// tasks in the message loop (RunAllPending). Unfortunately, that
// doesn't clean up tasks on the host resolver thread; and
@@ -322,7 +323,8 @@ class SpdySessionDependencies {
socket_factory(new MockClientSocketFactory),
deterministic_socket_factory(new DeterministicMockClientSocketFactory),
http_auth_handler_factory(
- HttpAuthHandlerFactory::CreateDefault(host_resolver)) {}
+ HttpAuthHandlerFactory::CreateDefault(host_resolver)),
+ spdy_session_pool(new SpdySessionPool(NULL)) {}
// NOTE: host_resolver must be ordered before http_auth_handler_factory.
scoped_refptr<MockHostResolverBase> host_resolver;
@@ -331,6 +333,7 @@ class SpdySessionDependencies {
scoped_ptr<MockClientSocketFactory> socket_factory;
scoped_ptr<DeterministicMockClientSocketFactory> deterministic_socket_factory;
scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory;
+ scoped_refptr<SpdySessionPool> spdy_session_pool;
static HttpNetworkSession* SpdyCreateSession(
SpdySessionDependencies* session_deps) {
@@ -338,7 +341,7 @@ class SpdySessionDependencies {
session_deps->proxy_service,
session_deps->socket_factory.get(),
session_deps->ssl_config_service,
- new SpdySessionPool(NULL),
+ session_deps->spdy_session_pool,
session_deps->http_auth_handler_factory.get(),
NULL,
NULL);
@@ -350,7 +353,7 @@ class SpdySessionDependencies {
session_deps->
deterministic_socket_factory.get(),
session_deps->ssl_config_service,
- new SpdySessionPool(NULL),
+ session_deps->spdy_session_pool,
session_deps->http_auth_handler_factory.get(),
NULL,
NULL);
@@ -362,6 +365,7 @@ class SpdyURLRequestContext : public URLRequestContext {
SpdyURLRequestContext() {
host_resolver_ = new MockHostResolver;
proxy_service_ = ProxyService::CreateDirect();
+ spdy_session_pool_ = new SpdySessionPool(NULL);
ssl_config_service_ = new SSLConfigServiceDefaults;
http_auth_handler_factory_ = HttpAuthHandlerFactory::CreateDefault(
host_resolver_);
@@ -370,7 +374,7 @@ class SpdyURLRequestContext : public URLRequestContext {
host_resolver_,
proxy_service_,
ssl_config_service_,
- new SpdySessionPool(NULL),
+ spdy_session_pool_.get(),
http_auth_handler_factory_,
network_delegate_,
NULL),
@@ -387,6 +391,7 @@ class SpdyURLRequestContext : public URLRequestContext {
private:
MockClientSocketFactory socket_factory_;
+ scoped_refptr<SpdySessionPool> spdy_session_pool_;
};
const SpdyHeaderInfo make_spdy_header(spdy::SpdyControlType type);