diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-11 03:27:09 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-11 03:27:09 +0000 |
commit | ef2bf421b04de3134cd7c02aac40a5565ef24dd9 (patch) | |
tree | 5bf90cca0bd015c23e843614ebf2e9f99cb8cd99 /chrome/service/net | |
parent | 280e9b5d4b2fb0fe14824e526521710a658bce56 (diff) | |
download | chromium_src-ef2bf421b04de3134cd7c02aac40a5565ef24dd9.zip chromium_src-ef2bf421b04de3134cd7c02aac40a5565ef24dd9.tar.gz chromium_src-ef2bf421b04de3134cd7c02aac40a5565ef24dd9.tar.bz2 |
Stop refcounting URLRequestContext.
While doing so, fix a few issues with the code like ordering of URLRequestContext to ensure correct destruction order. Also fix const correctness in some places.
BUG=58859
TEST=none
TBR=willchan
Review URL: https://chromiumcodereview.appspot.com/10299002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136497 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service/net')
-rw-r--r-- | chrome/service/net/service_url_request_context.cc | 8 | ||||
-rw-r--r-- | chrome/service/net/service_url_request_context.h | 7 |
2 files changed, 7 insertions, 8 deletions
diff --git a/chrome/service/net/service_url_request_context.cc b/chrome/service/net/service_url_request_context.cc index 4fb2385..493a6f5 100644 --- a/chrome/service/net/service_url_request_context.cc +++ b/chrome/service/net/service_url_request_context.cc @@ -170,11 +170,11 @@ ServiceURLRequestContextGetter::ServiceURLRequestContextGetter() net::URLRequestContext* ServiceURLRequestContextGetter::GetURLRequestContext() { - if (!url_request_context_) - url_request_context_ = + if (!url_request_context_.get()) + url_request_context_.reset( new ServiceURLRequestContext(user_agent_, - proxy_config_service_.release()); - return url_request_context_; + proxy_config_service_.release())); + return url_request_context_.get(); } scoped_refptr<base::MessageLoopProxy> diff --git a/chrome/service/net/service_url_request_context.h b/chrome/service/net/service_url_request_context.h index 1578f23..ae2b547 100644 --- a/chrome/service/net/service_url_request_context.h +++ b/chrome/service/net/service_url_request_context.h @@ -40,12 +40,11 @@ class ServiceURLRequestContext : public net::URLRequestContext { const std::string& user_agent, net::ProxyConfigService* net_proxy_config_service); + virtual ~ServiceURLRequestContext(); + // Overridden from net::URLRequestContext: virtual const std::string& GetUserAgent(const GURL& url) const OVERRIDE; - protected: - virtual ~ServiceURLRequestContext(); - private: std::string user_agent_; net::URLRequestContextStorage storage_; @@ -70,9 +69,9 @@ class ServiceURLRequestContextGetter : public net::URLRequestContextGetter { virtual ~ServiceURLRequestContextGetter(); std::string user_agent_; - scoped_refptr<net::URLRequestContext> url_request_context_; scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; scoped_ptr<net::ProxyConfigService> proxy_config_service_; + scoped_ptr<net::URLRequestContext> url_request_context_; }; #endif // CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_ |