blob: 5d564230db54221a519bbc9a3ab3b37fd2811318 [file] [log] [blame]
Avi Drissmane4622aa2022-09-08 20:36:061// Copyright 2018 The Chromium Authors
Leszek Swirski2987cc82018-11-05 15:19:282// 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
Hans-Filip Eloa7745f42022-10-18 18:41:227#include <atomic>
8
David Sanders6e709942022-04-05 06:49:269#include "base/base_export.h"
Leszek Swirski2987cc82018-11-05 15:19:2810#include "base/feature_list.h"
Olivier Li Shing Tat-Dupuisc42ff2e2023-10-13 15:43:0311#include "build/build_config.h"
Leszek Swirski2987cc82018-11-05 15:19:2812
13namespace base {
14
Gabriel Charettedfad5992022-10-28 17:57:1715// Note to implementers: thread pool code using task features must absolutely
16// not invoke FeatureList::IsEnabled outside of the main thread. Doing so
17// causes data races between worker threads and ~FeatureList when tests end
18// (crbug.com/1344573). A reliable moment to query and cache the feature state
19// is on ThreadPoolImpl::Start (and thus also on the first WorkerThread::Start,
20// not the later ones) as this is invoked from the main thread after
21// initializing the FeatureList. If caching the feature state in a static, you
22// must be aware that all tests sharing a process will have the same state,
23// regardless of future ScopedFeatureList instances.
24
Zhibo Wangf8950ab62022-12-09 05:33:4225BASE_FEATURE(kUseUtilityThreadGroup,
26 "UseUtilityThreadGroup",
27 base::FEATURE_DISABLED_BY_DEFAULT);
28
Gabriel Charettedfad5992022-10-28 17:57:1729BASE_FEATURE(kDelayFirstWorkerWake,
30 "DelayFirstWorkerWake",
Olivier Li0c5572d2024-02-28 18:52:1031 base::FEATURE_ENABLED_BY_DEFAULT);
Gabriel Charettedfad5992022-10-28 17:57:1732
Daniel Cheng0fff5c232022-09-21 17:43:3433BASE_FEATURE(kAddTaskLeewayFeature,
34 "AddTaskLeeway",
35 base::FEATURE_ENABLED_BY_DEFAULT);
Etienne Pierre-doraya8792732022-02-05 02:27:2536
37const base::FeatureParam<TimeDelta> kTaskLeewayParam{&kAddTaskLeewayFeature,
Jiahe Zhang07cf33132022-08-09 09:42:4938 "leeway", kDefaultLeeway};
Etienne Pierre-doray77474c902023-09-27 20:23:0939const base::FeatureParam<TimeDelta> kMaxPreciseDelay{
40 &kAddTaskLeewayFeature, "max_precise_delay", kDefaultMaxPreciseDelay};
Etienne Pierre-doraya8792732022-02-05 02:27:2541
Etienne Pierre-doraycea99092023-07-20 20:31:1442BASE_FEATURE(kAlignWakeUps, "AlignWakeUps", base::FEATURE_DISABLED_BY_DEFAULT);
Etienne Pierre-doray048472eb2022-02-07 16:24:4843
Etienne Pierre-doray1f2b04e2023-09-05 20:23:5644BASE_FEATURE(kTimerSlackMac,
45 "TimerSlackMac",
46 base::FEATURE_DISABLED_BY_DEFAULT);
47
Daniel Cheng0fff5c232022-09-21 17:43:3448BASE_FEATURE(kExplicitHighResolutionTimerWin,
49 "ExplicitHighResolutionTimerWin",
Etienne Pierre-dorayd5cdda492023-07-05 18:20:1450 base::FEATURE_ENABLED_BY_DEFAULT);
Etienne Pierre-dorayae2c15a2022-04-29 18:50:5951
Sean Maherbff1adc2024-04-10 20:33:4352BASE_FEATURE(kUIPumpImprovementsWin,
53 "UIPumpImprovementsWin",
François Doray912128b2024-12-13 18:52:0654 base::FEATURE_ENABLED_BY_DEFAULT);
Sean Maheracb46d72024-05-16 17:22:1555
56BASE_FEATURE(kPumpFastToSleepAndroid,
57 "PumpFastToSleepAndroid",
Sean Maherbff1adc2024-04-10 20:33:4358 base::FEATURE_DISABLED_BY_DEFAULT);
59
Daniel Cheng0fff5c232022-09-21 17:43:3460BASE_FEATURE(kRunTasksByBatches,
61 "RunTasksByBatches",
François Doray179b0a82024-12-13 20:52:5762#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
Olivier Li Shing Tat-Dupuisc42ff2e2023-10-13 15:43:0363 base::FEATURE_ENABLED_BY_DEFAULT);
64#else
Daniel Cheng0fff5c232022-09-21 17:43:3465 base::FEATURE_DISABLED_BY_DEFAULT);
Olivier Li Shing Tat-Dupuisc42ff2e2023-10-13 15:43:0366#endif
67
Edgar Arriaga453bcb12023-09-12 23:09:0168BASE_FEATURE(kThreadPoolCap2,
69 "ThreadPoolCap2",
Edgar Arriagad096f402023-05-02 15:39:2470 base::FEATURE_DISABLED_BY_DEFAULT);
71
72const base::FeatureParam<int> kThreadPoolCapRestrictedCount{
Edgar Arriaga453bcb12023-09-12 23:09:0173 &kThreadPoolCap2, "restricted_count", 3};
Alex Attar9fcc01e2022-05-20 14:01:2774
Francois Doray5b44e33f2018-11-09 22:08:1375} // namespace base