Chromium Code Reviews| Index: base/task_scheduler/worker_pool_params.h |
| diff --git a/base/task_scheduler/worker_pool_params.h b/base/task_scheduler/worker_pool_params.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0d9967b3a630f1db59d0bd8859bd48acf0e01045 |
| --- /dev/null |
| +++ b/base/task_scheduler/worker_pool_params.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef BASE_TASK_SCHEDULER_WORKER_POOL_PARAMS_H_ |
| +#define BASE_TASK_SCHEDULER_WORKER_POOL_PARAMS_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/task_scheduler/scheduler_worker_pool_impl.h" |
| +#include "base/threading/platform_thread.h" |
| + |
| +namespace base { |
| +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
|
| + |
| +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
|
| + public: |
| + // Construct a worker pool parameter object that instructs a worker pool to |
| + // use the label |name| and create up to |max_threads| threads of priority |
| + // |thread_priority|. |io_restriction| indicates whether Tasks on the worker |
| + // 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
|
| + WorkerPoolParams( |
| + const std::string& name, |
| + ThreadPriority thread_priority, |
| + SchedulerWorkerPoolImpl::IORestriction io_restriction, |
| + int max_threads); |
| + 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.
|
| + |
| + // Name of the pool. Used to label the pool's threads. |
| + const std::string& name() const { return name_; } |
| + |
| + // Priority of the pool's threads. |
| + ThreadPriority thread_priority() const { return thread_priority_; } |
| + |
| + // 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
|
| + SchedulerWorkerPoolImpl::IORestriction io_restriction() const { |
| + return io_restriction_; |
| + } |
| + |
| + // Maximum number of threads in the pool. |
| + size_t max_threads() const { return max_threads_; } |
| + |
| + private: |
| + std::string name_; |
| + ThreadPriority thread_priority_; |
| + SchedulerWorkerPoolImpl::IORestriction io_restriction_; |
| + size_t max_threads_; |
| +}; |
| + |
| +} // namespace internal |
| +} // namespace base |
| + |
| +#endif // BASE_TASK_SCHEDULER_WORKER_POOL_PARAMS_H_ |