Chromium Code Reviews| Index: content/child/resource_dispatcher.cc |
| diff --git a/content/child/resource_dispatcher.cc b/content/child/resource_dispatcher.cc |
| index f8f9126c4a63ae5fcdb4dfa4bd48e858a5dc4b34..0aa56022a59127471f8efe9cc9051cc5c90789ab 100644 |
| --- a/content/child/resource_dispatcher.cc |
| +++ b/content/child/resource_dispatcher.cc |
| @@ -563,8 +563,23 @@ 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)); |
| + |
| + if (queued_priority_requests.empty()) { |
| + main_thread_task_runner_->PostTask( |
| + FROM_HERE, |
| + base::Bind(&ResourceDispatcher::DispatchPendingPriorityRequests, |
| + weak_factory_.GetWeakPtr())); |
| + } |
| + |
| + queued_priority_requests.push_back( |
| + ResourcePriorityChangeInfo( |
| + request_id, new_priority, intra_priority_value)); |
|
kinuko
2016/12/06 00:34:33
This change itself makes sense, while I'm hoping n
Charlie Harrison
2016/12/06 01:21:27
We may need to do some lab tests to see how bad th
|
| +} |
| + |
| +void ResourceDispatcher::DispatchPendingPriorityRequests() { |
| + std::vector<ResourcePriorityChangeInfo> tmp; |
| + tmp.swap(queued_priority_requests); |
| + message_sender_->Send(new ResourceHostMsg_DidChangePriority(tmp)); |
| } |
| ResourceDispatcher::PendingRequestInfo::PendingRequestInfo( |