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

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

Issue 2729633002: mash: Cleanly exit on SIGTERM, SIGINT, SIGHUP (Closed)
Patch Set: Created 3 years, 10 months 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
Index: chrome/app/mash/mash_runner.cc
diff --git a/chrome/app/mash/mash_runner.cc b/chrome/app/mash/mash_runner.cc
index d5086ec61003d95db27dc5df9b8bf95cdd6fc551..f6be9d7d6d7b286a40669462b487c76e9bbd7322 100644
--- a/chrome/app/mash/mash_runner.cc
+++ b/chrome/app/mash/mash_runner.cc
@@ -56,6 +56,11 @@
#include "ui/base/ui_base_paths.h"
#include "ui/base/ui_base_switches.h"
+#if defined(OS_POSIX)
+#include "base/threading/thread_task_runner_handle.h"
+#include "chrome/app/shutdown_signal_handlers_posix.h"
+#endif
+
using service_manager::mojom::ServiceFactory;
namespace {
@@ -203,6 +208,14 @@ int MashRunner::RunServiceManagerInMain() {
background_service_manager.SetInstanceQuitCallback(
base::Bind(&OnInstanceQuitInMain, &run_loop, &exit_value));
+#if defined(OS_POSIX)
+ // Quit the main process in response to shutdown signals (like SIGTERM).
+ // These signals are used by Linux distributions to request clean shutdown.
+ // On Chrome OS the SIGTERM signal is sent by session_manager.
+ InstallShutdownSignalHandlers(run_loop.QuitClosure(),
+ base::ThreadTaskRunnerHandle::Get());
+#endif
+
// Ping services that we know we want to launch on startup (UI service,
// window manager, quick launch app).
context.connector()->Connect(ui::mojom::kServiceName);

Powered by Google App Engine
This is Rietveld 408576698