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 scheduler worker pool parameter object that instructs a |
| 24 // scheduler worker pool to use the label |name| and create up to |
| 25 // |max_threads| threads of priority |thread_priority|. |io_restriction| |
| 26 // indicates whether Tasks on the scheduler worker pool are allowed to make |
| 27 // I/O calls. |
| 28 SchedulerWorkerPoolParams( |
| 29 const std::string& name, |
| 30 ThreadPriority thread_priority, |
| 31 IORestriction io_restriction, |
| 32 int max_threads); |
| 33 SchedulerWorkerPoolParams(SchedulerWorkerPoolParams&& other); |
| 34 SchedulerWorkerPoolParams& operator=(SchedulerWorkerPoolParams&& other); |
| 35 |
| 36 // Name of the pool. Used to label the pool's threads. |
| 37 const std::string& name() const { return name_; } |
| 38 |
| 39 // Priority of the pool's threads. |
| 40 ThreadPriority thread_priority() const { return thread_priority_; } |
| 41 |
| 42 // Whether I/O is allowed in the pool. |
| 43 IORestriction io_restriction() const { return io_restriction_; } |
| 44 |
| 45 // Maximum number of threads in the pool. |
| 46 size_t max_threads() const { return max_threads_; } |
| 47 |
| 48 private: |
| 49 std::string name_; |
| 50 ThreadPriority thread_priority_; |
| 51 IORestriction io_restriction_; |
| 52 size_t max_threads_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerPoolParams); |
| 55 }; |
| 56 |
| 57 } // namespace internal |
| 58 } // namespace base |
| 59 |
| 60 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_PARAMS_H_ |
OLD | NEW |