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

Unified Diff: base/task_scheduler/scheduler_worker_pool_params.h

Issue 2116163002: Add Lazy Creation and Thread Detachment Support in the Scheduler Worker Pool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fenced Load 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
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 955e0e89254a6e6fa962ebb5bfb551333a67154e..6d2fd891b946a38ac616eb83beeb1cb25fbb6a2b 100644
--- a/base/task_scheduler/scheduler_worker_pool_params.h
+++ b/base/task_scheduler/scheduler_worker_pool_params.h
@@ -11,6 +11,9 @@
#include "base/threading/platform_thread.h"
namespace base {
+
+class TimeDelta;
+
namespace internal {
class BASE_EXPORT SchedulerWorkerPoolParams final {
@@ -24,12 +27,15 @@ class BASE_EXPORT SchedulerWorkerPoolParams final {
// scheduler 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 scheduler worker pool are allowed to make
- // I/O calls.
+ // I/O calls. |suggested_reclaim_time| sets a suggestion on when to reclaim
+ // idle threads. The worker pool is free to ignore this value for performance
+ // or correctness reasons.
SchedulerWorkerPoolParams(
const std::string& name,
ThreadPriority thread_priority,
IORestriction io_restriction,
- int max_threads);
+ int max_threads,
+ const TimeDelta& suggested_reclaim_time);
SchedulerWorkerPoolParams(SchedulerWorkerPoolParams&& other);
SchedulerWorkerPoolParams& operator=(SchedulerWorkerPoolParams&& other);
@@ -45,11 +51,17 @@ class BASE_EXPORT SchedulerWorkerPoolParams final {
// Maximum number of threads in the pool.
size_t max_threads() const { return max_threads_; }
+ // Suggested reclaim time for threads in the worker pool.
+ const TimeDelta& suggested_reclaim_time() const {
+ return suggested_reclaim_time_;
+ }
+
private:
std::string name_;
ThreadPriority thread_priority_;
IORestriction io_restriction_;
size_t max_threads_;
+ TimeDelta suggested_reclaim_time_;
DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerPoolParams);
};

Powered by Google App Engine
This is Rietveld 408576698