blob: 89fdf551aa8c031cb1dee96e58c6cb7dde00f807 [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
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
Francois Dorayee4a5532021-03-30 00:17:1712#if HAS_NATIVE_THREAD_POOL()
Aditya Keerthia41eda52019-04-01 15:03:2513const Feature kUseNativeThreadPool = {"UseNativeThreadPool",
14 base::FEATURE_DISABLED_BY_DEFAULT};
Francois Dorayee4a5532021-03-30 00:17:1715const Feature kUseBackgroundNativeThreadPool = {
16 "UseBackgroundNativeThreadPool", base::FEATURE_DISABLED_BY_DEFAULT};
Aditya Keerthia41eda52019-04-01 15:03:2517#endif
18
Etienne Pierre-dorayb2895232022-08-30 18:15:0319const Feature kNoWorkerThreadReclaim = {"NoWorkerThreadReclaim",
20 base::FEATURE_DISABLED_BY_DEFAULT};
Francois Doraya20b6df22019-06-27 15:04:1921
Patrick Monette6497eae2022-08-09 17:59:5822// static
23const BASE_EXPORT Feature kNoWakeUpsForCanceledTasks{
24 "NoWakeUpsForCanceledTasks", FEATURE_DISABLED_BY_DEFAULT};
25
Patrick Monetteeaaa2382021-12-08 17:06:5926const BASE_EXPORT Feature kRemoveCanceledTasksInTaskQueue = {
Patrick Monetted85b8162022-01-27 00:23:2327 "RemoveCanceledTasksInTaskQueue2", base::FEATURE_DISABLED_BY_DEFAULT};
Patrick Monetteeaaa2382021-12-08 17:06:5928
Patrick Monette4efba9c2022-08-18 16:41:3229const BASE_EXPORT Feature kAlwaysAbandonScheduledTask = {
30 "AlwaysAbandonScheduledTask", base::FEATURE_DISABLED_BY_DEFAULT};
31
Etienne Pierre-doraya8792732022-02-05 02:27:2532const BASE_EXPORT Feature kAddTaskLeewayFeature = {
33 "AddTaskLeeway", base::FEATURE_ENABLED_BY_DEFAULT};
34
35const base::FeatureParam<TimeDelta> kTaskLeewayParam{&kAddTaskLeewayFeature,
Jiahe Zhang07cf33132022-08-09 09:42:4936 "leeway", kDefaultLeeway};
Etienne Pierre-doraya8792732022-02-05 02:27:2537
Etienne Pierre-doray048472eb2022-02-07 16:24:4838const BASE_EXPORT Feature kAlignWakeUps = {"AlignWakeUps",
39 base::FEATURE_DISABLED_BY_DEFAULT};
40
Etienne Pierre-dorayae2c15a2022-04-29 18:50:5941const BASE_EXPORT Feature kExplicitHighResolutionTimerWin = {
42 "ExplicitHighResolutionTimerWin", base::FEATURE_DISABLED_BY_DEFAULT};
43
Alex Attar9fcc01e2022-05-20 14:01:2744const BASE_EXPORT Feature kRunTasksByBatches = {
Alex Attar42c63be2022-06-02 18:58:1245 "RunTasksByBatches", base::FEATURE_DISABLED_BY_DEFAULT};
Alex Attar9fcc01e2022-05-20 14:01:2746
Jiahe Zhang07cf33132022-08-09 09:42:4947// Leeway value applied to delayed tasks. An atomic is used here because the
48// value is queried from multiple threads.
49std::atomic<TimeDelta> g_task_leeway{kDefaultLeeway};
50
51BASE_EXPORT void InitializeTaskLeeway() {
52 g_task_leeway.store(kTaskLeewayParam.Get(), std::memory_order_relaxed);
53}
54
55BASE_EXPORT TimeDelta GetTaskLeeway() {
56 return g_task_leeway.load(std::memory_order_relaxed);
57}
58
Francois Doray5b44e33f2018-11-09 22:08:1359} // namespace base