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

Unified Diff: content/browser/loader/resource_scheduler.cc

Issue 2435743002: [ResourceScheduler] Throttle H2/QUIC requests just like we do for 1.1 (Closed)
Patch Set: Add comment Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/loader/resource_scheduler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/resource_scheduler.cc
diff --git a/content/browser/loader/resource_scheduler.cc b/content/browser/loader/resource_scheduler.cc
index 2253b57d4a9a33ceeffee9f8657cd8cdfb100030..f1604d440531544ce4be9860c77d9d5ed45a80af 100644
--- a/content/browser/loader/resource_scheduler.cc
+++ b/content/browser/loader/resource_scheduler.cc
@@ -10,6 +10,7 @@
#include <utility>
#include <vector>
+#include "base/feature_list.h"
#include "base/macros.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram_macros.h"
@@ -31,6 +32,13 @@ namespace content {
namespace {
+// When kPrioritySupportedRequestsDelayable is enabled, requests for
+// H2/QUIC/SPDY resources can be delayed by the ResourceScheduler just as
+// HTTP/1.1 resources are. Disabling this appears to have negative performance
+// impact, see https://crbug.com/655585.
+const base::Feature kPrioritySupportedRequestsDelayable{
+ "PrioritySupportedRequestsDelayable", base::FEATURE_ENABLED_BY_DEFAULT};
+
enum StartMode {
START_SYNC,
START_ASYNC
@@ -513,14 +521,20 @@ class ResourceScheduler::Client {
attributes |= kAttributeLayoutBlocking;
} else if (request->url_request()->priority() <
kDelayablePriorityThreshold) {
- // Resources below the delayable priority threshold that are being
- // requested from a server that does not support native prioritization are
- // considered delayable.
- url::SchemeHostPort scheme_host_port(request->url_request()->url());
- net::HttpServerProperties& http_server_properties =
- *request->url_request()->context()->http_server_properties();
- if (!http_server_properties.SupportsRequestPriority(scheme_host_port))
+ if (base::FeatureList::IsEnabled(kPrioritySupportedRequestsDelayable)) {
Randy Smith (Not in Mondays) 2016/10/19 16:41:43 I note that this lookup seems O(log n) (map) in th
jkarlin 2016/10/19 17:01:41 Done.
+ // Resources below the delayable priority threshold that are considered
+ // delayable.
attributes |= kAttributeDelayable;
+ } else {
+ // Resources below the delayable priority threshold that are being
+ // requested from a server that does not support native prioritization
+ // are considered delayable.
+ url::SchemeHostPort scheme_host_port(request->url_request()->url());
+ net::HttpServerProperties& http_server_properties =
+ *request->url_request()->context()->http_server_properties();
+ if (!http_server_properties.SupportsRequestPriority(scheme_host_port))
Randy Smith (Not in Mondays) 2016/10/19 16:41:43 I'll call out that another option (which probably
jkarlin 2016/10/19 17:01:41 Acknowledged.
+ attributes |= kAttributeDelayable;
+ }
}
return attributes;
@@ -595,20 +609,24 @@ class ResourceScheduler::Client {
if (!url_request.url().SchemeIsHTTPOrHTTPS())
return START_REQUEST;
- if (using_spdy_proxy_ && url_request.url().SchemeIs(url::kHttpScheme))
- return START_REQUEST;
-
net::HostPortPair host_port_pair =
net::HostPortPair::FromURL(url_request.url());
- url::SchemeHostPort scheme_host_port(url_request.url());
- net::HttpServerProperties& http_server_properties =
- *url_request.context()->http_server_properties();
-
- // TODO(willchan): We should really improve this algorithm as described in
- // crbug.com/164101. Also, theoretically we should not count a
- // request-priority capable request against the delayable requests limit.
- if (http_server_properties.SupportsRequestPriority(scheme_host_port))
- return START_REQUEST;
+
+ if (!base::FeatureList::IsEnabled(kPrioritySupportedRequestsDelayable)) {
+ if (using_spdy_proxy_ && url_request.url().SchemeIs(url::kHttpScheme))
+ return START_REQUEST;
+
+ url::SchemeHostPort scheme_host_port(url_request.url());
+
+ net::HttpServerProperties& http_server_properties =
+ *url_request.context()->http_server_properties();
+
+ // TODO(willchan): We should really improve this algorithm as described in
+ // crbug.com/164101. Also, theoretically we should not count a
+ // request-priority capable request against the delayable requests limit.
+ if (http_server_properties.SupportsRequestPriority(scheme_host_port))
+ return START_REQUEST;
+ }
// Non-delayable requests.
if (!RequestAttributesAreSet(request->attributes(), kAttributeDelayable))
« 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