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 5d5d93d02e86154eae3f1d3d22d17caa86f0eb36..8b9f1525c167b2eafea94be165d7a42dd287c096 100644 |
| --- a/chrome/app/mash/mash_runner.cc |
| +++ b/chrome/app/mash/mash_runner.cc |
| @@ -46,6 +46,11 @@ |
| #include "ui/base/ui_base_paths.h" |
| #include "ui/base/ui_base_switches.h" |
| +#if defined(OS_CHROMEOS) |
| +#include "chrome/app/mash/mash_crash_reporter_client.h" |
| +#include "components/crash/content/app/breakpad_linux.h" |
| +#endif |
| + |
| using service_manager::mojom::ServiceFactory; |
| namespace { |
| @@ -127,6 +132,23 @@ class ServiceProcessLauncherDelegateImpl |
| DISALLOW_COPY_AND_ASSIGN(ServiceProcessLauncherDelegateImpl); |
| }; |
| +#if defined(OS_CHROMEOS) |
| +// Initializes breakpad crash reporting. MashCrashReporterClient handles |
| +// registering crash keys. |
| +void InitializeCrashReporting() { |
| + // Intentionally leaked. |
| + static MashCrashReporterClient* client = new MashCrashReporterClient; |
| + crash_reporter::SetCrashReporterClient(client); |
|
sadrul
2017/01/19 04:22:11
I guess we are deliberately leaking here? Do we ne
James Cook
2017/01/19 18:01:18
Good catch on lsan! Done.
|
| + |
| + // For now all standalone services act like the browser process and write |
| + // their own in-process crash dumps. When ash and the window server are |
| + // sandboxed we will need to hook up the crash signal file descriptor, make |
| + // the root process handle dumping, and pass a process type here. |
| + const std::string process_type_unused; |
| + breakpad::InitCrashReporter(process_type_unused); |
| +} |
| +#endif // defined(OS_CHROMEOS) |
| + |
| } // namespace |
| MashRunner::MashRunner() {} |
| @@ -223,10 +245,23 @@ int MashMain() { |
| // TODO(sky): wire this up correctly. |
| service_manager::InitializeLogging(); |
| - std::unique_ptr<base::MessageLoop> message_loop; |
| #if defined(OS_LINUX) |
| base::AtExitManager exit_manager; |
| #endif |
| + |
| +#if !defined(OFFICIAL_BUILD) |
| + // Initialize stack dumping before initializing sandbox to make sure symbol |
| + // names in all loaded libraries will be cached. |
| + base::debug::EnableInProcessStackDumping(); |
| +#endif |
| + |
| +#if defined(OS_CHROMEOS) |
| + // Breakpad installs signal handlers, so crash reporting must be set up after |
| + // EnableInProcessStackDumping() resets the signal handlers. |
| + InitializeCrashReporting(); |
| +#endif |
| + |
| + std::unique_ptr<base::MessageLoop> message_loop; |
| if (!IsChild()) |
| message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); |