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_SCHEDULER_WORKER_POOL_PARAMS_H_ 6 #define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_PARAMS_H_ 7 8 #include "base/task_scheduler/scheduler_worker_params.h" 9 #include "base/time/time.h" 10 11 namespace base { 12 13 class BASE_EXPORT SchedulerWorkerPoolParams final { 14 public: 15 // Constructs a set of params used to initialize a pool. The pool will run 16 // concurrently at most |max_tasks| that aren't blocked (ScopedBlockingCall). 17 // |suggested_reclaim_time| sets a suggestion on when to reclaim idle threads. 18 // The pool is free to ignore this value for performance or correctness 19 // reasons. |backward_compatibility| indicates whether backward compatibility 20 // is enabled. 21 SchedulerWorkerPoolParams( 22 int max_tasks, 23 TimeDelta suggested_reclaim_time, 24 SchedulerBackwardCompatibility backward_compatibility = 25 SchedulerBackwardCompatibility::DISABLED); 26 27 SchedulerWorkerPoolParams(const SchedulerWorkerPoolParams& other); 28 SchedulerWorkerPoolParams& operator=(const SchedulerWorkerPoolParams& other); 29 max_tasks()30 int max_tasks() const { return max_tasks_; } suggested_reclaim_time()31 TimeDelta suggested_reclaim_time() const { return suggested_reclaim_time_; } backward_compatibility()32 SchedulerBackwardCompatibility backward_compatibility() const { 33 return backward_compatibility_; 34 } 35 36 private: 37 int max_tasks_; 38 TimeDelta suggested_reclaim_time_; 39 SchedulerBackwardCompatibility backward_compatibility_; 40 }; 41 42 } // namespace base 43 44 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_PARAMS_H_ 45