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

Unified Diff: chrome/browser/io_thread.cc

Issue 10299002: Stop refcounting URLRequestContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More fixes Created 8 years, 8 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: chrome/browser/io_thread.cc
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 1c0717bb28e5b148f55143f3dafa8ff3e44147aa..6dd841fbd431b08e005f8889fae6b58a745e04da 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -198,11 +198,10 @@ class LoggingNetworkChangeObserver
// Create a separate request context for PAC fetches to avoid reference cycles.
eroman 2012/05/04 04:27:02 nit: I wander if "reference cycles" is the right w
// See IOThread::Globals for details.
-scoped_refptr<net::URLRequestContext>
+net::URLRequestContext*
ConstructProxyScriptFetcherContext(IOThread::Globals* globals,
net::NetLog* net_log) {
- scoped_refptr<net::URLRequestContext> context(
- new URLRequestContextWithUserAgent);
+ net::URLRequestContext* context = new URLRequestContextWithUserAgent;
context->set_net_log(net_log);
context->set_host_resolver(globals->host_resolver.get());
context->set_cert_verifier(globals->cert_verifier.get());
@@ -225,11 +224,10 @@ ConstructProxyScriptFetcherContext(IOThread::Globals* globals,
return context;
}
-scoped_refptr<net::URLRequestContext>
+net::URLRequestContext*
ConstructSystemRequestContext(IOThread::Globals* globals,
net::NetLog* net_log) {
- scoped_refptr<net::URLRequestContext> context(
- new SystemURLRequestContext);
+ net::URLRequestContext* context = new SystemURLRequestContext;
context->set_net_log(net_log);
context->set_host_resolver(globals->host_resolver.get());
context->set_cert_verifier(globals->cert_verifier.get());
@@ -280,9 +278,9 @@ SystemURLRequestContextGetter::~SystemURLRequestContextGetter() {}
net::URLRequestContext* SystemURLRequestContextGetter::GetURLRequestContext() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- DCHECK(io_thread_->globals()->system_request_context);
+ DCHECK(io_thread_->globals()->system_request_context.get());
- return io_thread_->globals()->system_request_context;
+ return io_thread_->globals()->system_request_context.get();
}
scoped_refptr<base::MessageLoopProxy>
@@ -454,8 +452,8 @@ void IOThread::Init() {
}
globals_->throttler_manager->set_net_log(net_log_);
- globals_->proxy_script_fetcher_context =
- ConstructProxyScriptFetcherContext(globals_, net_log_);
+ globals_->proxy_script_fetcher_context.reset(
+ ConstructProxyScriptFetcherContext(globals_, net_log_));
sdch_manager_ = new net::SdchManager();
@@ -600,7 +598,7 @@ void IOThread::InitSystemRequestContextOnIOThread() {
globals_->system_proxy_service.reset(
ProxyServiceFactory::CreateProxyService(
net_log_,
- globals_->proxy_script_fetcher_context,
+ globals_->proxy_script_fetcher_context.get(),
system_proxy_config_service_.release(),
command_line));
net::HttpNetworkSession::Params system_params;
@@ -623,8 +621,8 @@ void IOThread::InitSystemRequestContextOnIOThread() {
new net::HttpNetworkSession(system_params)));
globals_->system_ftp_transaction_factory.reset(
new net::FtpNetworkLayer(globals_->host_resolver.get()));
- globals_->system_request_context =
- ConstructSystemRequestContext(globals_, net_log_);
+ globals_->system_request_context.reset(
+ ConstructSystemRequestContext(globals_, net_log_));
sdch_manager_->set_sdch_fetcher(
new SdchDictionaryFetcher(system_url_request_context_getter_.get()));

Powered by Google App Engine
This is Rietveld 408576698