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

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: Removed too much, back up a bit Created 5 years, 4 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
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 e33c13193ef751cd462574995b24166500f4fc6b..5c7c74bee207ceeba641ae5806e5c8455025a053 100644
--- a/net/spdy/spdy_test_util_common.cc
+++ b/net/spdy/spdy_test_util_common.cc
@@ -415,26 +415,27 @@ SpdySessionDependencies::SpdySessionDependencies(NextProto protocol,
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
@@ -498,12 +499,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(new HttpCache(
- network_session.get(), HttpCache::DefaultBackend::InMemory(0)));
+ storage_.set_http_transaction_factory(
+ new HttpCache(storage_.http_network_session(),
+ HttpCache::DefaultBackend::InMemory(0), false));
}
SpdyURLRequestContext::~SpdyURLRequestContext() {
@@ -517,7 +520,7 @@ bool HasSpdySession(SpdySessionPool* pool, const SpdySessionKey& key) {
namespace {
base::WeakPtr<SpdySession> CreateSpdySessionHelper(
- const scoped_refptr<HttpNetworkSession>& http_session,
+ const scoped_ptr<HttpNetworkSession>& http_session,
pauljensen 2015/09/02 14:32:30 should be a raw pointer
mmenke 2015/09/02 16:29:34 Done.
const SpdySessionKey& key,
const BoundNetLog& net_log,
Error expected_status,
@@ -578,7 +581,7 @@ base::WeakPtr<SpdySession> CreateSpdySessionHelper(
} // namespace
base::WeakPtr<SpdySession> CreateInsecureSpdySession(
- const scoped_refptr<HttpNetworkSession>& http_session,
+ const scoped_ptr<HttpNetworkSession>& http_session,
const SpdySessionKey& key,
const BoundNetLog& net_log) {
return CreateSpdySessionHelper(http_session, key, net_log,
@@ -586,7 +589,7 @@ base::WeakPtr<SpdySession> CreateInsecureSpdySession(
}
base::WeakPtr<SpdySession> TryCreateInsecureSpdySessionExpectingFailure(
- const scoped_refptr<HttpNetworkSession>& http_session,
+ const scoped_ptr<HttpNetworkSession>& http_session,
const SpdySessionKey& key,
Error expected_error,
const BoundNetLog& net_log) {
@@ -596,7 +599,7 @@ base::WeakPtr<SpdySession> TryCreateInsecureSpdySessionExpectingFailure(
}
base::WeakPtr<SpdySession> CreateSecureSpdySession(
- const scoped_refptr<HttpNetworkSession>& http_session,
+ const scoped_ptr<HttpNetworkSession>& http_session,
const SpdySessionKey& key,
const BoundNetLog& net_log) {
return CreateSpdySessionHelper(http_session, key, net_log,

Powered by Google App Engine
This is Rietveld 408576698