diff options
Diffstat (limited to 'chrome/browser/cancelable_request.cc')
-rw-r--r-- | chrome/browser/cancelable_request.cc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/chrome/browser/cancelable_request.cc b/chrome/browser/cancelable_request.cc index 1aba550..167a1df 100644 --- a/chrome/browser/cancelable_request.cc +++ b/chrome/browser/cancelable_request.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -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(); |