#ifndef BASE_ALLOCATOR_MIRACLE_PARAMETER_H_
#define BASE_ALLOCATOR_MIRACLE_PARAMETER_H_
#include "base/base_export.h"
#include "base/containers/span.h"
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
namespace base {
namespace miracle_parameter {
namespace {
template <typename Enum>
Enum GetFieldTrialParamByFeatureAsEnum(
const base::Feature& feature,
const std::string& param_name,
const Enum default_value,
const base::span<const typename base::FeatureParam<Enum>::Option>&
options) { … }
}
constexpr int kMiracleParameterMemory512MB = …;
constexpr int kMiracleParameterMemory1GB = …;
constexpr int kMiracleParameterMemory2GB = …;
constexpr int kMiracleParameterMemory4GB = …;
constexpr int kMiracleParameterMemory8GB = …;
constexpr int kMiracleParameterMemory16GB = …;
BASE_EXPORT
std::string GetParamNameWithSuffix(const std::string& param_name);
BASE_EXPORT
std::string GetMiracleParameterAsString(const base::Feature& feature,
const std::string& param_name,
const std::string& default_value);
BASE_EXPORT
double GetMiracleParameterAsDouble(const base::Feature& feature,
const std::string& param_name,
double default_value);
BASE_EXPORT
int GetMiracleParameterAsInt(const base::Feature& feature,
const std::string& param_name,
int default_value);
BASE_EXPORT
bool GetMiracleParameterAsBool(const base::Feature& feature,
const std::string& param_name,
bool default_value);
BASE_EXPORT
base::TimeDelta GetMiracleParameterAsTimeDelta(const base::Feature& feature,
const std::string& param_name,
base::TimeDelta default_value);
template <typename Enum>
Enum GetMiracleParameterAsEnum(
const base::Feature& feature,
const std::string& param_name,
const Enum default_value,
const base::span<const typename base::FeatureParam<Enum>::Option> options) { … }
#define MIRACLE_PARAMETER_FOR_STRING(function_name, feature, param_name, \
default_value) …
#define MIRACLE_PARAMETER_FOR_DOUBLE(function_name, feature, param_name, \
default_value) …
#define MIRACLE_PARAMETER_FOR_INT(function_name, feature, param_name, \
default_value) …
#define MIRACLE_PARAMETER_FOR_BOOL(function_name, feature, param_name, \
default_value) …
#define MIRACLE_PARAMETER_FOR_TIME_DELTA(function_name, feature, param_name, \
default_value) …
#define MIRACLE_PARAMETER_FOR_ENUM(function_name, feature, param_name, \
default_value, type, options) …
}
}
#endif