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

Unified Diff: base/task_scheduler/scheduler_worker_pool_params.h

Issue 2501763002: Add Thread Standby Policy SchedulerWorkerPoolImpl (Closed)
Patch Set: Rebase to edc7bea Created 4 years, 1 month 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
Index: base/task_scheduler/scheduler_worker_pool_params.h
diff --git a/base/task_scheduler/scheduler_worker_pool_params.h b/base/task_scheduler/scheduler_worker_pool_params.h
index bba785599096c336ccdcea0aad54694ee8faf4ce..c33392afd061c0d6c22d12e262111430bae4b2b4 100644
--- a/base/task_scheduler/scheduler_worker_pool_params.h
+++ b/base/task_scheduler/scheduler_worker_pool_params.h
@@ -21,6 +21,14 @@ class BASE_EXPORT SchedulerWorkerPoolParams final {
DISALLOWED,
};
+ enum class StandbyThreadPolicy {
+ // Create threads as needed on demand, reclaimed as necessary.
+ LAZY,
+ // When possible, keep one idle thread alive on standby, reclaimed as
+ // necessary.
+ ONE,
+ };
+
// Construct a scheduler worker pool parameter object. |name| will be used to
// label the pool's threads ("TaskScheduler" + |name| + index) and histograms
// ("TaskScheduler." + histogram name + "." + |name| + extra suffixes). The
@@ -33,6 +41,7 @@ class BASE_EXPORT SchedulerWorkerPoolParams final {
SchedulerWorkerPoolParams(const std::string& name,
ThreadPriority priority_hint,
IORestriction io_restriction,
+ StandbyThreadPolicy standby_thread_policy,
int max_threads,
const TimeDelta& suggested_reclaim_time);
SchedulerWorkerPoolParams(SchedulerWorkerPoolParams&& other);
@@ -41,6 +50,9 @@ class BASE_EXPORT SchedulerWorkerPoolParams final {
const std::string& name() const { return name_; }
ThreadPriority priority_hint() const { return priority_hint_; }
IORestriction io_restriction() const { return io_restriction_; }
+ StandbyThreadPolicy standby_thread_policy() const {
+ return standby_thread_policy_;
+ }
size_t max_threads() const { return max_threads_; }
const TimeDelta& suggested_reclaim_time() const {
return suggested_reclaim_time_;
@@ -50,6 +62,7 @@ class BASE_EXPORT SchedulerWorkerPoolParams final {
std::string name_;
ThreadPriority priority_hint_;
IORestriction io_restriction_;
+ StandbyThreadPolicy standby_thread_policy_;
size_t max_threads_;
TimeDelta suggested_reclaim_time_;
« 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