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

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

Issue 1904483004: Change SupportsSpdy dict, SpdySettingsMap, ServerNetworkStatsMap, AlternativeServiceMap and disk da… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile after sync code, introduced by commit 388755 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
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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/metrics/field_trial.h" 14 #include "base/metrics/field_trial.h"
15 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
16 #include "base/stl_util.h" 16 #include "base/stl_util.h"
17 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/string_piece.h" 18 #include "base/strings/string_piece.h"
19 #include "base/supports_user_data.h" 19 #include "base/supports_user_data.h"
20 #include "content/common/resource_messages.h" 20 #include "content/common/resource_messages.h"
21 #include "content/public/browser/resource_controller.h" 21 #include "content/public/browser/resource_controller.h"
22 #include "content/public/browser/resource_request_info.h" 22 #include "content/public/browser/resource_request_info.h"
23 #include "content/public/browser/resource_throttle.h" 23 #include "content/public/browser/resource_throttle.h"
24 #include "net/base/host_port_pair.h" 24 #include "net/base/host_port_pair.h"
25 #include "net/base/load_flags.h" 25 #include "net/base/load_flags.h"
26 #include "net/base/request_priority.h" 26 #include "net/base/request_priority.h"
27 #include "net/http/http_server_properties.h" 27 #include "net/http/http_server_properties.h"
28 #include "net/url_request/url_request.h" 28 #include "net/url_request/url_request.h"
29 #include "net/url_request/url_request_context.h" 29 #include "net/url_request/url_request_context.h"
30 #include "url/scheme_host_port.h"
30 31
31 namespace content { 32 namespace content {
32 33
33 namespace { 34 namespace {
34 35
35 enum StartMode { 36 enum StartMode {
36 START_SYNC, 37 START_SYNC,
37 START_ASYNC 38 START_ASYNC
38 }; 39 };
39 40
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 request->url_request()->priority() > 498 request->url_request()->priority() >
498 scheduler_->non_delayable_threshold()) { 499 scheduler_->non_delayable_threshold()) {
499 // Requests that are above the non_delayable threshold before the HTML 500 // Requests that are above the non_delayable threshold before the HTML
500 // body has been parsed are inferred to be layout-blocking. 501 // body has been parsed are inferred to be layout-blocking.
501 attributes |= kAttributeLayoutBlocking; 502 attributes |= kAttributeLayoutBlocking;
502 } else if (request->url_request()->priority() < 503 } else if (request->url_request()->priority() <
503 scheduler_->non_delayable_threshold()) { 504 scheduler_->non_delayable_threshold()) {
504 // Resources below the non_delayable_threshold that are being requested 505 // Resources below the non_delayable_threshold that are being requested
505 // from a server that does not support native prioritization are 506 // from a server that does not support native prioritization are
506 // considered delayable. 507 // considered delayable.
507 net::HostPortPair host_port_pair = 508 url::SchemeHostPort scheme_host_port(request->url_request()->url());
508 net::HostPortPair::FromURL(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(url_request.url());
600 net::HttpServerProperties& http_server_properties = 601 net::HttpServerProperties& http_server_properties =
601 *url_request.context()->http_server_properties(); 602 *url_request.context()->http_server_properties();
602 603
603 // TODO(willchan): We should really improve this algorithm as described in 604 // TODO(willchan): We should really improve this algorithm as described in
604 // crbug.com/164101. Also, theoretically we should not count a 605 // crbug.com/164101. Also, theoretically we should not count a
605 // request-priority capable request against the delayable requests limit. 606 // request-priority capable request against the delayable requests limit.
606 if (http_server_properties.SupportsRequestPriority(host_port_pair)) 607 if (http_server_properties.SupportsRequestPriority(scheme_host_port))
607 return START_REQUEST; 608 return START_REQUEST;
608 609
609 // Non-delayable requests. 610 // Non-delayable requests.
610 if (!RequestAttributesAreSet(request->attributes(), kAttributeDelayable)) 611 if (!RequestAttributesAreSet(request->attributes(), kAttributeDelayable))
611 return START_REQUEST; 612 return START_REQUEST;
612 613
613 if (in_flight_delayable_count_ >= 614 if (in_flight_delayable_count_ >=
614 scheduler_->max_num_delayable_requests()) { 615 scheduler_->max_num_delayable_requests()) {
615 return DO_NOT_START_REQUEST_AND_STOP_SEARCHING; 616 return DO_NOT_START_REQUEST_AND_STOP_SEARCHING;
616 } 617 }
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 client->ReprioritizeRequest(scheduled_resource_request, old_priority_params, 959 client->ReprioritizeRequest(scheduled_resource_request, old_priority_params,
959 new_priority_params); 960 new_priority_params);
960 } 961 }
961 962
962 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( 963 ResourceScheduler::ClientId ResourceScheduler::MakeClientId(
963 int child_id, int route_id) { 964 int child_id, int route_id) {
964 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; 965 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id;
965 } 966 }
966 967
967 } // namespace content 968 } // namespace content
OLDNEW
« no previous file with comments | « components/cronet/ios/cronet_environment.cc ('k') | content/browser/loader/resource_scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698