Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Unified Diff: content/browser/loader/resource_scheduler.cc

Issue 1192673002: Ensure ResourceScheduler starts requests even if the tab is closed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/loader/resource_scheduler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | content/browser/loader/resource_scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698