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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..af9747c39f7e6048413ee259248a99c1b9fd9328
--- /dev/null
+++ b/base/task_scheduler/worker_pool_params.h
@@ -0,0 +1,56 @@
+// 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/macros.h"
+#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.
+#include "base/threading/platform_thread.h"
+
+namespace base {
+namespace internal {
+
+class BASE_EXPORT WorkerPoolParams final {
+ 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.
+ WorkerPoolParams(
+ const std::string& name,
+ ThreadPriority thread_priority,
+ SchedulerWorkerPoolImpl::IORestriction io_restriction,
+ int max_threads);
+ 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.
+
+ // 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.
+ 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_;
+
+ DISALLOW_COPY_AND_ASSIGN(WorkerPoolParams);
+};
+
+} // namespace internal
+} // namespace base
+
+#endif // BASE_TASK_SCHEDULER_WORKER_POOL_PARAMS_H_
« 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