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

Unified Diff: base/task_scheduler/task_scheduler.cc

Issue 2729523006: Remove the |max_threads| argument from CreateAndSetSimpleTaskScheduler(). (Closed)
Patch Set: fix build error Created 3 years, 9 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
« no previous file with comments | « base/task_scheduler/task_scheduler.h ('k') | chrome/app/mash/mash_runner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_scheduler/task_scheduler.cc
diff --git a/base/task_scheduler/task_scheduler.cc b/base/task_scheduler/task_scheduler.cc
index 00ca4f15ce9c12b8f8f3331c314cdd7418bd6028..592d6f4a15ecb97f79f890cbd66ee9001c82f596 100644
--- a/base/task_scheduler/task_scheduler.cc
+++ b/base/task_scheduler/task_scheduler.cc
@@ -4,8 +4,11 @@
#include "base/task_scheduler/task_scheduler.h"
+#include <algorithm>
+
#include "base/bind.h"
#include "base/logging.h"
+#include "base/sys_info.h"
#include "base/task_scheduler/scheduler_worker_pool_params.h"
#include "base/task_scheduler/task_scheduler_impl.h"
#include "base/threading/platform_thread.h"
@@ -20,17 +23,21 @@ TaskScheduler* g_task_scheduler = nullptr;
} // namespace
+#if !defined(OS_NACL)
// static
-void TaskScheduler::CreateAndSetSimpleTaskScheduler(int max_threads) {
+void TaskScheduler::CreateAndSetSimpleTaskScheduler(const std::string& name) {
+ constexpr int kMinNumThreads = 1;
std::vector<SchedulerWorkerPoolParams> worker_pool_params_vector;
worker_pool_params_vector.emplace_back(
- "Simple", ThreadPriority::NORMAL,
- SchedulerWorkerPoolParams::StandbyThreadPolicy::LAZY, max_threads,
+ name, ThreadPriority::NORMAL,
+ SchedulerWorkerPoolParams::StandbyThreadPolicy::LAZY,
+ std::max(kMinNumThreads, base::SysInfo::NumberOfProcessors()),
TimeDelta::FromSeconds(30));
CreateAndSetDefaultTaskScheduler(
worker_pool_params_vector,
Bind([](const TaskTraits&) -> size_t { return 0; }));
}
+#endif // !defined(OS_NACL)
// static
void TaskScheduler::CreateAndSetDefaultTaskScheduler(
« no previous file with comments | « base/task_scheduler/task_scheduler.h ('k') | chrome/app/mash/mash_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698