| 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..69ec83d29357784f27da5f58a1bbd68d92477c7c 100644
|
| --- a/content/browser/loader/resource_scheduler.cc
|
| +++ b/content/browser/loader/resource_scheduler.cc
|
| @@ -167,10 +167,13 @@ class ResourceScheduler::ScheduledResourceRequest
|
| request_(request),
|
| ready_(false),
|
| deferred_(false),
|
| + is_async_revalidation_(false),
|
| classification_(NORMAL_REQUEST),
|
| scheduler_(scheduler),
|
| priority_(priority),
|
| fifo_ordering_(0) {
|
| + is_async_revalidation_ =
|
| + ResourceRequestInfo::ForRequest(request)->IsAsyncRevalidation();
|
| }
|
|
|
| ~ScheduledResourceRequest() override { scheduler_->RemoveRequest(this); }
|
| @@ -226,6 +229,7 @@ class ResourceScheduler::ScheduledResourceRequest
|
| void set_classification(RequestClassification classification) {
|
| classification_ = classification;
|
| }
|
| + bool is_async_revalidation() const { return is_async_revalidation_; }
|
|
|
| private:
|
| // ResourceMessageDelegate interface:
|
| @@ -256,6 +260,7 @@ class ResourceScheduler::ScheduledResourceRequest
|
| net::URLRequest* request_;
|
| bool ready_;
|
| bool deferred_;
|
| + bool is_async_revalidation_;
|
| RequestClassification classification_;
|
| ResourceScheduler* scheduler_;
|
| RequestPriorityParams priority_;
|
| @@ -268,6 +273,10 @@ class ResourceScheduler::ScheduledResourceRequest
|
| bool ResourceScheduler::ScheduledResourceSorter::operator()(
|
| const ScheduledResourceRequest* a,
|
| const ScheduledResourceRequest* b) const {
|
| + // Want all other requests to be ordered before async revalidations.
|
| + if (a->is_async_revalidation() != b->is_async_revalidation())
|
| + return b->is_async_revalidation();
|
| +
|
| // Want the set to be ordered first by decreasing priority, then by
|
| // decreasing intra_priority.
|
| // ie. with (priority, intra_priority)
|
| @@ -689,6 +698,10 @@ class ResourceScheduler::Client {
|
| // UNTHROTTLED Client, and then return to the COALESCED state.
|
| // * When an active Client makes a request, they are THROTTLED until the
|
| // active Client finishes loading.
|
| + //
|
| + // 6. Async revalidations
|
| + // * Async revalidations come after all other requests, and are never loaded
|
| + // until the document has a body.
|
| ShouldStartReqResult ShouldStartRequest(
|
| ScheduledResourceRequest* request) const {
|
| const net::URLRequest& url_request = *request->url_request();
|
| @@ -706,6 +719,12 @@ class ResourceScheduler::Client {
|
| return START_REQUEST;
|
| }
|
|
|
| + if (request->is_async_revalidation() && !has_body_) {
|
| + // Because async revalidations are sorted last, all following requests
|
| + // will also be async revalidations.
|
| + return DO_NOT_START_REQUEST_AND_STOP_SEARCHING;
|
| + }
|
| +
|
| if (throttle_state_ == COALESCED) {
|
| return DO_NOT_START_REQUEST_AND_STOP_SEARCHING;
|
| }
|
|
|