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

Side by Side Diff: chrome/app/mash/mash_runner.cc

Issue 2571603002: Makes wait-for-debugger=content_browser work for mash (Closed)
Patch Set: merge Created 4 years 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 unified diff | Download patch
« no previous file with comments | « chrome/app/mash/mash_runner.h ('k') | services/service_manager/runner/common/switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base_paths.h"
9 #include "base/base_switches.h"
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/command_line.h" 11 #include "base/command_line.h"
11 #include "base/debug/debugger.h" 12 #include "base/debug/debugger.h"
12 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
13 #include "base/i18n/icu_util.h" 14 #include "base/i18n/icu_util.h"
14 #include "base/logging.h" 15 #include "base/logging.h"
15 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
16 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
17 #include "base/path_service.h" 18 #include "base/path_service.h"
18 #include "base/process/launch.h" 19 #include "base/process/launch.h"
20 #include "base/process/process.h"
19 #include "base/run_loop.h" 21 #include "base/run_loop.h"
20 #include "base/task_scheduler/task_scheduler.h" 22 #include "base/task_scheduler/task_scheduler.h"
21 #include "base/threading/sequenced_worker_pool.h" 23 #include "base/threading/sequenced_worker_pool.h"
22 #include "base/trace_event/trace_event.h" 24 #include "base/trace_event/trace_event.h"
23 #include "components/tracing/common/trace_to_console.h" 25 #include "components/tracing/common/trace_to_console.h"
24 #include "components/tracing/common/tracing_switches.h" 26 #include "components/tracing/common/tracing_switches.h"
25 #include "content/public/common/content_switches.h" 27 #include "content/public/common/content_switches.h"
26 #include "content/public/common/service_names.mojom.h" 28 #include "content/public/common/service_names.mojom.h"
27 #include "mash/package/mash_packaged_service.h" 29 #include "mash/package/mash_packaged_service.h"
28 #include "mojo/public/cpp/bindings/binding_set.h" 30 #include "mojo/public/cpp/bindings/binding_set.h"
29 #include "services/catalog/public/interfaces/catalog.mojom.h" 31 #include "services/catalog/public/interfaces/catalog.mojom.h"
30 #include "services/catalog/public/interfaces/constants.mojom.h" 32 #include "services/catalog/public/interfaces/constants.mojom.h"
31 #include "services/service_manager/background/background_service_manager.h" 33 #include "services/service_manager/background/background_service_manager.h"
32 #include "services/service_manager/native_runner_delegate.h" 34 #include "services/service_manager/native_runner_delegate.h"
33 #include "services/service_manager/public/cpp/connector.h" 35 #include "services/service_manager/public/cpp/connector.h"
34 #include "services/service_manager/public/cpp/identity.h" 36 #include "services/service_manager/public/cpp/identity.h"
35 #include "services/service_manager/public/cpp/service.h" 37 #include "services/service_manager/public/cpp/service.h"
36 #include "services/service_manager/public/cpp/service_context.h" 38 #include "services/service_manager/public/cpp/service_context.h"
37 #include "services/service_manager/public/cpp/standalone_service/standalone_serv ice.h" 39 #include "services/service_manager/public/cpp/standalone_service/standalone_serv ice.h"
38 #include "services/service_manager/public/interfaces/service_factory.mojom.h" 40 #include "services/service_manager/public/interfaces/service_factory.mojom.h"
41 #include "services/service_manager/runner/common/client_util.h"
39 #include "services/service_manager/runner/common/switches.h" 42 #include "services/service_manager/runner/common/switches.h"
40 #include "services/service_manager/runner/init.h" 43 #include "services/service_manager/runner/init.h"
41 #include "services/service_manager/standalone/context.h" 44 #include "services/service_manager/standalone/context.h"
42 #include "ui/base/resource/resource_bundle.h" 45 #include "ui/base/resource/resource_bundle.h"
43 #include "ui/base/ui_base_paths.h" 46 #include "ui/base/ui_base_paths.h"
44 #include "ui/base/ui_base_switches.h" 47 #include "ui/base/ui_base_switches.h"
45 48
46 using service_manager::mojom::ServiceFactory; 49 using service_manager::mojom::ServiceFactory;
47 50
48 namespace { 51 namespace {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 base::trace_event::TraceConfig trace_config = 238 base::trace_event::TraceConfig trace_config =
236 tracing::GetConfigForTraceToConsole(); 239 tracing::GetConfigForTraceToConsole();
237 base::trace_event::TraceLog::GetInstance()->SetEnabled( 240 base::trace_event::TraceLog::GetInstance()->SetEnabled(
238 trace_config, 241 trace_config,
239 base::trace_event::TraceLog::RECORDING_MODE); 242 base::trace_event::TraceLog::RECORDING_MODE);
240 } 243 }
241 244
242 MashRunner mash_runner; 245 MashRunner mash_runner;
243 return mash_runner.Run(); 246 return mash_runner.Run();
244 } 247 }
248
249 void WaitForMashDebuggerIfNecessary() {
250 if (!service_manager::ServiceManagerIsRemote())
251 return;
252
253 const base::CommandLine* command_line =
254 base::CommandLine::ForCurrentProcess();
255 const std::string service_name =
256 command_line->GetSwitchValueASCII(switches::kProcessServiceName);
257 if (service_name !=
258 command_line->GetSwitchValueASCII(switches::kWaitForDebugger)) {
259 return;
260 }
261
262 // Include the pid as logging may not have been initialized yet (the pid
263 // printed out by logging is wrong).
264 LOG(WARNING) << "waiting for debugger to attach for service " << service_name
265 << " pid=" << base::Process::Current().Pid();
266 base::debug::WaitForDebugger(120, true);
267 }
OLDNEW
« no previous file with comments | « chrome/app/mash/mash_runner.h ('k') | services/service_manager/runner/common/switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698