Chromium Code Reviews| 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..3c6d88b7cb0cca546287ea69947df72081f886ae 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" |
| @@ -127,6 +129,10 @@ int MashRunner::Run() { |
| } |
| void MashRunner::RunMain() { |
| + constexpr int kNumThreads = 3; |
|
sky
2016/11/23 21:47:35
Where does the 3 come from? Is there a constant el
fdoray
2016/11/23 21:53:43
From the SequencedWorkerPool that TaskScheduler re
|
| + base::TaskScheduler::CreateAndSetSimpleTaskScheduler(kNumThreads); |
| + 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 +175,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); |