Commit 5598cb0f authored by Michael Crouse's avatar Michael Crouse Committed by Commit Bot

Create finch param to control the top host engagement score threshold.

This change makes the engagement score threshold used by the top host
provider configurable in order to increase the number of hosts and
navigations covered by the HintsFetcher by added a finch parameter.

Bug: 999541
Change-Id: I5d5302f8449524158c09420b12b591e071dfb556
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1783230Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Reviewed-by: default avatarDoug Arnett <dougarnett@chromium.org>
Commit-Queue: Michael Crouse <mcrouse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693219}
parent b8d25ebd
...@@ -271,7 +271,8 @@ std::vector<std::string> DataSaverTopHostProvider::GetTopHosts( ...@@ -271,7 +271,8 @@ std::vector<std::string> DataSaverTopHostProvider::GetTopHosts(
// prevents hosts that have not been engaged recently from having hints // prevents hosts that have not been engaged recently from having hints
// requested for them. The engagement_details are sorted above in descending // requested for them. The engagement_details are sorted above in descending
// order by engagement score. // order by engagement score.
if (detail.total_score <= GetMinTopHostEngagementThreshold()) if (detail.total_score <
optimization_guide::features::MinTopHostEngagementScoreThreshold())
return top_hosts; return top_hosts;
// TODO(b/968542): Skip origins that are local hosts (e.g., IP addresses, // TODO(b/968542): Skip origins that are local hosts (e.g., IP addresses,
// localhost:8080 etc.). // localhost:8080 etc.).
...@@ -283,12 +284,3 @@ std::vector<std::string> DataSaverTopHostProvider::GetTopHosts( ...@@ -283,12 +284,3 @@ std::vector<std::string> DataSaverTopHostProvider::GetTopHosts(
return top_hosts; return top_hosts;
} }
size_t DataSaverTopHostProvider::GetMinTopHostEngagementThreshold() const {
// The base score for the first navigation of a host when added to the site
// engagement service. The threshold corresponds to the minimum score that a
// host is considered to be a top host, hosts with a lower score have not
// been navigated to recently.
return SiteEngagementScore::GetNavigationPoints() +
SiteEngagementScore::GetFirstDailyEngagementPoints();
}
...@@ -60,10 +60,6 @@ class DataSaverTopHostProvider : public optimization_guide::TopHostProvider { ...@@ -60,10 +60,6 @@ class DataSaverTopHostProvider : public optimization_guide::TopHostProvider {
optimization_guide::prefs::HintsFetcherTopHostBlacklistState optimization_guide::prefs::HintsFetcherTopHostBlacklistState
GetCurrentBlacklistState() const; GetCurrentBlacklistState() const;
// The minimum engagement score that a host must have to be considered a top
// host by |this|.
size_t GetMinTopHostEngagementThreshold() const;
// Transition the current HintsFetcherTopHostBlacklist state to |state| and // Transition the current HintsFetcherTopHostBlacklist state to |state| and
// validate the transition. The updated state is persisted in the // validate the transition. The updated state is persisted in the
// |kHintsFetcherTopHostBlacklistState| pref. // |kHintsFetcherTopHostBlacklistState| pref.
......
...@@ -74,6 +74,15 @@ size_t MaxHostsForRecordingSuccessfullyCovered() { ...@@ -74,6 +74,15 @@ size_t MaxHostsForRecordingSuccessfullyCovered() {
"max_hosts_for_recording_successfully_covered", 200); "max_hosts_for_recording_successfully_covered", 200);
} }
double MinTopHostEngagementScoreThreshold() {
// The default initial site engagement score for a navigation is 3.0, 1.5
// points for a navigation from the omnibox and 1.5 points for the first
// navigation of the day.
return GetFieldTrialParamByFeatureAsDouble(
features::kOptimizationHintsFetching,
"min_top_host_engagement_score_threshold", 3.0);
}
base::TimeDelta StoredFetchedHintsFreshnessDuration() { base::TimeDelta StoredFetchedHintsFreshnessDuration() {
return base::TimeDelta::FromDays(GetFieldTrialParamByFeatureAsInt( return base::TimeDelta::FromDays(GetFieldTrialParamByFeatureAsInt(
features::kOptimizationHintsFetching, features::kOptimizationHintsFetching,
......
...@@ -37,6 +37,10 @@ size_t MaxHostsForOptimizationGuideServiceHintsFetch(); ...@@ -37,6 +37,10 @@ size_t MaxHostsForOptimizationGuideServiceHintsFetch();
// fetcher. // fetcher.
size_t MaxHostsForRecordingSuccessfullyCovered(); size_t MaxHostsForRecordingSuccessfullyCovered();
// The minimum score required to be considered a top host and be included in a
// hints fetch request.
double MinTopHostEngagementScoreThreshold();
// The amount of time a fetched hint will be considered fresh enough // The amount of time a fetched hint will be considered fresh enough
// to be used and remain in the HintCacheStore. // to be used and remain in the HintCacheStore.
base::TimeDelta StoredFetchedHintsFreshnessDuration(); base::TimeDelta StoredFetchedHintsFreshnessDuration();
......
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