mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 986728 - Engage frecency decay time experiment for HTTP cache v2, r=jduell
This commit is contained in:
parent
f5a29a69e0
commit
ccb03c457d
@ -1415,6 +1415,10 @@ pref("ui.key.menuAccessKeyFocuses", true);
|
||||
|
||||
// Delete HTTP cache v2 data of users that didn't opt-in manually
|
||||
pref("browser.cache.auto_delete_cache_version", 1);
|
||||
// Play with different values of the decay time and get telemetry,
|
||||
// 0 means to randomize (and persist) the experiment value in users' profiles,
|
||||
// -1 means no experiment is run and we use the preferred value for frecency (6h)
|
||||
pref("browser.cache.frecency_experiment", 0);
|
||||
|
||||
// Telemetry experiments settings.
|
||||
pref("experiments.enabled", false);
|
||||
|
@ -134,15 +134,26 @@ CacheObserver::AttachToPreferences()
|
||||
"browser.cache.disk.parent_directory", NS_GET_IID(nsIFile),
|
||||
getter_AddRefs(mCacheParentDirectoryOverride));
|
||||
|
||||
sHalfLifeExperiment = mozilla::Preferences::GetInt(
|
||||
// First check the default value. If it is at -1, the experient
|
||||
// is turned off. If it is at 0, then use the user pref value
|
||||
// instead.
|
||||
sHalfLifeExperiment = mozilla::Preferences::GetDefaultInt(
|
||||
"browser.cache.frecency_experiment", kDefaultHalfLifeExperiment);
|
||||
|
||||
if (sHalfLifeExperiment == 0) {
|
||||
// The experiment has not yet been initialized, do it now
|
||||
// Store the experiemnt value, since we need it not to change between
|
||||
// browser sessions.
|
||||
// Default preferences indicate we want to run the experiment,
|
||||
// hence read the user value.
|
||||
sHalfLifeExperiment = mozilla::Preferences::GetInt(
|
||||
"browser.cache.frecency_experiment", sHalfLifeExperiment);
|
||||
}
|
||||
|
||||
if (sHalfLifeExperiment == 0) {
|
||||
// The experiment has not yet been initialized but is engaged, do
|
||||
// the initialization now.
|
||||
srand(time(NULL));
|
||||
sHalfLifeExperiment = (rand() % 4) + 1;
|
||||
// Store the experiemnt value, since we need it not to change between
|
||||
// browser sessions.
|
||||
mozilla::Preferences::SetInt(
|
||||
"browser.cache.frecency_experiment", sHalfLifeExperiment);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user