Chromium Code Reviews| Index: content/browser/cancelable_request.h |
| diff --git a/content/browser/cancelable_request.h b/content/browser/cancelable_request.h |
| index df27cbce26421ede756289a3353571666dca0cb7..756eed58f4bba4d093a015358e78d00d93d1e76e 100644 |
| --- a/content/browser/cancelable_request.h |
| +++ b/content/browser/cancelable_request.h |
| @@ -238,12 +238,18 @@ class CancelableRequestConsumerTSimple : public CancelableRequestConsumerBase { |
| // Returns true if there are any pending requests. |
| bool HasPendingRequests() const; |
| + // Returns true if there are any pending requests. |
| + bool HasPendingRequestsForClientData(T client_data) const; |
| + |
| // Returns the number of pending requests. |
| size_t PendingRequestCount() const; |
| // Cancels all requests outstanding. |
| void CancelAllRequests(); |
| + // Cancels all requests outstanding matching the client data |
|
brettw
2011/06/17 16:20:49
Needs period.
Emmanuel Saint-loubert-Bié
2011/06/17 16:52:44
Done.
|
| + void CancelAllRequestsForClientData(T client_data); |
| + |
| // Returns the handle for the first request that has the specified client data |
| // (in |handle|). Returns true if there is a request for the specified client |
| // data, false otherwise. |
| @@ -338,6 +344,18 @@ bool CancelableRequestConsumerTSimple<T>::HasPendingRequests() const { |
| } |
| template<class T> |
| +bool CancelableRequestConsumerTSimple<T>::HasPendingRequestsForClientData( |
|
brettw
2011/06/17 16:20:49
Do we really need this function? In your single ca
Emmanuel Saint-loubert-Bié
2011/06/17 16:52:44
Done.
|
| + T client_data) const { |
| + for (typename PendingRequestList::const_iterator i = |
| + pending_requests_.begin(); i != pending_requests_.end(); ++i) { |
| + if (i->second == client_data) { |
|
brettw
2011/06/17 16:20:49
No {} for single-line conditionals.
Emmanuel Saint-loubert-Bié
2011/06/17 16:52:44
Done.
|
| + return true; |
| + } |
| + } |
| + return false; |
| +} |
| + |
| +template<class T> |
| size_t CancelableRequestConsumerTSimple<T>::PendingRequestCount() const { |
| return pending_requests_.size(); |
| } |
| @@ -358,6 +376,17 @@ void CancelableRequestConsumerTSimple<T>::CancelAllRequests() { |
| } |
| template<class T> |
| +void CancelableRequestConsumerTSimple<T>::CancelAllRequestsForClientData( |
| + T client_data) { |
| + PendingRequestList copied_requests(pending_requests_); |
| + for (typename PendingRequestList::const_iterator i = copied_requests.begin(); |
| + i != copied_requests.end(); ++i) |
|
brettw
2011/06/17 16:20:49
You should use {} for this for loop since it conta
Emmanuel Saint-loubert-Bié
2011/06/17 16:52:44
OK but this is a cut-and-paste from above :-) Whic
|
| + if (i->second == client_data) |
| + i->first.provider->CancelRequest(i->first.handle); |
| + copied_requests.clear(); |
| +} |
| + |
| +template<class T> |
| bool CancelableRequestConsumerTSimple<T>::GetFirstHandleForClientData( |
| T client_data, |
| CancelableRequestProvider::Handle* handle) { |