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

Unified Diff: content/child/child_process.cc

Issue 2798623002: Use TaskScheduler::InitParams to initialize TaskScheduler in child processes. (Closed)
Patch Set: Created 3 years, 8 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 | « content/child/child_process.h ('k') | content/public/renderer/content_renderer_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/child_process.cc
diff --git a/content/child/child_process.cc b/content/child/child_process.cc
index 380e3176b1c148e24cc9c3195287e852fbbec47d..e629ce5b5062336b697a726a93f594866d28e928 100644
--- a/content/child/child_process.cc
+++ b/content/child/child_process.cc
@@ -14,6 +14,7 @@
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/task_scheduler/task_scheduler.h"
#include "base/threading/thread.h"
#include "base/threading/thread_local.h"
#include "build/build_config.h"
@@ -37,9 +38,8 @@ base::LazyInstance<base::ThreadLocalPointer<ChildProcess>>::DestructorAtExit
ChildProcess::ChildProcess(
base::ThreadPriority io_thread_priority,
- const std::vector<base::SchedulerWorkerPoolParams>& worker_pool_params,
- base::TaskScheduler::WorkerPoolIndexForTraitsCallback
- worker_pool_index_for_traits_callback)
+ const std::string& task_scheduler_name,
+ std::unique_ptr<base::TaskScheduler::InitParams> task_scheduler_init_params)
: ref_count_(0),
shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL,
base::WaitableEvent::InitialState::NOT_SIGNALED),
@@ -53,13 +53,11 @@ ChildProcess::ChildProcess(
// exist when ChildProcess is instantiated in the browser process or in a
// test process.
if (!base::TaskScheduler::GetInstance()) {
- if (worker_pool_params.empty()) {
- DCHECK(!worker_pool_index_for_traits_callback);
- base::TaskScheduler::CreateAndSetSimpleTaskScheduler("ContentChild");
- } else {
- DCHECK(worker_pool_index_for_traits_callback);
+ if (task_scheduler_init_params) {
base::TaskScheduler::CreateAndSetDefaultTaskScheduler(
- worker_pool_params, std::move(worker_pool_index_for_traits_callback));
+ task_scheduler_name, *task_scheduler_init_params.get());
+ } else {
+ base::TaskScheduler::CreateAndSetSimpleTaskScheduler(task_scheduler_name);
}
DCHECK(base::TaskScheduler::GetInstance());
« no previous file with comments | « content/child/child_process.h ('k') | content/public/renderer/content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698