blob: 169fa098b654b5c6016ac2273f7410ae283e4d1e [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#ifndef BASE_TASK_TASK_FEATURES_H_
6#define BASE_TASK_TASK_FEATURES_H_
7
8#include "base/base_export.h"
Etienne Pierre-Dorayd6b575b22018-11-21 19:32:299#include "base/metrics/field_trial_params.h"
Aditya Keerthia41eda52019-04-01 15:03:2510#include "build/build_config.h"
Leszek Swirski2987cc82018-11-05 15:19:2811
12namespace base {
13
14struct Feature;
Francois Doray5b44e33f2018-11-09 22:08:1315
16extern const BASE_EXPORT Feature kAllTasksUserBlocking;
17extern const BASE_EXPORT Feature kMergeBlockingNonBlockingPools;
Etienne Pierre-Dorayd6b575b22018-11-21 19:32:2918
Gabriel Charette3e2898f2019-05-01 14:55:0119// Under this feature, unused threads in ThreadGroup are only detached
Etienne Pierre-Dorayf9ef2182018-12-13 14:45:4220// if the total number of threads in the pool is above the initial capacity.
21extern const BASE_EXPORT Feature kNoDetachBelowInitialCapacity;
22
Etienne Pierre-doray3ed41382019-02-06 04:40:4723// Under this feature, workers blocked with MayBlock are replaced immediately
24// instead of waiting for a threshold.
25extern const BASE_EXPORT Feature kMayBlockWithoutDelay;
26
Aditya Keerthia41eda52019-04-01 15:03:2527#if defined(OS_WIN) || defined(OS_MACOSX)
Francois Doray7f777312019-05-16 12:26:3128#define HAS_NATIVE_THREAD_POOL() 1
29#else
30#define HAS_NATIVE_THREAD_POOL() 0
31#endif
32
33#if HAS_NATIVE_THREAD_POOL()
Gabriel Charette3e2898f2019-05-01 14:55:0134// Under this feature, ThreadPool will use a ThreadGroup backed by a
Aditya Keerthia41eda52019-04-01 15:03:2535// native thread pool implementation. The Windows Thread Pool API and
36// libdispatch are used on Windows and macOS/iOS respectively.
37extern const BASE_EXPORT Feature kUseNativeThreadPool;
38#endif
39
Leszek Swirski2987cc82018-11-05 15:19:2840} // namespace base
41
42#endif // BASE_TASK_TASK_FEATURES_H_