Update features.cc
This commit is contained in:
parent
9ce472a6d2
commit
a8c9cdf7d9
1 changed files with 56 additions and 4 deletions
60
third_party/blink/common/features.cc
vendored
60
third_party/blink/common/features.cc
vendored
|
@ -1213,7 +1213,7 @@ const base::Feature kClientHintsViewportWidth_DEPRECATED{
|
||||||
// If enabled, the setTimeout(..., 0) will not clamp to 1ms.
|
// If enabled, the setTimeout(..., 0) will not clamp to 1ms.
|
||||||
// Tracking bug: https://crbug.com/402694.
|
// Tracking bug: https://crbug.com/402694.
|
||||||
const base::Feature kSetTimeoutWithoutClamp{"SetTimeoutWithoutClamp",
|
const base::Feature kSetTimeoutWithoutClamp{"SetTimeoutWithoutClamp",
|
||||||
base::FEATURE_DISABLED_BY_DEFAULT};
|
base::FEATURE_ENABLED_BY_DEFAULT};
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -1252,6 +1252,41 @@ GetSetTimeoutWithout1MsClampPolicyOverride() {
|
||||||
return policy;
|
return policy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum class UnthrottledNestedTimeoutPolicyOverride {
|
||||||
|
kNoOverride,
|
||||||
|
kForceDisable,
|
||||||
|
kForceEnable
|
||||||
|
};
|
||||||
|
|
||||||
|
bool g_unthrottled_nested_timeout_policy_override_cached = false;
|
||||||
|
|
||||||
|
// Returns the UnthrottledNestedTimeout policy settings. This is calculated
|
||||||
|
// once on first access and cached.
|
||||||
|
UnthrottledNestedTimeoutPolicyOverride
|
||||||
|
GetUnthrottledNestedTimeoutPolicyOverride() {
|
||||||
|
static UnthrottledNestedTimeoutPolicyOverride policy =
|
||||||
|
UnthrottledNestedTimeoutPolicyOverride::kNoOverride;
|
||||||
|
if (g_unthrottled_nested_timeout_policy_override_cached)
|
||||||
|
return policy;
|
||||||
|
|
||||||
|
// Otherwise, check the command-line for the renderer. Only values of "0"
|
||||||
|
// and "1" are valid, anything else is ignored (and allows the base::Feature
|
||||||
|
// to control the feature). This slow path will only be hit once per renderer
|
||||||
|
// process.
|
||||||
|
std::string value =
|
||||||
|
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
|
||||||
|
switches::kUnthrottledNestedTimeoutPolicy);
|
||||||
|
if (value == switches::kUnthrottledNestedTimeoutPolicy_ForceEnable) {
|
||||||
|
policy = UnthrottledNestedTimeoutPolicyOverride::kForceEnable;
|
||||||
|
} else if (value == switches::kUnthrottledNestedTimeoutPolicy_ForceDisable) {
|
||||||
|
policy = UnthrottledNestedTimeoutPolicyOverride::kForceDisable;
|
||||||
|
} else {
|
||||||
|
policy = UnthrottledNestedTimeoutPolicyOverride::kNoOverride;
|
||||||
|
}
|
||||||
|
g_unthrottled_nested_timeout_policy_override_cached = true;
|
||||||
|
return policy;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void ClearSetTimeoutWithout1MsClampPolicyOverrideCacheForTesting() {
|
void ClearSetTimeoutWithout1MsClampPolicyOverrideCacheForTesting() {
|
||||||
|
@ -1269,18 +1304,32 @@ bool IsSetTimeoutWithoutClampEnabled() {
|
||||||
return base::FeatureList::IsEnabled(features::kSetTimeoutWithoutClamp);
|
return base::FeatureList::IsEnabled(features::kSetTimeoutWithoutClamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClearUnthrottledNestedTimeoutOverrideCacheForTesting() {
|
||||||
|
// Tests may want to force recalculation of the cached policy value when
|
||||||
|
// exercising different configs.
|
||||||
|
g_unthrottled_nested_timeout_policy_override_cached = false;
|
||||||
|
}
|
||||||
|
|
||||||
// If enabled, the setTimeout(..., 0) will clamp to 4ms after a custom `nesting`
|
// If enabled, the setTimeout(..., 0) will clamp to 4ms after a custom `nesting`
|
||||||
// level.
|
// level.
|
||||||
// Tracking bug: https://crbug.com/1108877.
|
// Tracking bug: https://crbug.com/1108877.
|
||||||
const base::Feature kMaxUnthrottledTimeoutNestingLevel{
|
const base::Feature kMaxUnthrottledTimeoutNestingLevel{
|
||||||
"MaxUnthrottledTimeoutNestingLevel", base::FEATURE_DISABLED_BY_DEFAULT};
|
"MaxUnthrottledTimeoutNestingLevel", base::FEATURE_DISABLED_BY_DEFAULT};
|
||||||
const base::FeatureParam<int> kMaxUnthrottledTimeoutNestingLevelParam{
|
const base::FeatureParam<int> kMaxUnthrottledTimeoutNestingLevelParam{
|
||||||
&kMaxUnthrottledTimeoutNestingLevel, "nesting", 10};
|
&kMaxUnthrottledTimeoutNestingLevel, "nesting", 100};
|
||||||
bool IsMaxUnthrottledTimeoutNestingLevelEnabled() {
|
bool IsMaxUnthrottledTimeoutNestingLevelEnabled() {
|
||||||
|
auto policy = GetUnthrottledNestedTimeoutPolicyOverride();
|
||||||
|
if (policy != UnthrottledNestedTimeoutPolicyOverride::kNoOverride)
|
||||||
|
return policy == UnthrottledNestedTimeoutPolicyOverride::kForceEnable;
|
||||||
|
// Otherwise respect the base::Feature.
|
||||||
return base::FeatureList::IsEnabled(
|
return base::FeatureList::IsEnabled(
|
||||||
blink::features::kMaxUnthrottledTimeoutNestingLevel);
|
blink::features::kMaxUnthrottledTimeoutNestingLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetMaxUnthrottledTimeoutNestingLevel() {
|
int GetMaxUnthrottledTimeoutNestingLevel() {
|
||||||
|
auto policy = GetUnthrottledNestedTimeoutPolicyOverride();
|
||||||
|
if (policy != UnthrottledNestedTimeoutPolicyOverride::kNoOverride)
|
||||||
|
return kMaxUnthrottledTimeoutNestingLevelParam.default_value;
|
||||||
return kMaxUnthrottledTimeoutNestingLevelParam.Get();
|
return kMaxUnthrottledTimeoutNestingLevelParam.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1365,7 +1414,7 @@ const base::Feature kWindowPlacement{"WindowPlacement",
|
||||||
// Allows sites to request fullscreen and open a popup from a single gesture.
|
// Allows sites to request fullscreen and open a popup from a single gesture.
|
||||||
const base::Feature kWindowPlacementFullscreenCompanionWindow{
|
const base::Feature kWindowPlacementFullscreenCompanionWindow{
|
||||||
"WindowPlacementFullscreenCompanionWindow",
|
"WindowPlacementFullscreenCompanionWindow",
|
||||||
base::FEATURE_DISABLED_BY_DEFAULT};
|
base::FEATURE_ENABLED_BY_DEFAULT};
|
||||||
|
|
||||||
// Allows sites to request fullscreen when the set of screens change.
|
// Allows sites to request fullscreen when the set of screens change.
|
||||||
const base::Feature kWindowPlacementFullscreenOnScreensChange{
|
const base::Feature kWindowPlacementFullscreenOnScreensChange{
|
||||||
|
@ -1382,7 +1431,7 @@ const base::Feature kOptimizeViewportConstrainedPaintInvalidation{
|
||||||
base::FEATURE_ENABLED_BY_DEFAULT};
|
base::FEATURE_ENABLED_BY_DEFAULT};
|
||||||
|
|
||||||
const base::Feature kReduceUserAgentMinorVersion{
|
const base::Feature kReduceUserAgentMinorVersion{
|
||||||
"ReduceUserAgentMinorVersion", base::FEATURE_ENABLED_BY_DEFAULT};
|
"ReduceUserAgentMinorVersion", base::FEATURE_DISABLED_BY_DEFAULT};
|
||||||
const base::FeatureParam<std::string> kUserAgentFrozenBuildVersion{
|
const base::FeatureParam<std::string> kUserAgentFrozenBuildVersion{
|
||||||
&kReduceUserAgentMinorVersion, "build_version", "0"};
|
&kReduceUserAgentMinorVersion, "build_version", "0"};
|
||||||
|
|
||||||
|
@ -1483,5 +1532,8 @@ const base::Feature kWebSQLNonSecureContextAccess{
|
||||||
const base::Feature kFileSystemUrlNavigation{"FileSystemUrlNavigation",
|
const base::Feature kFileSystemUrlNavigation{"FileSystemUrlNavigation",
|
||||||
base::FEATURE_DISABLED_BY_DEFAULT};
|
base::FEATURE_DISABLED_BY_DEFAULT};
|
||||||
|
|
||||||
|
const base::Feature kEarlyExitOnNoopClassOrStyleChange{
|
||||||
|
"EarlyExitOnNoopClassOrStyleChange", base::FEATURE_DISABLED_BY_DEFAULT};
|
||||||
|
|
||||||
} // namespace features
|
} // namespace features
|
||||||
} // namespace blink
|
} // namespace blink
|
||||||
|
|
Loading…
Reference in a new issue