Commit 178faf76 authored by Robert Ogden's avatar Robert Ogden Committed by Commit Bot

Allow LPR ECT Threshold to be configurable by field trial

Keeps the 2G default.

Bug: 1010979
Change-Id: I00cff02cfaab075017905a3f64372e36ba97fdfb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1837529
Commit-Queue: Robert Ogden <robertogden@chromium.org>
Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702538}
parent e74d3916
......@@ -74,18 +74,17 @@ bool PreviewsLitePageRedirectPredictor::ECTIsSlow() const {
if (!g_browser_process->network_quality_tracker())
return false;
switch (g_browser_process->network_quality_tracker()
->GetEffectiveConnectionType()) {
case net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G:
case net::EFFECTIVE_CONNECTION_TYPE_2G:
return true;
case net::EFFECTIVE_CONNECTION_TYPE_3G:
case net::EFFECTIVE_CONNECTION_TYPE_4G:
case net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN:
case net::EFFECTIVE_CONNECTION_TYPE_OFFLINE:
case net::EFFECTIVE_CONNECTION_TYPE_LAST:
net::EffectiveConnectionType ect =
g_browser_process->network_quality_tracker()
->GetEffectiveConnectionType();
if (ect == net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN ||
ect == net::EFFECTIVE_CONNECTION_TYPE_OFFLINE) {
return false;
}
return ect <= previews::params::
LitePageRedirectPreviewPreresolvePreconnectECTThreshold();
}
bool PreviewsLitePageRedirectPredictor::PageIsBlacklisted(
......
......@@ -249,6 +249,13 @@ base::TimeDelta LitePageRedirectPreviewPreresolvePreconnectInterval() {
"preresolveconnect_interval_in_seconds", 60));
}
net::EffectiveConnectionType
LitePageRedirectPreviewPreresolvePreconnectECTThreshold() {
return GetParamValueAsECTByFeature(features::kLitePageServerPreviews,
"preresolveconnect_ect_threshold",
net::EFFECTIVE_CONNECTION_TYPE_2G);
}
base::TimeDelta LitePageRedirectPreviewProbeInterval() {
return base::TimeDelta::FromSeconds(base::GetFieldTrialParamByFeatureAsInt(
features::kLitePageServerPreviews, "probe_interval_in_seconds", 30));
......
......@@ -149,6 +149,11 @@ GURL LitePageRedirectProbeURL();
// server or the origin.
base::TimeDelta LitePageRedirectPreviewPreresolvePreconnectInterval();
// The ect threshold at which, or below, we should preresolve or preconnect for
// lite page redirect previews.
net::EffectiveConnectionType
LitePageRedirectPreviewPreresolvePreconnectECTThreshold();
// The duration in between probes to the lite page redirect server.
base::TimeDelta LitePageRedirectPreviewProbeInterval();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment