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

Unified Diff: chrome/browser/net/chrome_url_request_context.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/net/chrome_url_request_context.cc
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index 96bdde42b026b505ca109834e25b2ca371a0ed10..19689d6772f9f79bf7b75710732bab81ecd96c50 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -30,7 +30,7 @@ class ChromeURLRequestContextFactory {
virtual ~ChromeURLRequestContextFactory() {}
// Called to create a new instance (will only be called once).
- virtual scoped_refptr<ChromeURLRequestContext> Create() = 0;
+ virtual ChromeURLRequestContext* Create() = 0;
protected:
DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextFactory);
@@ -48,7 +48,7 @@ class FactoryForMain : public ChromeURLRequestContextFactory {
explicit FactoryForMain(const ProfileIOData* profile_io_data)
: profile_io_data_(profile_io_data) {}
- virtual scoped_refptr<ChromeURLRequestContext> Create() {
+ virtual ChromeURLRequestContext* Create() {
eroman 2012/05/04 04:27:02 can you add OVERRIDE?
return profile_io_data_->GetMainRequestContext();
}
@@ -62,7 +62,7 @@ class FactoryForExtensions : public ChromeURLRequestContextFactory {
explicit FactoryForExtensions(const ProfileIOData* profile_io_data)
: profile_io_data_(profile_io_data) {}
- virtual scoped_refptr<ChromeURLRequestContext> Create() {
+ virtual ChromeURLRequestContext* Create() {
eroman 2012/05/04 04:27:02 can you add OVERRIDE?
return profile_io_data_->GetExtensionsRequestContext();
}
@@ -80,7 +80,7 @@ class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
app_id_(app_id),
main_request_context_getter_(main_context) {}
- virtual scoped_refptr<ChromeURLRequestContext> Create() {
+ virtual ChromeURLRequestContext* Create() {
eroman 2012/05/04 04:27:02 can you add OVERRIDE?
// We will copy most of the state from the main request context.
return profile_io_data_->GetIsolatedAppRequestContext(
main_request_context_getter_->GetIOContext(), app_id_);
@@ -100,7 +100,7 @@ class FactoryForMedia : public ChromeURLRequestContextFactory {
: profile_io_data_(profile_io_data) {
}
- virtual scoped_refptr<ChromeURLRequestContext> Create() {
+ virtual ChromeURLRequestContext* Create() {
eroman 2012/05/04 04:27:02 can you add OVERRIDE?
return profile_io_data_->GetMediaRequestContext();
}
@@ -315,7 +315,12 @@ void ChromeURLRequestContextGetter::OnClearSiteDataOnExitChange(
// ----------------------------------------------------------------------------
ChromeURLRequestContext::ChromeURLRequestContext()
- : is_incognito_(false) {
+ : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
+ is_incognito_(false) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+}
+
+ChromeURLRequestContext::~ChromeURLRequestContext() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
}
@@ -338,10 +343,6 @@ void ChromeURLRequestContext::set_chrome_url_data_manager_backend(
chrome_url_data_manager_backend_ = backend;
}
-ChromeURLRequestContext::~ChromeURLRequestContext() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
-}
-
const std::string& ChromeURLRequestContext::GetUserAgent(
const GURL& url) const {
return content::GetUserAgent(url);

Powered by Google App Engine
This is Rietveld 408576698