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

Unified Diff: chrome/app/mash/mash_runner.cc

Issue 2525073002: Initialize TaskScheduler in Mash. (Closed)
Patch Set: shared constant for max num threads 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
« no previous file with comments | « chrome/app/mash/BUILD.gn ('k') | services/service_manager/standalone/context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/mash/mash_runner.cc
diff --git a/chrome/app/mash/mash_runner.cc b/chrome/app/mash/mash_runner.cc
index 940804f7e70b6e1db0e9078f6a678dbf9a06b768..b9a99a60bcea18b43f562bfa9dc8dbf45b0dd18d 100644
--- a/chrome/app/mash/mash_runner.cc
+++ b/chrome/app/mash/mash_runner.cc
@@ -15,6 +15,8 @@
#include "base/message_loop/message_loop.h"
#include "base/process/launch.h"
#include "base/run_loop.h"
+#include "base/task_scheduler/task_scheduler.h"
+#include "base/threading/sequenced_worker_pool.h"
#include "base/trace_event/trace_event.h"
#include "components/tracing/common/trace_to_console.h"
#include "components/tracing/common/tracing_switches.h"
@@ -35,6 +37,7 @@
#include "services/service_manager/runner/host/child_process.h"
#include "services/service_manager/runner/host/child_process_base.h"
#include "services/service_manager/runner/init.h"
+#include "services/service_manager/standalone/context.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_paths.h"
#include "ui/base/ui_base_switches.h"
@@ -127,6 +130,10 @@ int MashRunner::Run() {
}
void MashRunner::RunMain() {
+ base::TaskScheduler::CreateAndSetSimpleTaskScheduler(
+ service_manager::kThreadPoolMaxThreads);
+ base::SequencedWorkerPool::EnableWithRedirectionToTaskSchedulerForProcess();
+
// TODO(sky): refactor BackgroundServiceManager so can supply own context, we
// shouldn't we using context as it has a lot of stuff we don't really want
// in chrome.
@@ -169,9 +176,16 @@ void MashRunner::RunMain() {
// Ping mash_session to ensure an instance is brought up
context_->connector()->Connect("mash_session");
base::RunLoop().Run();
+
+ base::TaskScheduler::GetInstance()->Shutdown();
}
int MashRunner::RunChild() {
+ // TODO(fdoray): Add TaskScheduler initialization code in
+ // service_manager::ServiceRunner. TaskScheduler can't be initialized here
+ // because it wouldn't be visible to the service's dynamic library.
+ // https://crbug.com/664996
+
base::FilePath path =
base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
switches::kChildProcess);
« no previous file with comments | « chrome/app/mash/BUILD.gn ('k') | services/service_manager/standalone/context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698