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

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: 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/task_scheduler/scheduler_worker_pool_impl.h"
11 #include "base/threading/platform_thread.h"
12
13 namespace base {
14 namespace internal {
gab 2016/07/18 15:24:13 These are intended to be used by callers of our AP
fdoray 2016/07/18 15:51:11 Is there a reason why consumers of the API would w
robliao 2016/07/18 19:51:11 Yup. I noticed this when I coded this up. It was c
15
16 class BASE_EXPORT WorkerPoolParams final {
gab 2016/07/18 15:24:13 SchedulerWorkerPoolParams ? (unfortunately we have
robliao 2016/07/18 19:51:11 The WorkerPoolParams may not just apply to the Sch
17 public:
18 // Construct a worker pool parameter object that instructs a worker pool to
19 // use the label |name| and create up to |max_threads| threads of priority
20 // |thread_priority|. |io_restriction| indicates whether Tasks on the worker
21 // pool are allowed to make I/O calls.
gab 2016/07/18 15:24:13 s/worker pool/scheduler work pool/
robliao 2016/07/18 19:51:11 See earlier comment about scheduler worker pool vs
22 WorkerPoolParams(
23 const std::string& name,
24 ThreadPriority thread_priority,
25 SchedulerWorkerPoolImpl::IORestriction io_restriction,
26 int max_threads);
27 WorkerPoolParams(const WorkerPoolParams& other) = default;
gab 2016/07/18 15:24:13 Explicitly declare default move-constructor (out-o
robliao 2016/07/18 19:51:12 Done.
28
29 // Name of the pool. Used to label the pool's threads.
30 const std::string& name() const { return name_; }
31
32 // Priority of the pool's threads.
33 ThreadPriority thread_priority() const { return thread_priority_; }
34
35 // Whether I/O is allowed in the pool.
gab 2016/07/18 15:24:13 I don't think these method comments are necessary.
robliao 2016/07/18 19:51:12 I agree, but it's idiomatic with what we have in t
fdoray 2016/08/04 20:42:51 The constructor of TaskTraits doesn't have argumen
36 SchedulerWorkerPoolImpl::IORestriction io_restriction() const {
37 return io_restriction_;
38 }
39
40 // Maximum number of threads in the pool.
41 size_t max_threads() const { return max_threads_; }
42
43 private:
44 std::string name_;
45 ThreadPriority thread_priority_;
46 SchedulerWorkerPoolImpl::IORestriction io_restriction_;
47 size_t max_threads_;
48 };
49
50 } // namespace internal
51 } // namespace base
52
53 #endif // BASE_TASK_SCHEDULER_WORKER_POOL_PARAMS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698