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

Unified Diff: chrome/browser/net/chrome_url_request_context.h

Issue 10299002: Stop refcounting URLRequestContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initialize to NULL Created 8 years, 7 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.h
diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h
index be9f5e3cfedbd0f7554e792803dc6ffc0a121c5f..31a41d314b68624e3c4cb33b1e7dff18f72b84b8 100644
--- a/chrome/browser/net/chrome_url_request_context.h
+++ b/chrome/browser/net/chrome_url_request_context.h
@@ -29,6 +29,11 @@ class ProfileIOData;
class ChromeURLRequestContext : public net::URLRequestContext {
public:
ChromeURLRequestContext();
+ virtual ~ChromeURLRequestContext();
+
+ base::WeakPtr<ChromeURLRequestContext> GetWeakPtr() {
+ return weak_factory_.GetWeakPtr();
+ }
// Copies the state from |other| into this context.
void CopyFrom(ChromeURLRequestContext* other);
@@ -56,10 +61,9 @@ class ChromeURLRequestContext : public net::URLRequestContext {
// Callback for when the default charset changes.
void OnDefaultCharsetChange(const std::string& default_charset);
- protected:
- virtual ~ChromeURLRequestContext();
-
private:
+ base::WeakPtrFactory<ChromeURLRequestContext> weak_factory_;
+
// ---------------------------------------------------------------------------
// Important: When adding any new members below, consider whether they need to
// be added to CopyFrom.
@@ -177,10 +181,10 @@ class ChromeURLRequestContextGetter : public net::URLRequestContextGetter,
// Access only from the IO thread.
scoped_ptr<ChromeURLRequestContextFactory> factory_;
- // NULL if not yet initialized. Otherwise, it is the net::URLRequestContext
+ // NULL if not yet initialized. Otherwise, it is the ChromeURLRequestContext
// instance that was lazily created by GetURLRequestContext().
// Access only from the IO thread.
- base::WeakPtr<net::URLRequestContext> url_request_context_;
+ base::WeakPtr<ChromeURLRequestContext> url_request_context_;
DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter);
};

Powered by Google App Engine
This is Rietveld 408576698