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

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: CR Feedback Continuation 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 229d335476903068211935392f9a804f0cec3c2c..e557736311e3fe10acd79c247bb15c291dd9df00 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;
fdoray 2016/07/20 14:15:44 #include "base/time/time.h" given that there is a
robliao 2016/07/20 19:44:01 The forward-decl still works here since we only ne
+
namespace internal {
class BASE_EXPORT SchedulerWorkerPoolParams final {
@@ -23,12 +26,15 @@ class BASE_EXPORT SchedulerWorkerPoolParams final {
// 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.
+ // pool are allowed to make 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);
@@ -44,11 +50,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