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

Unified Diff: components/task_scheduler_util/initialization_util.cc

Issue 2501763002: Add Thread Standby Policy SchedulerWorkerPoolImpl (Closed)
Patch Set: 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..4fa1a5e3c0a61678ab36e015a46cb7cb3bd6cdd7 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,13 @@ WorkerPoolVariationValues StringToWorkerPoolVariationValues(
values.threads = std::min(maximum, std::max(minimum, threads));
values.detach_period =
base::TimeDelta::FromMilliseconds(detach_milliseconds);
+ values.standby_thread_policy = StandbyThreadPolicy::ONE;
fdoray 2016/11/15 15:27:02 values.standby_thread_policy = (tokens.size()
robliao 2016/11/15 15:57:19 Done.
+ if (tokens.size() >= 6) {
+ values.standby_thread_policy =
+ tokens[5] == "lazy"
+ ? StandbyThreadPolicy::LAZY
+ : StandbyThreadPolicy::ONE;
+ }
return values;
}
DLOG(ERROR) << "Invalid Worker Pool Descriptor: " << pool_descriptor;
@@ -131,6 +142,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