#include "content/common/user_level_memory_pressure_signal_features.h"
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "base/system/sys_info.h"
#include "base/time/time.h"
#include "build/build_config.h"
#if BUILDFLAG(IS_ANDROID)
namespace content::features {
namespace {
constexpr base::TimeDelta kDefaultMinimumInterval = base::Minutes(10);
constexpr base::TimeDelta kDefaultInertInterval = base::Minutes(5);
}
BASE_FEATURE(kUserLevelMemoryPressureSignalOn3GbDevices,
"UserLevelMemoryPressureSignalOn3GbDevices",
base::FEATURE_DISABLED_BY_DEFAULT);
BASE_FEATURE(kUserLevelMemoryPressureSignalOn4GbDevices,
"UserLevelMemoryPressureSignalOn4GbDevices",
base::FEATURE_ENABLED_BY_DEFAULT);
BASE_FEATURE(kUserLevelMemoryPressureSignalOn6GbDevices,
"UserLevelMemoryPressureSignalOn6GbDevices",
base::FEATURE_ENABLED_BY_DEFAULT);
bool IsUserLevelMemoryPressureSignalEnabledOn3GbDevices() {
static bool s_enabled =
base::SysInfo::Is3GbDevice() &&
base::FeatureList::IsEnabled(kUserLevelMemoryPressureSignalOn3GbDevices);
return s_enabled;
}
bool IsUserLevelMemoryPressureSignalEnabledOn4GbDevices() {
static bool s_enabled =
base::SysInfo::Is4GbDevice() &&
base::FeatureList::IsEnabled(kUserLevelMemoryPressureSignalOn4GbDevices);
return s_enabled;
}
bool IsUserLevelMemoryPressureSignalEnabledOn6GbDevices() {
static bool s_enabled =
base::SysInfo::Is6GbDevice() &&
base::FeatureList::IsEnabled(kUserLevelMemoryPressureSignalOn6GbDevices);
return s_enabled;
}
base::TimeDelta MinUserMemoryPressureIntervalOn3GbDevices() {
static const base::FeatureParam<base::TimeDelta> kMinimumInterval{
&kUserLevelMemoryPressureSignalOn3GbDevices, "minimum_interval",
kDefaultMinimumInterval};
return kMinimumInterval.Get();
}
base::TimeDelta MinUserMemoryPressureIntervalOn4GbDevices() {
static const base::FeatureParam<base::TimeDelta> kMinimumInterval{
&kUserLevelMemoryPressureSignalOn4GbDevices, "minimum_interval",
kDefaultMinimumInterval};
return kMinimumInterval.Get();
}
base::TimeDelta MinUserMemoryPressureIntervalOn6GbDevices() {
static const base::FeatureParam<base::TimeDelta> kMinimumInterval{
&kUserLevelMemoryPressureSignalOn6GbDevices, "minimum_interval",
kDefaultMinimumInterval};
return kMinimumInterval.Get();
}
base::TimeDelta InertIntervalFor3GbDevices() {
static const base::FeatureParam<base::TimeDelta> kInertInterval{
&features::kUserLevelMemoryPressureSignalOn3GbDevices,
"inert_interval_after_loading", kDefaultInertInterval};
return kInertInterval.Get();
}
base::TimeDelta InertIntervalFor4GbDevices() {
static const base::FeatureParam<base::TimeDelta> kInertInterval{
&features::kUserLevelMemoryPressureSignalOn4GbDevices,
"inert_interval_after_loading", kDefaultInertInterval};
return kInertInterval.Get();
}
base::TimeDelta InertIntervalFor6GbDevices() {
static const base::FeatureParam<base::TimeDelta> kInertInterval{
&features::kUserLevelMemoryPressureSignalOn6GbDevices,
"inert_interval_after_loading", kDefaultInertInterval};
return kInertInterval.Get();
}
}
#endif