| Index: content/child/resource_dispatcher.cc
|
| diff --git a/content/child/resource_dispatcher.cc b/content/child/resource_dispatcher.cc
|
| index 38efe244a9a2e2f1ed58b6aa3dddfe07d929186b..ffdb4a6b07d56dd7f5c825606a7c587385ffcad1 100644
|
| --- a/content/child/resource_dispatcher.cc
|
| +++ b/content/child/resource_dispatcher.cc
|
| @@ -87,6 +87,27 @@ void CheckSchemeForReferrerPolicy(const ResourceRequest& request) {
|
| }
|
| }
|
|
|
| +mojom::RequestPriority MojoRequestPriorityForNetRequestPriority(
|
| + net::RequestPriority priority) {
|
| + switch (priority) {
|
| + case net::THROTTLED:
|
| + return mojom::RequestPriority::kThrottled;
|
| + case net::IDLE:
|
| + return mojom::RequestPriority::kIdle;
|
| + case net::LOWEST:
|
| + return mojom::RequestPriority::kLowest;
|
| + case net::LOW:
|
| + return mojom::RequestPriority::kLow;
|
| + case net::MEDIUM:
|
| + return mojom::RequestPriority::kMedium;
|
| + case net::HIGHEST:
|
| + return mojom::RequestPriority::kHighest;
|
| + }
|
| +
|
| + NOTREACHED();
|
| + return static_cast<mojom::RequestPriority>(priority);
|
| +}
|
| +
|
| } // namespace
|
|
|
| ResourceDispatcher::ResourceDispatcher(
|
| @@ -504,9 +525,16 @@ void ResourceDispatcher::SetDefersLoading(int request_id, bool value) {
|
| void ResourceDispatcher::DidChangePriority(int request_id,
|
| net::RequestPriority new_priority,
|
| int intra_priority_value) {
|
| - DCHECK(base::ContainsKey(pending_requests_, request_id));
|
| - message_sender_->Send(new ResourceHostMsg_DidChangePriority(
|
| - request_id, new_priority, intra_priority_value));
|
| + PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
|
| + DCHECK(request_info);
|
| + if (request_info->url_loader) {
|
| + request_info->url_loader->SetPriority(
|
| + MojoRequestPriorityForNetRequestPriority(new_priority),
|
| + intra_priority_value);
|
| + } else {
|
| + message_sender_->Send(new ResourceHostMsg_DidChangePriority(
|
| + request_id, new_priority, intra_priority_value));
|
| + }
|
| }
|
|
|
| void ResourceDispatcher::OnTransferSizeUpdated(int request_id,
|
|
|