summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/http/http_network_layer_unittest.cc3
-rw-r--r--net/http/http_network_session.cc3
-rw-r--r--net/http/http_network_session.h8
-rw-r--r--net/http/http_network_transaction.cc9
-rw-r--r--net/http/http_network_transaction_ssl_unittest.cc3
-rw-r--r--net/http/http_network_transaction_unittest.cc16
-rw-r--r--net/http/http_pipelined_host_pool.cc2
-rw-r--r--net/http/http_pipelined_host_pool.h12
-rw-r--r--net/http/http_pipelined_host_pool_unittest.cc7
-rw-r--r--net/http/http_pipelined_network_transaction_unittest.cc3
-rw-r--r--net/http/http_response_body_drainer_unittest.cc4
-rw-r--r--net/http/http_server_properties.h4
-rw-r--r--net/http/http_server_properties_impl.cc7
-rw-r--r--net/http/http_server_properties_impl.h6
-rw-r--r--net/http/http_stream_factory.cc2
-rw-r--r--net/http/http_stream_factory.h2
-rw-r--r--net/http/http_stream_factory_impl_job.cc4
-rw-r--r--net/proxy/proxy_script_fetcher_impl_unittest.cc3
-rw-r--r--net/quic/quic_network_transaction_unittest.cc2
-rw-r--r--net/socket/ssl_client_socket_pool_unittest.cc3
-rw-r--r--net/spdy/spdy_session.cc29
-rw-r--r--net/spdy/spdy_session.h4
-rw-r--r--net/spdy/spdy_session_pool.cc2
-rw-r--r--net/spdy/spdy_session_pool.h34
-rw-r--r--net/spdy/spdy_session_unittest.cc2
-rw-r--r--net/spdy/spdy_test_util_common.cc6
-rw-r--r--net/tools/fetch/fetch_client.cc2
-rw-r--r--net/url_request/url_request_context.cc1
-rw-r--r--net/url_request/url_request_context.h6
-rw-r--r--net/url_request/url_request_context_builder.cc4
-rw-r--r--net/url_request/url_request_context_storage.cc6
-rw-r--r--net/url_request/url_request_context_storage.h3
-rw-r--r--net/url_request/url_request_test_util.cc2
33 files changed, 119 insertions, 85 deletions
diff --git a/net/http/http_network_layer_unittest.cc b/net/http/http_network_layer_unittest.cc
index 16815c7..c939d84 100644
--- a/net/http/http_network_layer_unittest.cc
+++ b/net/http/http_network_layer_unittest.cc
@@ -42,7 +42,8 @@ class HttpNetworkLayerTest : public PlatformTest {
session_params.transport_security_state = transport_security_state_.get();
session_params.proxy_service = proxy_service_.get();
session_params.ssl_config_service = ssl_config_service_.get();
- session_params.http_server_properties = &http_server_properties_;
+ session_params.http_server_properties =
+ http_server_properties_.GetWeakPtr();
network_session_ = new HttpNetworkSession(session_params);
factory_.reset(new HttpNetworkLayer(network_session_.get()));
}
diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc
index 42d6e30..3265962 100644
--- a/net/http/http_network_session.cc
+++ b/net/http/http_network_session.cc
@@ -62,7 +62,6 @@ HttpNetworkSession::Params::Params()
ssl_config_service(NULL),
http_auth_handler_factory(NULL),
network_delegate(NULL),
- http_server_properties(NULL),
net_log(NULL),
host_mapping_rules(NULL),
force_http_pipelining(false),
@@ -88,6 +87,8 @@ HttpNetworkSession::Params::Params()
quic_crypto_client_stream_factory(NULL) {
}
+HttpNetworkSession::Params::~Params() {}
+
// TODO(mbelshe): Move the socket factories into HttpStreamFactory.
HttpNetworkSession::HttpNetworkSession(const Params& params)
: net_log_(params.net_log),
diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h
index 09ced59..c10bb14 100644
--- a/net/http/http_network_session.h
+++ b/net/http/http_network_session.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "net/base/host_port_pair.h"
#include "net/base/net_export.h"
@@ -54,6 +55,7 @@ class NET_EXPORT HttpNetworkSession
public:
struct NET_EXPORT Params {
Params();
+ ~Params();
ClientSocketFactory* client_socket_factory;
HostResolver* host_resolver;
@@ -65,7 +67,7 @@ class NET_EXPORT HttpNetworkSession
SSLConfigService* ssl_config_service;
HttpAuthHandlerFactory* http_auth_handler_factory;
NetworkDelegate* network_delegate;
- HttpServerProperties* http_server_properties;
+ base::WeakPtr<HttpServerProperties> http_server_properties;
NetLog* net_log;
HostMappingRules* host_mapping_rules;
bool force_http_pipelining;
@@ -133,7 +135,7 @@ class NET_EXPORT HttpNetworkSession
NetworkDelegate* network_delegate() {
return network_delegate_;
}
- HttpServerProperties* http_server_properties() {
+ base::WeakPtr<HttpServerProperties> http_server_properties() {
return http_server_properties_;
}
HttpStreamFactory* http_stream_factory() {
@@ -180,7 +182,7 @@ class NET_EXPORT HttpNetworkSession
NetLog* const net_log_;
NetworkDelegate* const network_delegate_;
- HttpServerProperties* const http_server_properties_;
+ const base::WeakPtr<HttpServerProperties> http_server_properties_;
CertVerifier* const cert_verifier_;
HttpAuthHandlerFactory* const http_auth_handler_factory_;
bool force_http_pipelining_;
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index f0e09fa..c26564c 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -66,10 +66,11 @@ namespace net {
namespace {
-void ProcessAlternateProtocol(HttpStreamFactory* factory,
- HttpServerProperties* http_server_properties,
- const HttpResponseHeaders& headers,
- const HostPortPair& http_host_port_pair) {
+void ProcessAlternateProtocol(
+ HttpStreamFactory* factory,
+ const base::WeakPtr<HttpServerProperties>& http_server_properties,
+ const HttpResponseHeaders& headers,
+ const HostPortPair& http_host_port_pair) {
std::string alternate_protocol_str;
if (!headers.EnumerateHeader(NULL, kAlternateProtocolHeader,
diff --git a/net/http/http_network_transaction_ssl_unittest.cc b/net/http/http_network_transaction_ssl_unittest.cc
index 6b3c3c7..bb21849 100644
--- a/net/http/http_network_transaction_ssl_unittest.cc
+++ b/net/http/http_network_transaction_ssl_unittest.cc
@@ -74,7 +74,8 @@ class HttpNetworkTransactionSSLTest : public testing::Test {
session_params_.client_socket_factory = &mock_socket_factory_;
session_params_.host_resolver = &mock_resolver_;
- session_params_.http_server_properties = &http_server_properties_;
+ session_params_.http_server_properties =
+ http_server_properties_.GetWeakPtr();
session_params_.transport_security_state = &transport_security_state_;
}
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index 140ed3e..e94e4a3 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -7011,7 +7011,7 @@ scoped_refptr<HttpNetworkSession> SetupSessionForGroupNameTests(
SpdySessionDependencies* session_deps_) {
scoped_refptr<HttpNetworkSession> session(CreateSession(session_deps_));
- HttpServerProperties* http_server_properties =
+ base::WeakPtr<HttpServerProperties> http_server_properties =
session->http_server_properties();
http_server_properties->SetAlternateProtocol(
HostPortPair("host.with.alternate", 80), 443,
@@ -8005,7 +8005,7 @@ TEST_P(HttpNetworkTransactionTest,
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
- HttpServerProperties* http_server_properties =
+ base::WeakPtr<HttpServerProperties> http_server_properties =
session->http_server_properties();
// Port must be < 1024, or the header will be ignored (since initial port was
// port 80 (another restricted port).
@@ -8068,7 +8068,7 @@ TEST_P(HttpNetworkTransactionTest,
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
- HttpServerProperties* http_server_properties =
+ base::WeakPtr<HttpServerProperties> http_server_properties =
session->http_server_properties();
const int kUnrestrictedAlternatePort = 1024;
http_server_properties->SetAlternateProtocol(
@@ -8119,7 +8119,7 @@ TEST_P(HttpNetworkTransactionTest,
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
- HttpServerProperties* http_server_properties =
+ base::WeakPtr<HttpServerProperties> http_server_properties =
session->http_server_properties();
const int kUnrestrictedAlternatePort = 1024;
http_server_properties->SetAlternateProtocol(
@@ -8167,7 +8167,7 @@ TEST_P(HttpNetworkTransactionTest,
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
- HttpServerProperties* http_server_properties =
+ base::WeakPtr<HttpServerProperties> http_server_properties =
session->http_server_properties();
const int kRestrictedAlternatePort = 80;
http_server_properties->SetAlternateProtocol(
@@ -8216,7 +8216,7 @@ TEST_P(HttpNetworkTransactionTest,
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
- HttpServerProperties* http_server_properties =
+ base::WeakPtr<HttpServerProperties> http_server_properties =
session->http_server_properties();
const int kRestrictedAlternatePort = 80;
http_server_properties->SetAlternateProtocol(
@@ -8264,7 +8264,7 @@ TEST_P(HttpNetworkTransactionTest,
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
- HttpServerProperties* http_server_properties =
+ base::WeakPtr<HttpServerProperties> http_server_properties =
session->http_server_properties();
const int kUnrestrictedAlternatePort = 1024;
http_server_properties->SetAlternateProtocol(
@@ -8308,7 +8308,7 @@ TEST_P(HttpNetworkTransactionTest,
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
- HttpServerProperties* http_server_properties =
+ base::WeakPtr<HttpServerProperties> http_server_properties =
session->http_server_properties();
const int kUnsafePort = 7;
http_server_properties->SetAlternateProtocol(
diff --git a/net/http/http_pipelined_host_pool.cc b/net/http/http_pipelined_host_pool.cc
index b8fec2a..ee37e74 100644
--- a/net/http/http_pipelined_host_pool.cc
+++ b/net/http/http_pipelined_host_pool.cc
@@ -33,7 +33,7 @@ class HttpPipelinedHostImplFactory : public HttpPipelinedHost::Factory {
HttpPipelinedHostPool::HttpPipelinedHostPool(
Delegate* delegate,
HttpPipelinedHost::Factory* factory,
- HttpServerProperties* http_server_properties,
+ const base::WeakPtr<HttpServerProperties>& http_server_properties,
bool force_pipelining)
: delegate_(delegate),
factory_(factory),
diff --git a/net/http/http_pipelined_host_pool.h b/net/http/http_pipelined_host_pool.h
index 3ab9418..45cb38c 100644
--- a/net/http/http_pipelined_host_pool.h
+++ b/net/http/http_pipelined_host_pool.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "net/http/http_pipelined_host.h"
#include "net/http/http_pipelined_host_capability.h"
@@ -37,10 +38,11 @@ class NET_EXPORT_PRIVATE HttpPipelinedHostPool
HttpPipelinedHost* host) = 0;
};
- HttpPipelinedHostPool(Delegate* delegate,
- HttpPipelinedHost::Factory* factory,
- HttpServerProperties* http_server_properties_,
- bool force_pipelining);
+ HttpPipelinedHostPool(
+ Delegate* delegate,
+ HttpPipelinedHost::Factory* factory,
+ const base::WeakPtr<HttpServerProperties>& http_server_properties,
+ bool force_pipelining);
virtual ~HttpPipelinedHostPool();
// Returns true if pipelining might work for |key|. Generally, this returns
@@ -89,7 +91,7 @@ class NET_EXPORT_PRIVATE HttpPipelinedHostPool
Delegate* delegate_;
scoped_ptr<HttpPipelinedHost::Factory> factory_;
HostMap host_map_;
- HttpServerProperties* http_server_properties_;
+ const base::WeakPtr<HttpServerProperties> http_server_properties_;
bool force_pipelining_;
DISALLOW_COPY_AND_ASSIGN(HttpPipelinedHostPool);
diff --git a/net/http/http_pipelined_host_pool_unittest.cc b/net/http/http_pipelined_host_pool_unittest.cc
index 8413e26..fa8d93f 100644
--- a/net/http/http_pipelined_host_pool_unittest.cc
+++ b/net/http/http_pipelined_host_pool_unittest.cc
@@ -73,9 +73,10 @@ class HttpPipelinedHostPoolTest : public testing::Test {
: key_(HostPortPair("host", 123)),
factory_(new MockHostFactory), // Owned by pool_.
host_(new MockHost(key_)), // Owned by pool_.
- http_server_properties_(new HttpServerPropertiesImpl),
- pool_(new HttpPipelinedHostPool(&delegate_, factory_,
- http_server_properties_.get(), false)),
+ http_server_properties_(new HttpServerPropertiesImpl()),
+ pool_(new HttpPipelinedHostPool(
+ &delegate_, factory_,
+ http_server_properties_->GetWeakPtr(), false)),
was_npn_negotiated_(false),
protocol_negotiated_(kProtoUnknown) {
}
diff --git a/net/http/http_pipelined_network_transaction_unittest.cc b/net/http/http_pipelined_network_transaction_unittest.cc
index af620b31..80b74fd 100644
--- a/net/http/http_pipelined_network_transaction_unittest.cc
+++ b/net/http/http_pipelined_network_transaction_unittest.cc
@@ -87,7 +87,8 @@ class HttpPipelinedNetworkTransactionTest : public testing::Test {
session_params.host_resolver = &mock_resolver_;
session_params.ssl_config_service = ssl_config_.get();
session_params.http_auth_handler_factory = auth_handler_factory_.get();
- session_params.http_server_properties = &http_server_properties_;
+ session_params.http_server_properties =
+ http_server_properties_.GetWeakPtr();
session_params.force_http_pipelining = force_http_pipelining;
session_params.http_pipelining_enabled = true;
session_ = new HttpNetworkSession(session_params);
diff --git a/net/http/http_response_body_drainer_unittest.cc b/net/http/http_response_body_drainer_unittest.cc
index faff989..5d9fcc4 100644
--- a/net/http/http_response_body_drainer_unittest.cc
+++ b/net/http/http_response_body_drainer_unittest.cc
@@ -209,7 +209,7 @@ class HttpResponseBodyDrainerTest : public testing::Test {
HttpResponseBodyDrainerTest()
: proxy_service_(ProxyService::CreateDirect()),
ssl_config_service_(new SSLConfigServiceDefaults),
- http_server_properties_(new HttpServerPropertiesImpl),
+ http_server_properties_(new HttpServerPropertiesImpl()),
session_(CreateNetworkSession()),
mock_stream_(new MockHttpStream(&result_waiter_)),
drainer_(new HttpResponseBodyDrainer(mock_stream_)) {}
@@ -220,7 +220,7 @@ class HttpResponseBodyDrainerTest : public testing::Test {
HttpNetworkSession::Params params;
params.proxy_service = proxy_service_.get();
params.ssl_config_service = ssl_config_service_.get();
- params.http_server_properties = http_server_properties_.get();
+ params.http_server_properties = http_server_properties_->GetWeakPtr();
return new HttpNetworkSession(params);
}
diff --git a/net/http/http_server_properties.h b/net/http/http_server_properties.h
index 7217ab7..d75548a 100644
--- a/net/http/http_server_properties.h
+++ b/net/http/http_server_properties.h
@@ -8,6 +8,7 @@
#include <map>
#include <string>
#include "base/basictypes.h"
+#include "base/memory/weak_ptr.h"
#include "net/base/host_port_pair.h"
#include "net/base/net_export.h"
#include "net/http/http_pipelined_host_capability.h"
@@ -62,6 +63,9 @@ class NET_EXPORT HttpServerProperties {
HttpServerProperties() {}
virtual ~HttpServerProperties() {}
+ // Gets a weak pointer for this object.
+ virtual base::WeakPtr<HttpServerProperties> GetWeakPtr() = 0;
+
// Deletes all data.
virtual void Clear() = 0;
diff --git a/net/http/http_server_properties_impl.cc b/net/http/http_server_properties_impl.cc
index f56dea8..a0b287d 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -18,7 +18,8 @@ namespace net {
static const int kDefaultNumHostsToRemember = 200;
HttpServerPropertiesImpl::HttpServerPropertiesImpl()
- : pipeline_capability_map_(
+ : weak_ptr_factory_(this),
+ pipeline_capability_map_(
new CachedPipelineCapabilityMap(kDefaultNumHostsToRemember)) {
}
@@ -112,6 +113,10 @@ void HttpServerPropertiesImpl::DisableForcedAlternateProtocol() {
g_forced_alternate_protocol = NULL;
}
+base::WeakPtr<HttpServerProperties> HttpServerPropertiesImpl::GetWeakPtr() {
+ return weak_ptr_factory_.GetWeakPtr();
+}
+
void HttpServerPropertiesImpl::Clear() {
DCHECK(CalledOnValidThread());
spdy_servers_table_.clear();
diff --git a/net/http/http_server_properties_impl.h b/net/http/http_server_properties_impl.h
index 182038f..c1e2d4b 100644
--- a/net/http/http_server_properties_impl.h
+++ b/net/http/http_server_properties_impl.h
@@ -73,6 +73,9 @@ class NET_EXPORT HttpServerPropertiesImpl
// HttpServerProperties methods:
// -----------------------------
+ // Gets a weak pointer for this object.
+ virtual base::WeakPtr<HttpServerProperties> GetWeakPtr() OVERRIDE;
+
// Deletes all data.
virtual void Clear() OVERRIDE;
@@ -141,6 +144,9 @@ class NET_EXPORT HttpServerPropertiesImpl
// |spdy_servers_table_| has flattened representation of servers (host/port
// pair) that either support or not support SPDY protocol.
typedef base::hash_map<std::string, bool> SpdyServerHostPortTable;
+
+ base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_;
+
SpdyServerHostPortTable spdy_servers_table_;
AlternateProtocolMap alternate_protocol_map_;
diff --git a/net/http/http_stream_factory.cc b/net/http/http_stream_factory.cc
index 6d2e140..0561c34 100644
--- a/net/http/http_stream_factory.cc
+++ b/net/http/http_stream_factory.cc
@@ -49,7 +49,7 @@ void HttpStreamFactory::ResetStaticSettingsToInit() {
}
void HttpStreamFactory::ProcessAlternateProtocol(
- HttpServerProperties* http_server_properties,
+ const base::WeakPtr<HttpServerProperties>& http_server_properties,
const std::string& alternate_protocol_str,
const HostPortPair& http_host_port_pair) {
std::vector<std::string> port_protocol_vector;
diff --git a/net/http/http_stream_factory.h b/net/http/http_stream_factory.h
index bef3b5d..79ca388 100644
--- a/net/http/http_stream_factory.h
+++ b/net/http/http_stream_factory.h
@@ -176,7 +176,7 @@ class NET_EXPORT HttpStreamFactory {
virtual ~HttpStreamFactory();
void ProcessAlternateProtocol(
- HttpServerProperties* http_server_properties,
+ const base::WeakPtr<HttpServerProperties>& http_server_properties,
const std::string& alternate_protocol_str,
const HostPortPair& http_host_port_pair);
diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc
index da0b456..937d7db 100644
--- a/net/http/http_stream_factory_impl_job.cc
+++ b/net/http/http_stream_factory_impl_job.cc
@@ -141,7 +141,7 @@ int HttpStreamFactoryImpl::Job::Preconnect(int num_streams) {
HostPortPair origin_server =
HostPortPair(request_info_.url.HostNoBrackets(),
request_info_.url.EffectiveIntPort());
- HttpServerProperties* http_server_properties =
+ base::WeakPtr<HttpServerProperties> http_server_properties =
session_->http_server_properties();
if (http_server_properties &&
http_server_properties->SupportsSpdy(origin_server)) {
@@ -1118,7 +1118,7 @@ int HttpStreamFactoryImpl::Job::DoCreateStream() {
if (error != OK)
return error;
const HostPortPair& host_port_pair = spdy_session_key.host_port_pair();
- HttpServerProperties* http_server_properties =
+ base::WeakPtr<HttpServerProperties> http_server_properties =
session_->http_server_properties();
if (http_server_properties)
http_server_properties->SetSupportsSpdy(host_port_pair, true);
diff --git a/net/proxy/proxy_script_fetcher_impl_unittest.cc b/net/proxy/proxy_script_fetcher_impl_unittest.cc
index 92a5dc1..8d42514 100644
--- a/net/proxy/proxy_script_fetcher_impl_unittest.cc
+++ b/net/proxy/proxy_script_fetcher_impl_unittest.cc
@@ -56,7 +56,8 @@ class RequestContext : public URLRequestContext {
storage_.set_transport_security_state(new TransportSecurityState);
storage_.set_proxy_service(ProxyService::CreateFixed(no_proxy));
storage_.set_ssl_config_service(new SSLConfigServiceDefaults);
- storage_.set_http_server_properties(new HttpServerPropertiesImpl);
+ storage_.set_http_server_properties(
+ scoped_ptr<HttpServerProperties>(new HttpServerPropertiesImpl()));
HttpNetworkSession::Params params;
params.host_resolver = host_resolver();
diff --git a/net/quic/quic_network_transaction_unittest.cc b/net/quic/quic_network_transaction_unittest.cc
index 69ac658..4a99afc 100644
--- a/net/quic/quic_network_transaction_unittest.cc
+++ b/net/quic/quic_network_transaction_unittest.cc
@@ -229,7 +229,7 @@ class QuicNetworkTransactionTest : public PlatformTest {
params_.proxy_service = proxy_service_.get();
params_.ssl_config_service = ssl_config_service_.get();
params_.http_auth_handler_factory = auth_handler_factory_.get();
- params_.http_server_properties = &http_server_properties;
+ params_.http_server_properties = http_server_properties.GetWeakPtr();
session_ = new HttpNetworkSession(params_);
}
diff --git a/net/socket/ssl_client_socket_pool_unittest.cc b/net/socket/ssl_client_socket_pool_unittest.cc
index 641bd83..4652de8 100644
--- a/net/socket/ssl_client_socket_pool_unittest.cc
+++ b/net/socket/ssl_client_socket_pool_unittest.cc
@@ -185,7 +185,8 @@ class SSLClientSocketPoolTest : public testing::Test {
params.client_socket_factory = &socket_factory_;
params.ssl_config_service = ssl_config_service_.get();
params.http_auth_handler_factory = http_auth_handler_factory_.get();
- params.http_server_properties = &http_server_properties_;
+ params.http_server_properties =
+ http_server_properties_.GetWeakPtr();
params.enable_spdy_compression = false;
return new HttpNetworkSession(params);
}
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 468feeb..d582453 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -333,20 +333,21 @@ SpdySession::PushedStreamInfo::PushedStreamInfo(
SpdySession::PushedStreamInfo::~PushedStreamInfo() {}
-SpdySession::SpdySession(const SpdySessionKey& spdy_session_key,
- HttpServerProperties* http_server_properties,
- bool verify_domain_authentication,
- bool enable_sending_initial_settings,
- bool enable_credential_frames,
- bool enable_compression,
- bool enable_ping_based_connection_checking,
- NextProto default_protocol,
- size_t stream_initial_recv_window_size,
- size_t initial_max_concurrent_streams,
- size_t max_concurrent_streams_limit,
- TimeFunc time_func,
- const HostPortPair& trusted_spdy_proxy,
- NetLog* net_log)
+SpdySession::SpdySession(
+ const SpdySessionKey& spdy_session_key,
+ const base::WeakPtr<HttpServerProperties>& http_server_properties,
+ bool verify_domain_authentication,
+ bool enable_sending_initial_settings,
+ bool enable_credential_frames,
+ bool enable_compression,
+ bool enable_ping_based_connection_checking,
+ NextProto default_protocol,
+ size_t stream_initial_recv_window_size,
+ size_t initial_max_concurrent_streams,
+ size_t max_concurrent_streams_limit,
+ TimeFunc time_func,
+ const HostPortPair& trusted_spdy_proxy,
+ NetLog* net_log)
: weak_factory_(this),
spdy_session_key_(spdy_session_key),
spdy_session_pool_(NULL),
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h
index 2fbb01a..7077662 100644
--- a/net/spdy/spdy_session.h
+++ b/net/spdy/spdy_session.h
@@ -202,7 +202,7 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>,
// |session| is the HttpNetworkSession. |net_log| is the NetLog that we log
// network events to.
SpdySession(const SpdySessionKey& spdy_session_key,
- HttpServerProperties* http_server_properties,
+ const base::WeakPtr<HttpServerProperties>& http_server_properties,
bool verify_domain_authentication,
bool enable_sending_initial_settings,
bool enable_credential_frames,
@@ -843,7 +843,7 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>,
// |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_;
- HttpServerProperties* const http_server_properties_;
+ const base::WeakPtr<HttpServerProperties> http_server_properties_;
// 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 7c7e76c..19d1bbd 100644
--- a/net/spdy/spdy_session_pool.cc
+++ b/net/spdy/spdy_session_pool.cc
@@ -30,7 +30,7 @@ enum SpdySessionGetTypes {
SpdySessionPool::SpdySessionPool(
HostResolver* resolver,
SSLConfigService* ssl_config_service,
- HttpServerProperties* http_server_properties,
+ const base::WeakPtr<HttpServerProperties>& http_server_properties,
bool force_single_domain,
bool enable_ip_pooling,
bool enable_credential_frames,
diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h
index 7152527..a756234 100644
--- a/net/spdy/spdy_session_pool.h
+++ b/net/spdy/spdy_session_pool.h
@@ -12,6 +12,7 @@
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "net/base/host_port_pair.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
@@ -41,20 +42,21 @@ class NET_EXPORT SpdySessionPool
public:
typedef base::TimeTicks (*TimeFunc)(void);
- SpdySessionPool(HostResolver* host_resolver,
- SSLConfigService* ssl_config_service,
- HttpServerProperties* http_server_properties,
- bool force_single_domain,
- bool enable_ip_pooling,
- bool enable_credential_frames,
- bool enable_compression,
- bool enable_ping_based_connection_checking,
- NextProto default_protocol,
- size_t stream_initial_recv_window_size,
- size_t initial_max_concurrent_streams,
- size_t max_concurrent_streams_limit,
- SpdySessionPool::TimeFunc time_func,
- const std::string& trusted_spdy_proxy);
+ SpdySessionPool(
+ HostResolver* host_resolver,
+ SSLConfigService* ssl_config_service,
+ const base::WeakPtr<HttpServerProperties>& http_server_properties,
+ bool force_single_domain,
+ bool enable_ip_pooling,
+ bool enable_credential_frames,
+ bool enable_compression,
+ bool enable_ping_based_connection_checking,
+ NextProto default_protocol,
+ size_t stream_initial_recv_window_size,
+ size_t initial_max_concurrent_streams,
+ size_t max_concurrent_streams_limit,
+ SpdySessionPool::TimeFunc time_func,
+ const std::string& trusted_spdy_proxy);
virtual ~SpdySessionPool();
// In the functions below, a session is "available" if this pool has
@@ -118,7 +120,7 @@ class NET_EXPORT SpdySessionPool
// responsible for deleting the returned value.
base::Value* SpdySessionPoolInfoToValue() const;
- HttpServerProperties* http_server_properties() {
+ base::WeakPtr<HttpServerProperties> http_server_properties() {
return http_server_properties_;
}
@@ -177,7 +179,7 @@ class NET_EXPORT SpdySessionPool
const std::string& description,
bool idle_only);
- HttpServerProperties* const http_server_properties_;
+ const base::WeakPtr<HttpServerProperties> http_server_properties_;
// The set of all sessions. This is a superset of the sessions in
// |available_sessions_|.
diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc
index 427eefc..1a1cd57 100644
--- a/net/spdy/spdy_session_unittest.cc
+++ b/net/spdy/spdy_session_unittest.cc
@@ -842,7 +842,7 @@ TEST_P(SpdySessionTest, SendSettingsOnNewSession) {
TEST_P(SpdySessionTest, ClearSettingsStorageOnIPAddressChanged) {
CreateNetworkSession();
- HttpServerProperties* test_http_server_properties =
+ base::WeakPtr<HttpServerProperties> test_http_server_properties =
spdy_session_pool_->http_server_properties();
SettingsFlagsAndValue flags_and_value1(SETTINGS_FLAG_PLEASE_PERSIST, 2);
test_http_server_properties->SetSpdySetting(
diff --git a/net/spdy/spdy_test_util_common.cc b/net/spdy/spdy_test_util_common.cc
index 5ff731b..d8712cb 100644
--- a/net/spdy/spdy_test_util_common.cc
+++ b/net/spdy/spdy_test_util_common.cc
@@ -431,7 +431,8 @@ net::HttpNetworkSession::Params SpdySessionDependencies::CreateSessionParams(
params.ssl_config_service = session_deps->ssl_config_service.get();
params.http_auth_handler_factory =
session_deps->http_auth_handler_factory.get();
- params.http_server_properties = &session_deps->http_server_properties;
+ params.http_server_properties =
+ session_deps->http_server_properties.GetWeakPtr();
params.enable_spdy_compression = session_deps->enable_compression;
params.enable_spdy_ping_based_connection_checking = session_deps->enable_ping;
params.enable_user_alternate_protocol_ports =
@@ -456,7 +457,8 @@ SpdyURLRequestContext::SpdyURLRequestContext(NextProto protocol)
storage_.set_ssl_config_service(new SSLConfigServiceDefaults);
storage_.set_http_auth_handler_factory(HttpAuthHandlerFactory::CreateDefault(
host_resolver()));
- storage_.set_http_server_properties(new HttpServerPropertiesImpl);
+ storage_.set_http_server_properties(
+ scoped_ptr<HttpServerProperties>(new HttpServerPropertiesImpl()));
net::HttpNetworkSession::Params params;
params.client_socket_factory = &socket_factory_;
params.host_resolver = host_resolver();
diff --git a/net/tools/fetch/fetch_client.cc b/net/tools/fetch/fetch_client.cc
index 8deb492..f0bec35 100644
--- a/net/tools/fetch/fetch_client.cc
+++ b/net/tools/fetch/fetch_client.cc
@@ -164,7 +164,7 @@ int main(int argc, char** argv) {
session_params.transport_security_state = transport_security_state.get();
session_params.proxy_service = proxy_service.get();
session_params.http_auth_handler_factory = http_auth_handler_factory.get();
- session_params.http_server_properties = &http_server_properties;
+ session_params.http_server_properties = http_server_properties.GetWeakPtr();
session_params.ssl_config_service = ssl_config_service.get();
scoped_refptr<net::HttpNetworkSession> network_session(
diff --git a/net/url_request/url_request_context.cc b/net/url_request/url_request_context.cc
index 405d476..45ac83f 100644
--- a/net/url_request/url_request_context.cc
+++ b/net/url_request/url_request_context.cc
@@ -25,7 +25,6 @@ URLRequestContext::URLRequestContext()
http_auth_handler_factory_(NULL),
proxy_service_(NULL),
network_delegate_(NULL),
- http_server_properties_(NULL),
http_user_agent_settings_(NULL),
transport_security_state_(NULL),
http_transaction_factory_(NULL),
diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h
index 53da67d..bf9921e 100644
--- a/net/url_request/url_request_context.h
+++ b/net/url_request/url_request_context.h
@@ -137,10 +137,10 @@ class NET_EXPORT URLRequestContext
NetworkDelegate* network_delegate() const { return network_delegate_; }
void set_http_server_properties(
- HttpServerProperties* http_server_properties) {
+ const base::WeakPtr<HttpServerProperties>& http_server_properties) {
http_server_properties_ = http_server_properties;
}
- HttpServerProperties* http_server_properties() const {
+ base::WeakPtr<HttpServerProperties> http_server_properties() const {
return http_server_properties_;
}
@@ -216,7 +216,7 @@ class NET_EXPORT URLRequestContext
ProxyService* proxy_service_;
scoped_refptr<SSLConfigService> ssl_config_service_;
NetworkDelegate* network_delegate_;
- HttpServerProperties* http_server_properties_;
+ base::WeakPtr<HttpServerProperties> http_server_properties_;
HttpUserAgentSettings* http_user_agent_settings_;
scoped_refptr<CookieStore> cookie_store_;
TransportSecurityState* transport_security_state_;
diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc
index 39680f8..540dfc1 100644
--- a/net/url_request/url_request_context_builder.cc
+++ b/net/url_request/url_request_context_builder.cc
@@ -237,7 +237,9 @@ URLRequestContext* URLRequestContextBuilder::Build() {
context->host_resolver()));
storage->set_cookie_store(new CookieMonster(NULL, NULL));
storage->set_transport_security_state(new net::TransportSecurityState());
- storage->set_http_server_properties(new net::HttpServerPropertiesImpl);
+ storage->set_http_server_properties(
+ scoped_ptr<net::HttpServerProperties>(
+ new net::HttpServerPropertiesImpl()));
storage->set_cert_verifier(CertVerifier::CreateDefault());
net::HttpNetworkSession::Params network_session_params;
diff --git a/net/url_request/url_request_context_storage.cc b/net/url_request/url_request_context_storage.cc
index e3d84b47..2bb508c 100644
--- a/net/url_request/url_request_context_storage.cc
+++ b/net/url_request/url_request_context_storage.cc
@@ -84,9 +84,9 @@ void URLRequestContextStorage::set_network_delegate(
}
void URLRequestContextStorage::set_http_server_properties(
- HttpServerProperties* http_server_properties) {
- context_->set_http_server_properties(http_server_properties);
- http_server_properties_.reset(http_server_properties);
+ scoped_ptr<HttpServerProperties> http_server_properties) {
+ http_server_properties_ = http_server_properties.Pass();
+ context_->set_http_server_properties(http_server_properties_->GetWeakPtr());
}
void URLRequestContextStorage::set_cookie_store(CookieStore* cookie_store) {
diff --git a/net/url_request/url_request_context_storage.h b/net/url_request/url_request_context_storage.h
index 0a9d066..9c25f3e 100644
--- a/net/url_request/url_request_context_storage.h
+++ b/net/url_request/url_request_context_storage.h
@@ -56,7 +56,8 @@ class NET_EXPORT URLRequestContextStorage {
void set_proxy_service(ProxyService* proxy_service);
void set_ssl_config_service(SSLConfigService* ssl_config_service);
void set_network_delegate(NetworkDelegate* network_delegate);
- void set_http_server_properties(HttpServerProperties* http_server_properties);
+ void set_http_server_properties(
+ scoped_ptr<HttpServerProperties> http_server_properties);
void set_cookie_store(CookieStore* cookie_store);
void set_transport_security_state(
TransportSecurityState* transport_security_state);
diff --git a/net/url_request/url_request_test_util.cc b/net/url_request/url_request_test_util.cc
index 1a6757d..8b209f9 100644
--- a/net/url_request/url_request_test_util.cc
+++ b/net/url_request/url_request_test_util.cc
@@ -83,7 +83,7 @@ void TestURLRequestContext::Init() {
}
if (!http_server_properties()) {
context_storage_.set_http_server_properties(
- new HttpServerPropertiesImpl);
+ scoped_ptr<HttpServerProperties>(new HttpServerPropertiesImpl()));
}
if (!transport_security_state()) {
context_storage_.set_transport_security_state(