Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(666)

Side by Side Diff: base/task_scheduler/environment_config.h

Issue 2904593002: Refactor Environment Config Out of TaskSchedulerImpl (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/BUILD.gn ('k') | base/task_scheduler/environment_config.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/task_scheduler/environment_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698