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

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

Issue 2146223002: Refactor WorkerPoolCreationArgs to a Read-Only WorkerPoolParams (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR Feedback Created 4 years, 5 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
OLDNEW
(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_
OLDNEW
« no previous file with comments | « base/task_scheduler/scheduler_worker_pool_impl_unittest.cc ('k') | base/task_scheduler/scheduler_worker_pool_params.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698