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

Side by Side Diff: base/task_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_WORKER_POOL_PARAMS_H_
6 #define BASE_TASK_SCHEDULER_WORKER_POOL_PARAMS_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "base/task_scheduler/scheduler_worker_pool_impl.h"
fdoray 2016/07/19 18:24:49 Maybe define IORestriction in WorkerPoolParams to
robliao 2016/07/19 20:34:55 Done.
12 #include "base/threading/platform_thread.h"
13
14 namespace base {
15 namespace internal {
16
17 class BASE_EXPORT WorkerPoolParams final {
18 public:
19 // Construct a worker pool parameter object that instructs a worker pool to
20 // use the label |name| and create up to |max_threads| threads of priority
21 // |thread_priority|. |io_restriction| indicates whether Tasks on the worker
22 // pool are allowed to make I/O calls.
23 WorkerPoolParams(
24 const std::string& name,
25 ThreadPriority thread_priority,
26 SchedulerWorkerPoolImpl::IORestriction io_restriction,
27 int max_threads);
28 WorkerPoolParams(WorkerPoolParams&& other);
gab 2016/07/19 18:04:08 Also need to declare default move-assignment opera
robliao 2016/07/19 20:34:55 Ah yup, you're right! Done.
29
30 // Name of the pool. Used to label the pool's threads.
31 const std::string& name() const { return name_; }
32
33 // Priority of the pool's threads.
34 ThreadPriority thread_priority() const { return thread_priority_; }
35
36 // Whether I/O is allowed in the pool.
37 SchedulerWorkerPoolImpl::IORestriction io_restriction() const {
38 return io_restriction_;
39 }
40
41 // Maximum number of threads in the pool.
42 size_t max_threads() const { return max_threads_; }
43
44 private:
45 std::string name_;
46 ThreadPriority thread_priority_;
47 SchedulerWorkerPoolImpl::IORestriction io_restriction_;
48 size_t max_threads_;
49
50 DISALLOW_COPY_AND_ASSIGN(WorkerPoolParams);
51 };
52
53 } // namespace internal
54 } // namespace base
55
56 #endif // BASE_TASK_SCHEDULER_WORKER_POOL_PARAMS_H_
OLDNEW
« no previous file with comments | « base/task_scheduler/task_scheduler_impl_unittest.cc ('k') | base/task_scheduler/worker_pool_params.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698