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

Unified Diff: chrome/browser/cancelable_request.cc

Issue 10383262: RefCounted types should not have public destructors, delegate cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make win bot happy Created 8 years, 6 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
« no previous file with comments | « chrome/browser/cancelable_request.h ('k') | chrome/browser/content_settings/content_settings_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cancelable_request.cc
diff --git a/chrome/browser/cancelable_request.cc b/chrome/browser/cancelable_request.cc
index 1aba550fe5a69db2340c006d05a8956178d869bb..7f9ae62e6b4b46929802c1c788dfdaa66eadb1d8 100644
--- a/chrome/browser/cancelable_request.cc
+++ b/chrome/browser/cancelable_request.cc
@@ -8,17 +8,6 @@ CancelableRequestProvider::CancelableRequestProvider()
: next_handle_(1) {
}
-CancelableRequestProvider::~CancelableRequestProvider() {
- // There may be requests whose result callback has not been run yet. We need
- // to cancel them otherwise they may try and call us back after we've been
- // deleted, or do other bad things. This can occur on shutdown (or browser
- // context destruction) when a request is scheduled, completed (but not
- // dispatched), then the BrowserContext is deleted.
- base::AutoLock lock(pending_request_lock_);
- while (!pending_requests_.empty())
- CancelRequestLocked(pending_requests_.begin());
-}
-
CancelableRequestProvider::Handle CancelableRequestProvider::AddRequest(
CancelableRequestBase* request,
CancelableRequestConsumerBase* consumer) {
@@ -44,6 +33,17 @@ void CancelableRequestProvider::CancelRequest(Handle handle) {
CancelRequestLocked(pending_requests_.find(handle));
}
+CancelableRequestProvider::~CancelableRequestProvider() {
+ // There may be requests whose result callback has not been run yet. We need
+ // to cancel them otherwise they may try and call us back after we've been
+ // deleted, or do other bad things. This can occur on shutdown (or browser
+ // context destruction) when a request is scheduled, completed (but not
+ // dispatched), then the BrowserContext is deleted.
+ base::AutoLock lock(pending_request_lock_);
+ while (!pending_requests_.empty())
+ CancelRequestLocked(pending_requests_.begin());
+}
+
void CancelableRequestProvider::CancelRequestLocked(
const CancelableRequestMap::iterator& item) {
pending_request_lock_.AssertAcquired();
« no previous file with comments | « chrome/browser/cancelable_request.h ('k') | chrome/browser/content_settings/content_settings_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698