Index: content/browser/cancelable_request.h |
diff --git a/content/browser/cancelable_request.h b/content/browser/cancelable_request.h |
index 009ca98bf84e591ccabd65391f985eb0184860c2..3c68005286f4bd7af0f1ff8c8d5e2afcc1b8f221 100644 |
--- a/content/browser/cancelable_request.h |
+++ b/content/browser/cancelable_request.h |
@@ -139,6 +139,10 @@ class CancelableRequestProvider { |
// which will also set some state on the request). |
void RequestCompleted(Handle handle); |
+ // Identifies whether or not the specified request has already been completed |
+ // or canceled, according to whether it exists in |completed_requests_|. |
+ bool IsRequestCompleted(Handle handle); |
+ |
private: |
typedef std::map<Handle, scoped_refptr<CancelableRequestBase> > |
CancelableRequestMap; |
@@ -153,6 +157,9 @@ class CancelableRequestProvider { |
// Lists all outstanding requests. Protected by the |lock_|. |
CancelableRequestMap pending_requests_; |
+ // Lists all completed or canceled requests. Protected by the |lock_|. |
+ CancelableRequestMap completed_requests_; |
+ |
// The next handle value we will return. Protected by the |lock_|. |
int next_handle_; |
@@ -541,8 +548,10 @@ class CancelableRequestBase |
// Tells the provider that the request is complete, which then tells the |
// consumer. |
void NotifyCompleted() const { |
- provider_->RequestCompleted(handle()); |
- consumer_->DidExecute(provider_, handle_); |
+ if (!provider_->IsRequestCompleted(handle())) { |
+ provider_->RequestCompleted(handle()); |
+ consumer_->DidExecute(provider_, handle_); |
+ } |
} |
// Cover method for CancelableRequestConsumerBase::WillExecute. |