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

Unified Diff: components/task_scheduler_util/initialization_util.cc

Issue 2501763002: Add Thread Standby Policy SchedulerWorkerPoolImpl (Closed)
Patch Set: CR Feedback 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: components/task_scheduler_util/initialization_util.cc
diff --git a/components/task_scheduler_util/initialization_util.cc b/components/task_scheduler_util/initialization_util.cc
index ca94f42171117f036be7702fe7e8116de4395bcf..e86ae3cb1d54731d0e6ad84ac5bad81f371d2ced 100644
--- a/components/task_scheduler_util/initialization_util.cc
+++ b/components/task_scheduler_util/initialization_util.cc
@@ -22,6 +22,9 @@ namespace task_scheduler_util {
namespace {
+using StandbyThreadPolicy =
+ base::SchedulerWorkerPoolParams::StandbyThreadPolicy;
+
enum WorkerPoolType : size_t {
BACKGROUND_WORKER_POOL = 0,
BACKGROUND_FILE_IO_WORKER_POOL,
@@ -31,6 +34,7 @@ enum WorkerPoolType : size_t {
};
struct WorkerPoolVariationValues {
+ StandbyThreadPolicy standby_thread_policy;
int threads = 0;
base::TimeDelta detach_period;
};
@@ -70,6 +74,10 @@ WorkerPoolVariationValues StringToWorkerPoolVariationValues(
values.threads = std::min(maximum, std::max(minimum, threads));
values.detach_period =
base::TimeDelta::FromMilliseconds(detach_milliseconds);
+ values.standby_thread_policy =
+ (tokens.size() >= 6 && tokens[5] == "lazy")
+ ? StandbyThreadPolicy::LAZY
+ : StandbyThreadPolicy::ONE;
return values;
}
DLOG(ERROR) << "Invalid Worker Pool Descriptor: " << pool_descriptor;
@@ -131,6 +139,7 @@ bool InitializeDefaultTaskScheduler(
params_vector.emplace_back(predefined_params.name,
predefined_params.priority_hint,
predefined_params.io_restriction,
+ variation_values.standby_thread_policy,
variation_values.threads,
variation_values.detach_period);
}

Powered by Google App Engine
This is Rietveld 408576698