| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/app/mash/mash_runner.h" | 5 #include "chrome/app/mash/mash_runner.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
| 11 #include "base/base_switches.h" | 11 #include "base/base_switches.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/debug/debugger.h" | 14 #include "base/debug/debugger.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/files/file_util.h" | 16 #include "base/files/file_util.h" |
| 17 #include "base/i18n/icu_util.h" | 17 #include "base/i18n/icu_util.h" |
| 18 #include "base/logging.h" | 18 #include "base/logging.h" |
| 19 #include "base/memory/ptr_util.h" | 19 #include "base/memory/ptr_util.h" |
| 20 #include "base/message_loop/message_loop.h" | 20 #include "base/message_loop/message_loop.h" |
| 21 #include "base/path_service.h" | 21 #include "base/path_service.h" |
| 22 #include "base/process/launch.h" | 22 #include "base/process/launch.h" |
| 23 #include "base/process/process.h" | 23 #include "base/process/process.h" |
| 24 #include "base/run_loop.h" | 24 #include "base/run_loop.h" |
| 25 #include "base/sys_info.h" | |
| 26 #include "base/task_scheduler/task_scheduler.h" | 25 #include "base/task_scheduler/task_scheduler.h" |
| 27 #include "base/threading/sequenced_worker_pool.h" | 26 #include "base/threading/sequenced_worker_pool.h" |
| 28 #include "base/threading/thread.h" | 27 #include "base/threading/thread.h" |
| 29 #include "base/trace_event/trace_event.h" | 28 #include "base/trace_event/trace_event.h" |
| 30 #include "chrome/app/mash/chrome_mash_catalog.h" | 29 #include "chrome/app/mash/chrome_mash_catalog.h" |
| 31 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
| 32 #include "components/tracing/common/trace_to_console.h" | 31 #include "components/tracing/common/trace_to_console.h" |
| 33 #include "components/tracing/common/tracing_switches.h" | 32 #include "components/tracing/common/tracing_switches.h" |
| 34 #include "content/public/common/content_switches.h" | 33 #include "content/public/common/content_switches.h" |
| 35 #include "content/public/common/service_names.mojom.h" | 34 #include "content/public/common/service_names.mojom.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 run_loop->Quit(); | 149 run_loop->Quit(); |
| 151 } | 150 } |
| 152 | 151 |
| 153 } // namespace | 152 } // namespace |
| 154 | 153 |
| 155 MashRunner::MashRunner() {} | 154 MashRunner::MashRunner() {} |
| 156 | 155 |
| 157 MashRunner::~MashRunner() {} | 156 MashRunner::~MashRunner() {} |
| 158 | 157 |
| 159 int MashRunner::Run() { | 158 int MashRunner::Run() { |
| 160 base::TaskScheduler::CreateAndSetSimpleTaskScheduler( | 159 base::TaskScheduler::CreateAndSetSimpleTaskScheduler("MashRunner"); |
| 161 base::SysInfo::NumberOfProcessors()); | |
| 162 | 160 |
| 163 if (IsChild()) | 161 if (IsChild()) |
| 164 return RunChild(); | 162 return RunChild(); |
| 165 | 163 |
| 166 return RunMain(); | 164 return RunMain(); |
| 167 } | 165 } |
| 168 | 166 |
| 169 int MashRunner::RunMain() { | 167 int MashRunner::RunMain() { |
| 170 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); | 168 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); |
| 171 | 169 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 command_line->GetSwitchValueASCII(switches::kWaitForDebugger)) { | 310 command_line->GetSwitchValueASCII(switches::kWaitForDebugger)) { |
| 313 return; | 311 return; |
| 314 } | 312 } |
| 315 | 313 |
| 316 // Include the pid as logging may not have been initialized yet (the pid | 314 // Include the pid as logging may not have been initialized yet (the pid |
| 317 // printed out by logging is wrong). | 315 // printed out by logging is wrong). |
| 318 LOG(WARNING) << "waiting for debugger to attach for service " << service_name | 316 LOG(WARNING) << "waiting for debugger to attach for service " << service_name |
| 319 << " pid=" << base::Process::Current().Pid(); | 317 << " pid=" << base::Process::Current().Pid(); |
| 320 base::debug::WaitForDebugger(120, true); | 318 base::debug::WaitForDebugger(120, true); |
| 321 } | 319 } |
| OLD | NEW |