Chromium Code Reviews| 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..6ed1f88afe7d1ebf2b302c6875efca863b762468 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,9 @@ namespace content { |
| namespace { |
| +const base::Feature kPrioritySupportedRequestsDelayable{ |
|
Charlie Harrison
2016/10/19 15:40:43
Can you add a comment about what this feature does
jkarlin
2016/10/19 15:53:48
Done.
|
| + "PrioritySupportedRequestsDelayable", base::FEATURE_ENABLED_BY_DEFAULT}; |
| + |
| enum StartMode { |
| START_SYNC, |
| START_ASYNC |
| @@ -513,14 +517,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)) { |
| + // 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)) |
| + attributes |= kAttributeDelayable; |
| + } |
| } |
| return attributes; |
| @@ -595,20 +605,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)) |