Chromium Code Reviews| Index: base/task_scheduler/task_scheduler.cc |
| diff --git a/base/task_scheduler/task_scheduler.cc b/base/task_scheduler/task_scheduler.cc |
| index bff2de65a422e5be152e8d4b1b29f9233fd127da..13bdf56f88432217d6af61919ceeeb2e58e5c12d 100644 |
| --- a/base/task_scheduler/task_scheduler.cc |
| +++ b/base/task_scheduler/task_scheduler.cc |
| @@ -40,16 +40,24 @@ TaskScheduler::InitParams::~InitParams() = default; |
| #if !defined(OS_NACL) |
| // static |
| void TaskScheduler::CreateAndSetSimpleTaskScheduler(const std::string& name) { |
| - constexpr int kMinNumThreads = 1; |
| - std::vector<SchedulerWorkerPoolParams> worker_pool_params_vector; |
| - worker_pool_params_vector.emplace_back( |
| - name, ThreadPriority::NORMAL, |
| - SchedulerWorkerPoolParams::StandbyThreadPolicy::LAZY, |
| - std::max(kMinNumThreads, SysInfo::NumberOfProcessors()), |
| - TimeDelta::FromSeconds(30)); |
| + using StandbyThreadPolicy = SchedulerWorkerPoolParams::StandbyThreadPolicy; |
| + |
| + const int num_cores = SysInfo::NumberOfProcessors(); |
|
robliao
2017/04/06 18:09:37
Add a quick blurb on how we set these values:
Inte
fdoray
2017/04/06 18:22:27
Done.
|
| + constexpr int kBackgroundMaxThreads = 1; |
| + constexpr int kBackgroundBlockingMaxThreads = 2; |
| + const int kForegroundMaxThreads = std::max(1, num_cores); |
| + const int kForegroundBlockingMaxThreads = std::max(2, num_cores); |
| + constexpr TimeDelta kSuggestedReclaimTime = TimeDelta::FromSeconds(30); |
| + |
| CreateAndSetDefaultTaskScheduler( |
| - worker_pool_params_vector, |
| - Bind([](const TaskTraits&) -> size_t { return 0; })); |
| + name, {{StandbyThreadPolicy::LAZY, kBackgroundMaxThreads, |
| + kSuggestedReclaimTime}, |
| + {StandbyThreadPolicy::LAZY, kBackgroundBlockingMaxThreads, |
| + kSuggestedReclaimTime}, |
| + {StandbyThreadPolicy::LAZY, kForegroundMaxThreads, |
| + kSuggestedReclaimTime}, |
| + {StandbyThreadPolicy::LAZY, kForegroundBlockingMaxThreads, |
| + kSuggestedReclaimTime}}); |
| } |
| #endif // !defined(OS_NACL) |