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/browser/safe_browsing | |
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/browser/safe_browsing')
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_service.cc | 9 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_service.h | 2 |
2 files changed, 5 insertions, 6 deletions
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc index 642bf38..6fea46f 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc @@ -145,9 +145,9 @@ SafeBrowsingURLRequestContextGetter::~SafeBrowsingURLRequestContextGetter() {} net::URLRequestContext* SafeBrowsingURLRequestContextGetter::GetURLRequestContext() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - DCHECK(sb_service_->url_request_context_); + DCHECK(sb_service_->url_request_context_.get()); - return sb_service_->url_request_context_; + return sb_service_->url_request_context_.get(); } scoped_refptr<base::MessageLoopProxy> @@ -614,7 +614,7 @@ void SafeBrowsingService::InitURLRequestContextOnIOThread( FilePath(BaseFilename().value() + kCookiesFile), false), NULL); - url_request_context_ = new SafeBrowsingURLRequestContext; + url_request_context_.reset(new SafeBrowsingURLRequestContext); // |system_url_request_context_getter| may be NULL during tests. if (system_url_request_context_getter) url_request_context_->CopyFrom( @@ -633,8 +633,7 @@ void SafeBrowsingService::DestroyURLRequestContextOnIOThread() { using base::debug::LeakTracker; LeakTracker<SafeBrowsingURLRequestContextGetter>::CheckForLeaks(); - DCHECK(url_request_context_.get()); - url_request_context_ = NULL; + url_request_context_.reset(); } void SafeBrowsingService::StartOnIOThread() { diff --git a/chrome/browser/safe_browsing/safe_browsing_service.h b/chrome/browser/safe_browsing/safe_browsing_service.h index 511a758..85eb5ef 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.h +++ b/chrome/browser/safe_browsing/safe_browsing_service.h @@ -514,7 +514,7 @@ class SafeBrowsingService url_request_context_getter_; // The SafeBrowsingURLRequestContext. - scoped_refptr<net::URLRequestContext> url_request_context_; + scoped_ptr<net::URLRequestContext> url_request_context_; // Handles interaction with SafeBrowsing servers. SafeBrowsingProtocolManager* protocol_manager_; |