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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « content/child/resource_dispatcher.h ('k') | content/common/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/child/resource_dispatcher.h" 7 #include "content/child/resource_dispatcher.h"
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 main_thread_task_runner_->PostTask( 556 main_thread_task_runner_->PostTask(
557 FROM_HERE, base::Bind(&ResourceDispatcher::FlushDeferredMessages, 557 FROM_HERE, base::Bind(&ResourceDispatcher::FlushDeferredMessages,
558 weak_factory_.GetWeakPtr(), request_id)); 558 weak_factory_.GetWeakPtr(), request_id));
559 } 559 }
560 } 560 }
561 561
562 void ResourceDispatcher::DidChangePriority(int request_id, 562 void ResourceDispatcher::DidChangePriority(int request_id,
563 net::RequestPriority new_priority, 563 net::RequestPriority new_priority,
564 int intra_priority_value) { 564 int intra_priority_value) {
565 DCHECK(base::ContainsKey(pending_requests_, request_id)); 565 DCHECK(base::ContainsKey(pending_requests_, request_id));
566 message_sender_->Send(new ResourceHostMsg_DidChangePriority( 566
567 request_id, new_priority, intra_priority_value)); 567 if (queued_priority_requests.empty()) {
568 main_thread_task_runner_->PostTask(
569 FROM_HERE,
570 base::Bind(&ResourceDispatcher::DispatchPendingPriorityRequests,
571 weak_factory_.GetWeakPtr()));
572 }
573
574 queued_priority_requests.push_back(
575 ResourcePriorityChangeInfo(
576 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
577 }
578
579 void ResourceDispatcher::DispatchPendingPriorityRequests() {
580 std::vector<ResourcePriorityChangeInfo> tmp;
581 tmp.swap(queued_priority_requests);
582 message_sender_->Send(new ResourceHostMsg_DidChangePriority(tmp));
568 } 583 }
569 584
570 ResourceDispatcher::PendingRequestInfo::PendingRequestInfo( 585 ResourceDispatcher::PendingRequestInfo::PendingRequestInfo(
571 std::unique_ptr<RequestPeer> peer, 586 std::unique_ptr<RequestPeer> peer,
572 ResourceType resource_type, 587 ResourceType resource_type,
573 int origin_pid, 588 int origin_pid,
574 const GURL& frame_origin, 589 const GURL& frame_origin,
575 const GURL& request_url, 590 const GURL& request_url,
576 bool download_to_file) 591 bool download_to_file)
577 : peer(std::move(peer)), 592 : peer(std::move(peer)),
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 delete message; 867 delete message;
853 } 868 }
854 } 869 }
855 870
856 void ResourceDispatcher::SetResourceSchedulingFilter( 871 void ResourceDispatcher::SetResourceSchedulingFilter(
857 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { 872 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) {
858 resource_scheduling_filter_ = resource_scheduling_filter; 873 resource_scheduling_filter_ = resource_scheduling_filter;
859 } 874 }
860 875
861 } // namespace content 876 } // namespace content
OLDNEW
« 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