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

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

Issue 2525073002: Initialize TaskScheduler in Mash. (Closed)
Patch Set: clarified TODO 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 | « no previous file | no next file » | 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..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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698