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

Unified Diff: chromecast/browser/cast_browser_main_parts.cc

Issue 872073005: Get SIGTERM when parent process dies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/browser/cast_browser_main_parts.cc
diff --git a/chromecast/browser/cast_browser_main_parts.cc b/chromecast/browser/cast_browser_main_parts.cc
index 263d5955bc5ea28f18f848930de16a088aa990dc..7a6e6000e07977660040eae34b6d0a18aaed5c0d 100644
--- a/chromecast/browser/cast_browser_main_parts.cc
+++ b/chromecast/browser/cast_browser_main_parts.cc
@@ -5,6 +5,7 @@
#include "chromecast/browser/cast_browser_main_parts.h"
#include <signal.h>
+#include <sys/prctl.h>
#include "base/command_line.h"
#include "base/files/file_util.h"
@@ -57,6 +58,8 @@ void RunClosureOnSignal(int signum) {
void RegisterClosureOnSignal(const base::Closure& closure) {
DCHECK(!g_signal_closure);
+ DCHECK_GT(arraysize(kSignalsToRunClosure), 0U);
+
// Allow memory leak by intention.
g_signal_closure = new base::Closure(closure);
@@ -74,6 +77,9 @@ void RegisterClosureOnSignal(const base::Closure& closure) {
DCHECK_EQ(sa_old.sa_handler, SIG_DFL);
}
}
+
+ // Get the first signal to exit when the parent process dies.
+ prctl(PR_SET_PDEATHSIG, kSignalsToRunClosure[0]);
}
} // namespace
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698