Chromium Code Reviews| Index: content/browser/loader/resource_scheduler.cc |
| diff --git a/content/browser/loader/resource_scheduler.cc b/content/browser/loader/resource_scheduler.cc |
| index 7bc6c0458b86648b22e88ed16bd5cfceea8c52e6..434f634a18a522dd3ae2fdb7c0ce7819f61dc6d3 100644 |
| --- a/content/browser/loader/resource_scheduler.cc |
| +++ b/content/browser/loader/resource_scheduler.cc |
| @@ -337,7 +337,20 @@ class ResourceScheduler::Client { |
| } |
| } |
| - RequestSet RemoveAllRequests() { |
| + RequestSet StartAndRemoveAllRequests() { |
| + // First start any pending requests so that they will be moved into |
| + // in_flight_requests_. This may exceed the limits |
| + // kMaxNumDelayableRequestsPerClient, kMaxNumDelayableRequestsPerHost and |
| + // kMaxNumThrottledRequestsPerClient, so this method must not do anything |
| + // that depends on those limits before calling ClearInFlightRequests() |
| + // below. |
| + while (!pending_requests_.IsEmpty()) { |
| + ScheduledResourceRequest* request = |
| + *pending_requests_.GetNextHighestIterator(); |
| + pending_requests_.Erase(request); |
| + // StartRequest() may modify pending_requests_. TODO(ricea): Does it? |
| + StartRequest(request); |
| + } |
| RequestSet unowned_requests; |
| for (RequestSet::iterator it = in_flight_requests_.begin(); |
| it != in_flight_requests_.end(); ++it) { |
| @@ -918,10 +931,10 @@ void ResourceScheduler::OnClientDeleted(int child_id, int route_id) { |
| return; |
| Client* client = it->second; |
| - // FYI, ResourceDispatcherHost cancels all of the requests after this function |
| - // is called. It should end up canceling all of the requests except for a |
| - // cross-renderer navigation. |
| - RequestSet client_unowned_requests = client->RemoveAllRequests(); |
| + // ResourceDispatcherHost cancels all requests except for cross-renderer |
| + // navigations, async revalidations and detachable requests after |
| + // OnClientDeleted() returns. |
|
mmenke
2015/06/18 14:49:26
Wait...So we start a bunch of requests, and then w
Adam Rice
2015/06/19 13:06:53
Even without this CL up to 10 requests will be sta
mmenke
2015/06/19 15:10:16
You mean in the destructor, when we call UpdateThr
Adam Rice
2015/06/23 17:06:52
Sorry, I was confused because throttling is enable
|
| + RequestSet client_unowned_requests = client->StartAndRemoveAllRequests(); |
| for (RequestSet::iterator it = client_unowned_requests.begin(); |
| it != client_unowned_requests.end(); ++it) { |
| unowned_requests_.insert(*it); |