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(); |