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

Unified Diff: chrome/browser/profiles/profile_io_data.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/profiles/profile_io_data.cc
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index 1d17668bc040158e070f5a6ab73c931488eac26c..8cb26b8caba8b8610414d0545065138eb464a49c 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -271,13 +271,14 @@ ProfileIOData::~ProfileIOData() {
if (BrowserThread::IsMessageLoopValid(BrowserThread::IO))
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- if (main_request_context_)
+ if (main_request_context_.get())
main_request_context_->AssertNoURLRequests();
- if (extensions_request_context_)
+ if (extensions_request_context_.get())
extensions_request_context_->AssertNoURLRequests();
for (AppRequestContextMap::iterator it = app_request_context_map_.begin();
it != app_request_context_map_.end(); ++it) {
it->second->AssertNoURLRequests();
+ delete it->second;
}
}
@@ -326,33 +327,33 @@ ProfileIOData::GetChromeURLDataManagerBackend() const {
return chrome_url_data_manager_backend_.get();
}
-scoped_refptr<ChromeURLRequestContext>
+ChromeURLRequestContext*
ProfileIOData::GetMainRequestContext() const {
LazyInitialize();
- return main_request_context_;
+ return main_request_context_.get();
}
-scoped_refptr<ChromeURLRequestContext>
+ChromeURLRequestContext*
ProfileIOData::GetMediaRequestContext() const {
LazyInitialize();
- scoped_refptr<ChromeURLRequestContext> context =
+ ChromeURLRequestContext* context =
AcquireMediaRequestContext();
DCHECK(context);
return context;
}
-scoped_refptr<ChromeURLRequestContext>
+ChromeURLRequestContext*
ProfileIOData::GetExtensionsRequestContext() const {
LazyInitialize();
- return extensions_request_context_;
+ return extensions_request_context_.get();
}
-scoped_refptr<ChromeURLRequestContext>
+ChromeURLRequestContext*
ProfileIOData::GetIsolatedAppRequestContext(
- scoped_refptr<ChromeURLRequestContext> main_context,
+ ChromeURLRequestContext* main_context,
const std::string& app_id) const {
LazyInitialize();
- scoped_refptr<ChromeURLRequestContext> context;
+ ChromeURLRequestContext* context;
if (ContainsKey(app_request_context_map_, app_id)) {
context = app_request_context_map_[app_id];
} else {
@@ -465,8 +466,8 @@ void ProfileIOData::LazyInitialize() const {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
// Create the common request contexts.
- main_request_context_ = new ChromeURLRequestContext;
- extensions_request_context_ = new ChromeURLRequestContext;
+ main_request_context_.reset(new ChromeURLRequestContext);
+ extensions_request_context_.reset(new ChromeURLRequestContext);
chrome_url_data_manager_backend_.reset(new ChromeURLDataManagerBackend);
@@ -480,7 +481,7 @@ void ProfileIOData::LazyInitialize() const {
fraudulent_certificate_reporter_.reset(
new chrome_browser_net::ChromeFraudulentCertificateReporter(
- main_request_context_));
+ main_request_context_.get()));
proxy_service_.reset(
ProxyServiceFactory::CreateProxyService(
@@ -536,7 +537,7 @@ void ProfileIOData::LazyInitialize() const {
extension_info_map_ = profile_params_->extension_info_map;
resource_context_->host_resolver_ = io_thread_globals->host_resolver.get();
- resource_context_->request_context_ = main_request_context_;
+ resource_context_->request_context_ = main_request_context_.get();
LazyInitializeInternal(profile_params_.get());

Powered by Google App Engine
This is Rietveld 408576698