blob: f32021a6c5c30d2ab76d344a296068b1519458e2 [file] [log] [blame]
Leszek Swirski2987cc82018-11-05 15:19:281// Copyright 2018 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "base/task/task_features.h"
6
David Sanders6e709942022-04-05 06:49:267#include "base/base_export.h"
Leszek Swirski2987cc82018-11-05 15:19:288#include "base/feature_list.h"
9
10namespace base {
11
Etienne Pierre-doray3ed41382019-02-06 04:40:4712const Feature kMayBlockWithoutDelay = {"MayBlockWithoutDelay",
13 base::FEATURE_DISABLED_BY_DEFAULT};
14
Etienne Pierre-dorayea2b21e2020-10-26 22:38:5915const Feature kDisableJobYield = {"DisableJobYield",
16 base::FEATURE_DISABLED_BY_DEFAULT};
17
18const Feature kDisableFairJobScheduling = {"DisableFairJobScheduling",
19 base::FEATURE_DISABLED_BY_DEFAULT};
20
21const Feature kDisableJobUpdatePriority = {"DisableJobUpdatePriority",
22 base::FEATURE_DISABLED_BY_DEFAULT};
23
24const Feature kWakeUpStrategyFeature = {"WakeUpStrategyFeature",
25 base::FEATURE_DISABLED_BY_DEFAULT};
26
27constexpr FeatureParam<WakeUpStrategy>::Option kWakeUpStrategyOptions[] = {
28 {WakeUpStrategy::kCentralizedWakeUps, "centralized-wakeups"},
29 {WakeUpStrategy::kSerializedWakeUps, "serialized-wakeups"},
Etienne Pierre-dorayb5fe0b5f2021-01-29 18:37:2730 {WakeUpStrategy::kExponentialWakeUps, "exponential-wakeups"},
31 {WakeUpStrategy::kGreedyWakeUps, "greedy-wakeups"}};
Etienne Pierre-dorayea2b21e2020-10-26 22:38:5932
33const base::FeatureParam<WakeUpStrategy> kWakeUpStrategyParam{
34 &kWakeUpStrategyFeature, "strategy", WakeUpStrategy::kExponentialWakeUps,
35 &kWakeUpStrategyOptions};
36
37const Feature kWakeUpAfterGetWork = {"WakeUpAfterGetWork",
38 base::FEATURE_DISABLED_BY_DEFAULT};
39
Francois Dorayee4a5532021-03-30 00:17:1740#if HAS_NATIVE_THREAD_POOL()
Aditya Keerthia41eda52019-04-01 15:03:2541const Feature kUseNativeThreadPool = {"UseNativeThreadPool",
42 base::FEATURE_DISABLED_BY_DEFAULT};
Francois Dorayee4a5532021-03-30 00:17:1743const Feature kUseBackgroundNativeThreadPool = {
44 "UseBackgroundNativeThreadPool", base::FEATURE_DISABLED_BY_DEFAULT};
Aditya Keerthia41eda52019-04-01 15:03:2545#endif
46
Francois Doraya20b6df22019-06-27 15:04:1947const Feature kUseFiveMinutesThreadReclaimTime = {
48 "UseFiveMinutesThreadReclaimTime", base::FEATURE_DISABLED_BY_DEFAULT};
49
Patrick Monette6497eae2022-08-09 17:59:5850// static
51const BASE_EXPORT Feature kNoWakeUpsForCanceledTasks{
52 "NoWakeUpsForCanceledTasks", FEATURE_DISABLED_BY_DEFAULT};
53
Patrick Monetteeaaa2382021-12-08 17:06:5954const BASE_EXPORT Feature kRemoveCanceledTasksInTaskQueue = {
Patrick Monetted85b8162022-01-27 00:23:2355 "RemoveCanceledTasksInTaskQueue2", base::FEATURE_DISABLED_BY_DEFAULT};
Patrick Monetteeaaa2382021-12-08 17:06:5956
Etienne Pierre-doraya8792732022-02-05 02:27:2557const BASE_EXPORT Feature kAddTaskLeewayFeature = {
58 "AddTaskLeeway", base::FEATURE_ENABLED_BY_DEFAULT};
59
60const base::FeatureParam<TimeDelta> kTaskLeewayParam{&kAddTaskLeewayFeature,
Jiahe Zhang07cf33132022-08-09 09:42:4961 "leeway", kDefaultLeeway};
Etienne Pierre-doraya8792732022-02-05 02:27:2562
Etienne Pierre-doray048472eb2022-02-07 16:24:4863const BASE_EXPORT Feature kAlignWakeUps = {"AlignWakeUps",
64 base::FEATURE_DISABLED_BY_DEFAULT};
65
Etienne Pierre-dorayae2c15a2022-04-29 18:50:5966const BASE_EXPORT Feature kExplicitHighResolutionTimerWin = {
67 "ExplicitHighResolutionTimerWin", base::FEATURE_DISABLED_BY_DEFAULT};
68
Alex Attar9fcc01e2022-05-20 14:01:2769const BASE_EXPORT Feature kRunTasksByBatches = {
Alex Attar42c63be2022-06-02 18:58:1270 "RunTasksByBatches", base::FEATURE_DISABLED_BY_DEFAULT};
Alex Attar9fcc01e2022-05-20 14:01:2771
Jiahe Zhang07cf33132022-08-09 09:42:4972// Leeway value applied to delayed tasks. An atomic is used here because the
73// value is queried from multiple threads.
74std::atomic<TimeDelta> g_task_leeway{kDefaultLeeway};
75
76BASE_EXPORT void InitializeTaskLeeway() {