OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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_SCHEDULER_WORKER_POOL_PARAMS_H_ | |
6 #define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_PARAMS_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/threading/platform_thread.h" | |
12 | |
13 namespace base { | |
14 namespace internal { | |
15 | |
16 class BASE_EXPORT SchedulerWorkerPoolParams final { | |
17 public: | |
18 enum class IORestriction { | |
19 ALLOWED, | |
20 DISALLOWED, | |
21 }; | |
22 | |
23 // Construct a worker pool parameter object that instructs a worker pool to | |
gab
2016/07/20 01:08:27
s/worker pool/scheduler worker pool/
(3 places in
robliao
2016/07/20 17:24:27
Done.
| |
24 // use the label |name| and create up to |max_threads| threads of priority | |
25 // |thread_priority|. |io_restriction| indicates whether Tasks on the worker | |
26 // pool are allowed to make I/O calls. | |
27 SchedulerWorkerPoolParams( | |
28 const std::string& name, | |
29 ThreadPriority thread_priority, | |
30 IORestriction io_restriction, | |
31 int max_threads); | |
32 SchedulerWorkerPoolParams(SchedulerWorkerPoolParams&& other); | |
33 SchedulerWorkerPoolParams& operator=(SchedulerWorkerPoolParams&& other); | |
34 | |
35 // Name of the pool. Used to label the pool's threads. | |
36 const std::string& name() const { return name_; } | |
37 | |
38 // Priority of the pool's threads. | |
39 ThreadPriority thread_priority() const { return thread_priority_; } | |
40 | |
41 // Whether I/O is allowed in the pool. | |
42 IORestriction io_restriction() const { return io_restriction_; } | |
43 | |
44 // Maximum number of threads in the pool. | |
45 size_t max_threads() const { return max_threads_; } | |
46 | |
47 private: | |
48 std::string name_; | |
49 ThreadPriority thread_priority_; | |
50 IORestriction io_restriction_; | |
51 size_t max_threads_; | |
52 | |
53 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerPoolParams); | |
54 }; | |
55 | |
56 } // namespace internal | |
57 } // namespace base | |
58 | |
59 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_PARAMS_H_ | |
OLD | NEW |