Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(689)

Unified Diff: net/spdy/spdy_test_util_common.cc

Issue 1298253002: Remove reference counting from HttpNetworkSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_test_util_common.h ('k') | net/url_request/url_request_context_builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_test_util_common.cc
diff --git a/net/spdy/spdy_test_util_common.cc b/net/spdy/spdy_test_util_common.cc
index 8755cc06c70a4743e5fc9bff9abb375ac65e6b05..a7dd2bd075a18f9de7690665d8372dcf839081e4 100644
--- a/net/spdy/spdy_test_util_common.cc
+++ b/net/spdy/spdy_test_util_common.cc
@@ -416,26 +416,27 @@ SpdySessionDependencies::SpdySessionDependencies(
SpdySessionDependencies::~SpdySessionDependencies() {}
// static
-HttpNetworkSession* SpdySessionDependencies::SpdyCreateSession(
+scoped_ptr<HttpNetworkSession> SpdySessionDependencies::SpdyCreateSession(
SpdySessionDependencies* session_deps) {
HttpNetworkSession::Params params = CreateSessionParams(session_deps);
params.client_socket_factory = session_deps->socket_factory.get();
- HttpNetworkSession* http_session = new HttpNetworkSession(params);
+ scoped_ptr<HttpNetworkSession> http_session(new HttpNetworkSession(params));
SpdySessionPoolPeer pool_peer(http_session->spdy_session_pool());
pool_peer.SetEnableSendingInitialData(false);
- return http_session;
+ return http_session.Pass();
}
// static
-HttpNetworkSession* SpdySessionDependencies::SpdyCreateSessionDeterministic(
+scoped_ptr<HttpNetworkSession>
+SpdySessionDependencies::SpdyCreateSessionDeterministic(
SpdySessionDependencies* session_deps) {
HttpNetworkSession::Params params = CreateSessionParams(session_deps);
params.client_socket_factory =
session_deps->deterministic_socket_factory.get();
- HttpNetworkSession* http_session = new HttpNetworkSession(params);
+ scoped_ptr<HttpNetworkSession> http_session(new HttpNetworkSession(params));
SpdySessionPoolPeer pool_peer(http_session->spdy_session_pool());
pool_peer.SetEnableSendingInitialData(false);
- return http_session;
+ return http_session.Pass();
}
// static
@@ -500,12 +501,14 @@ SpdyURLRequestContext::SpdyURLRequestContext(NextProto protocol)
params.enable_spdy_ping_based_connection_checking = false;
params.spdy_default_protocol = protocol;
params.http_server_properties = http_server_properties();
- scoped_refptr<HttpNetworkSession> network_session(
- new HttpNetworkSession(params));
- SpdySessionPoolPeer pool_peer(network_session->spdy_session_pool());
+ storage_.set_http_network_session(
+ make_scoped_ptr(new HttpNetworkSession(params)));
+ SpdySessionPoolPeer pool_peer(
+ storage_.http_network_session()->spdy_session_pool());
pool_peer.SetEnableSendingInitialData(false);
- storage_.set_http_transaction_factory(make_scoped_ptr(new HttpCache(
- network_session.get(), HttpCache::DefaultBackend::InMemory(0))));
+ storage_.set_http_transaction_factory(make_scoped_ptr(
+ new HttpCache(storage_.http_network_session(),
+ HttpCache::DefaultBackend::InMemory(0), false)));
}
SpdyURLRequestContext::~SpdyURLRequestContext() {
@@ -519,7 +522,7 @@ bool HasSpdySession(SpdySessionPool* pool, const SpdySessionKey& key) {
namespace {
base::WeakPtr<SpdySession> CreateSpdySessionHelper(
- const scoped_refptr<HttpNetworkSession>& http_session,
+ HttpNetworkSession* http_session,
const SpdySessionKey& key,
const BoundNetLog& net_log,
Error expected_status,
@@ -580,7 +583,7 @@ base::WeakPtr<SpdySession> CreateSpdySessionHelper(
} // namespace
base::WeakPtr<SpdySession> CreateInsecureSpdySession(
- const scoped_refptr<HttpNetworkSession>& http_session,
+ HttpNetworkSession* http_session,
const SpdySessionKey& key,
const BoundNetLog& net_log) {
return CreateSpdySessionHelper(http_session, key, net_log,
@@ -588,7 +591,7 @@ base::WeakPtr<SpdySession> CreateInsecureSpdySession(
}
base::WeakPtr<SpdySession> TryCreateInsecureSpdySessionExpectingFailure(
- const scoped_refptr<HttpNetworkSession>& http_session,
+ HttpNetworkSession* http_session,
const SpdySessionKey& key,
Error expected_error,
const BoundNetLog& net_log) {
@@ -598,7 +601,7 @@ base::WeakPtr<SpdySession> TryCreateInsecureSpdySessionExpectingFailure(
}
base::WeakPtr<SpdySession> CreateSecureSpdySession(
- const scoped_refptr<HttpNetworkSession>& http_session,
+ HttpNetworkSession* http_session,
const SpdySessionKey& key,
const BoundNetLog& net_log) {
return CreateSpdySessionHelper(http_session, key, net_log,
« no previous file with comments | « net/spdy/spdy_test_util_common.h ('k') | net/url_request/url_request_context_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698