| 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 "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/base_paths.h" |
| 8 #include "base/bind.h" | 9 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 10 #include "base/debug/debugger.h" | 11 #include "base/debug/debugger.h" |
| 11 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 12 #include "base/i18n/icu_util.h" | 13 #include "base/i18n/icu_util.h" |
| 13 #include "base/logging.h" | 14 #include "base/logging.h" |
| 14 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 15 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
| 17 #include "base/path_service.h" |
| 16 #include "base/process/launch.h" | 18 #include "base/process/launch.h" |
| 17 #include "base/run_loop.h" | 19 #include "base/run_loop.h" |
| 18 #include "base/task_scheduler/task_scheduler.h" | 20 #include "base/task_scheduler/task_scheduler.h" |
| 19 #include "base/threading/sequenced_worker_pool.h" | 21 #include "base/threading/sequenced_worker_pool.h" |
| 20 #include "base/trace_event/trace_event.h" | 22 #include "base/trace_event/trace_event.h" |
| 21 #include "components/tracing/common/trace_to_console.h" | 23 #include "components/tracing/common/trace_to_console.h" |
| 22 #include "components/tracing/common/tracing_switches.h" | 24 #include "components/tracing/common/tracing_switches.h" |
| 23 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
| 24 #include "content/public/common/service_names.mojom.h" | 26 #include "content/public/common/service_names.mojom.h" |
| 25 #include "mash/package/mash_packaged_service.h" | 27 #include "mash/package/mash_packaged_service.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 NativeRunnerDelegateImpl() {} | 89 NativeRunnerDelegateImpl() {} |
| 88 ~NativeRunnerDelegateImpl() override {} | 90 ~NativeRunnerDelegateImpl() override {} |
| 89 | 91 |
| 90 private: | 92 private: |
| 91 // service_manager::NativeRunnerDelegate: | 93 // service_manager::NativeRunnerDelegate: |
| 92 void AdjustCommandLineArgumentsForTarget( | 94 void AdjustCommandLineArgumentsForTarget( |
| 93 const service_manager::Identity& target, | 95 const service_manager::Identity& target, |
| 94 base::CommandLine* command_line) override { | 96 base::CommandLine* command_line) override { |
| 95 if (target.name() == kChromeMashServiceName || | 97 if (target.name() == kChromeMashServiceName || |
| 96 target.name() == content::mojom::kBrowserServiceName) { | 98 target.name() == content::mojom::kBrowserServiceName) { |
| 97 command_line->SetProgram( | 99 base::FilePath exe_path; |
| 98 base::CommandLine::ForCurrentProcess()->GetProgram()); | 100 base::PathService::Get(base::FILE_EXE, &exe_path); |
| 101 command_line->SetProgram(exe_path); |
| 99 } | 102 } |
| 100 if (target.name() != content::mojom::kBrowserServiceName) { | 103 if (target.name() != content::mojom::kBrowserServiceName) { |
| 101 // If running anything other than the browser process, launch a mash | 104 // If running anything other than the browser process, launch a mash |
| 102 // child process. The new process will execute MashRunner::RunChild(). | 105 // child process. The new process will execute MashRunner::RunChild(). |
| 103 command_line->AppendSwitchASCII(switches::kProcessType, kMashChild); | 106 command_line->AppendSwitchASCII(switches::kProcessType, kMashChild); |
| 104 #if defined(OS_WIN) | 107 #if defined(OS_WIN) |
| 105 command_line->AppendArg(switches::kPrefetchArgumentOther); | 108 command_line->AppendArg(switches::kPrefetchArgumentOther); |
| 106 #endif | 109 #endif |
| 107 return; | 110 return; |
| 108 } | 111 } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 base::trace_event::TraceConfig trace_config = | 235 base::trace_event::TraceConfig trace_config = |
| 233 tracing::GetConfigForTraceToConsole(); | 236 tracing::GetConfigForTraceToConsole(); |
| 234 base::trace_event::TraceLog::GetInstance()->SetEnabled( | 237 base::trace_event::TraceLog::GetInstance()->SetEnabled( |
| 235 trace_config, | 238 trace_config, |
| 236 base::trace_event::TraceLog::RECORDING_MODE); | 239 base::trace_event::TraceLog::RECORDING_MODE); |
| 237 } | 240 } |
| 238 | 241 |
| 239 MashRunner mash_runner; | 242 MashRunner mash_runner; |
| 240 return mash_runner.Run(); | 243 return mash_runner.Run(); |
| 241 } | 244 } |
| OLD | NEW |