OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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_SCHEDULER_ENVIRONMENT_CONFIG_H_ |
| 6 #define BASE_TASK_SCHEDULER_ENVIRONMENT_CONFIG_H_ |
| 7 |
| 8 #include <stddef.h> |
| 9 |
| 10 #include "base/task_scheduler/task_traits.h" |
| 11 #include "base/threading/thread.h" |
| 12 |
| 13 namespace base { |
| 14 namespace internal { |
| 15 |
| 16 enum EnvironmentType { |
| 17 BACKGROUND = 0, |
| 18 BACKGROUND_BLOCKING, |
| 19 FOREGROUND, |
| 20 FOREGROUND_BLOCKING, |
| 21 ENVIRONMENT_COUNT // Always last. |
| 22 }; |
| 23 |
| 24 // Order must match the EnvironmentType enum. |
| 25 constexpr struct { |
| 26 // The threads and histograms of this environment will be labeled with |
| 27 // the task scheduler name concatenated to this. |
| 28 const char* name_suffix; |
| 29 |
| 30 // Preferred priority for threads in this environment; the actual thread |
| 31 // priority depends on shutdown state and platform capabilities. |
| 32 ThreadPriority priority_hint; |
| 33 } kEnvironmentParams[] = { |
| 34 {"Background", base::ThreadPriority::BACKGROUND}, |
| 35 {"BackgroundBlocking", base::ThreadPriority::BACKGROUND}, |
| 36 {"Foreground", base::ThreadPriority::NORMAL}, |
| 37 {"ForegroundBlocking", base::ThreadPriority::NORMAL}, |
| 38 }; |
| 39 |
| 40 size_t GetEnvironmentIndexForTraits(const TaskTraits& traits); |
| 41 |
| 42 } // namespace internal |
| 43 } // namespace base |
| 44 |
| 45 #endif // BASE_TASK_SCHEDULER_ENVIRONMENT_CONFIG_H_ |
OLD | NEW |