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

Unified Diff: content/child/resource_dispatcher.cc

Issue 2552703003: Make reprioritization IPC batch rather than per-request.
Patch Set: Fix some typos. Created 4 years 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 | « content/child/resource_dispatcher.h ('k') | content/common/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « content/child/resource_dispatcher.h ('k') | content/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698