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

Side by Side Diff: content/browser/loader/resource_scheduler.cc

Issue 1824903002: Change the AlternativeServiceMap with SchemeOriginPair key. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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 | « no previous file | content/browser/loader/resource_scheduler_unittest.cc » ('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 #include "content/browser/loader/resource_scheduler.h" 5 #include "content/browser/loader/resource_scheduler.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 request->url_request()->priority() > 497 request->url_request()->priority() >
498 scheduler_->non_delayable_threshold()) { 498 scheduler_->non_delayable_threshold()) {
499 // Requests that are above the non_delayable threshold before the HTML 499 // Requests that are above the non_delayable threshold before the HTML
500 // body has been parsed are inferred to be layout-blocking. 500 // body has been parsed are inferred to be layout-blocking.
501 attributes |= kAttributeLayoutBlocking; 501 attributes |= kAttributeLayoutBlocking;
502 } else if (request->url_request()->priority() < 502 } else if (request->url_request()->priority() <
503 scheduler_->non_delayable_threshold()) { 503 scheduler_->non_delayable_threshold()) {
504 // Resources below the non_delayable_threshold that are being requested 504 // Resources below the non_delayable_threshold that are being requested
505 // from a server that does not support native prioritization are 505 // from a server that does not support native prioritization are
506 // considered delayable. 506 // considered delayable.
507 net::HostPortPair host_port_pair = 507 url::SchemeHostPort scheme_host_port =
508 net::HostPortPair::FromURL(request->url_request()->url()); 508 url::SchemeHostPort(request->url_request()->url());
509 net::HttpServerProperties& http_server_properties = 509 net::HttpServerProperties& http_server_properties =
510 *request->url_request()->context()->http_server_properties(); 510 *request->url_request()->context()->http_server_properties();
511 if (!http_server_properties.SupportsRequestPriority(host_port_pair)) 511 if (!http_server_properties.SupportsRequestPriority(scheme_host_port))
512 attributes |= kAttributeDelayable; 512 attributes |= kAttributeDelayable;
513 } 513 }
514 514
515 return attributes; 515 return attributes;
516 } 516 }
517 517
518 bool ShouldKeepSearching( 518 bool ShouldKeepSearching(
519 const net::HostPortPair& active_request_host) const { 519 const net::HostPortPair& active_request_host) const {
520 size_t same_host_count = 0; 520 size_t same_host_count = 0;
521 for (RequestSet::const_iterator it = in_flight_requests_.begin(); 521 for (RequestSet::const_iterator it = in_flight_requests_.begin();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 return START_REQUEST; 590 return START_REQUEST;
591 591
592 // Implementation of the kRequestLimitFieldTrial. 592 // Implementation of the kRequestLimitFieldTrial.
593 if (scheduler_->limit_outstanding_requests() && 593 if (scheduler_->limit_outstanding_requests() &&
594 in_flight_requests_.size() >= scheduler_->outstanding_request_limit()) { 594 in_flight_requests_.size() >= scheduler_->outstanding_request_limit()) {
595 return DO_NOT_START_REQUEST_AND_STOP_SEARCHING; 595 return DO_NOT_START_REQUEST_AND_STOP_SEARCHING;
596 } 596 }
597 597
598 net::HostPortPair host_port_pair = 598 net::HostPortPair host_port_pair =
599 net::HostPortPair::FromURL(url_request.url()); 599 net::HostPortPair::FromURL(url_request.url());
600 url::SchemeHostPort scheme_host_port =
601 url::SchemeHostPort(url_request.url());
600 net::HttpServerProperties& http_server_properties = 602 net::HttpServerProperties& http_server_properties =
601 *url_request.context()->http_server_properties(); 603 *url_request.context()->http_server_properties();
602 604
603 // TODO(willchan): We should really improve this algorithm as described in 605 // TODO(willchan): We should really improve this algorithm as described in
604 // crbug.com/164101. Also, theoretically we should not count a 606 // crbug.com/164101. Also, theoretically we should not count a
605 // request-priority capable request against the delayable requests limit. 607 // request-priority capable request against the delayable requests limit.
606 if (http_server_properties.SupportsRequestPriority(host_port_pair)) 608 if (http_server_properties.SupportsRequestPriority(scheme_host_port))
607 return START_REQUEST; 609 return START_REQUEST;
608 610
609 // Non-delayable requests. 611 // Non-delayable requests.
610 if (!RequestAttributesAreSet(request->attributes(), kAttributeDelayable)) 612 if (!RequestAttributesAreSet(request->attributes(), kAttributeDelayable))
611 return START_REQUEST; 613 return START_REQUEST;
612 614
613 if (in_flight_delayable_count_ >= 615 if (in_flight_delayable_count_ >=
614 scheduler_->max_num_delayable_requests()) { 616 scheduler_->max_num_delayable_requests()) {
615 return DO_NOT_START_REQUEST_AND_STOP_SEARCHING; 617 return DO_NOT_START_REQUEST_AND_STOP_SEARCHING;
616 } 618 }
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 client->ReprioritizeRequest(scheduled_resource_request, old_priority_params, 959 client->ReprioritizeRequest(scheduled_resource_request, old_priority_params,
958 new_priority_params); 960 new_priority_params);
959 } 961 }
960 962
961 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( 963 ResourceScheduler::ClientId ResourceScheduler::MakeClientId(
962 int child_id, int route_id) { 964 int child_id, int route_id) {
963 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; 965 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id;
964 } 966 }
965 967
966 } // namespace content 968 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/loader/resource_scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698