Index: content/browser/renderer_host/resource_queue.cc |
=================================================================== |
--- content/browser/renderer_host/resource_queue.cc (revision 105660) |
+++ content/browser/renderer_host/resource_queue.cc (working copy) |
@@ -75,23 +75,19 @@ |
requests_.erase(request_id); |
} |
-void ResourceQueue::StartDelayedRequests(ResourceQueueDelegate* delegate) { |
+void ResourceQueue::StartDelayedRequest(ResourceQueueDelegate* delegate, |
+ const GlobalRequestID& request_id) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
DCHECK(!shutdown_); |
- for (RequestMap::iterator i = requests_.begin(); i != requests_.end(); ++i) { |
- GlobalRequestID request_id = i->first; |
- // Ignore requests that this delegate never asked to delay. |
- if (!ContainsKey(interested_delegates_, request_id) || |
- !ContainsKey(interested_delegates_[request_id], delegate)) { |
- continue; |
- } |
- interested_delegates_[request_id].erase(delegate); |
+ DCHECK(ContainsKey(interested_delegates_, request_id)); |
+ DCHECK(ContainsKey(interested_delegates_[request_id], delegate)); |
+ interested_delegates_[request_id].erase(delegate); |
+ if (interested_delegates_[request_id].empty()) { |
+ interested_delegates_.erase(request_id); |
- // If no more delegates want a delay, start the request. |
- if (interested_delegates_[request_id].empty()) { |
- interested_delegates_.erase(request_id); |
- net::URLRequest* request = i->second; |
+ if (ContainsKey(requests_, request_id)) { |
+ net::URLRequest* request = requests_[request_id]; |
// The request shouldn't have started (SUCCESS is the initial state). |
DCHECK_EQ(net::URLRequestStatus::SUCCESS, request->status().status()); |
request->Start(); |