posix: Added option to disable signal handlers

See https://github.com/chromiumembedded/java-cef/issues/477
This commit is contained in:
Loic Frasse-Mathon
2024-08-05 12:16:49 -04:00
committed by Marshall Greenblatt
parent b61c106b6b
commit 785713c4cc
6 changed files with 61 additions and 14 deletions

View File

@@ -12,7 +12,7 @@ index 79ba3ac1913f8..46bcb4366d2f8 100644
if (main_argv)
setproctitle_init(main_argv);
diff --git content/app/content_main.cc content/app/content_main.cc
index 4251459b695e6..d74286fec151b 100644
index 96c28a7ce3183..8a396ce7adf86 100644
--- content/app/content_main.cc
+++ content/app/content_main.cc
@@ -174,11 +174,8 @@ ContentMainParams::~ContentMainParams() = default;
@@ -39,7 +39,18 @@ index 4251459b695e6..d74286fec151b 100644
// A flag to indicate whether Main() has been called before. On Android, we
// may re-run Main() without restarting the browser process. This flag
@@ -275,14 +269,6 @@ RunContentProcess(ContentMainParams params,
@@ -266,7 +260,9 @@ RunContentProcess(ContentMainParams params,
// default, "C", locale.
setlocale(LC_NUMERIC, "C");
- SetupSignalHandlers();
+ if (!params.disable_signal_handlers) {
+ SetupSignalHandlers();
+ }
#endif
#if BUILDFLAG(IS_WIN)
@@ -274,14 +270,6 @@ RunContentProcess(ContentMainParams params,
#endif
#if BUILDFLAG(IS_MAC)
@@ -54,7 +65,7 @@ index 4251459b695e6..d74286fec151b 100644
InitializeMac();
#endif
@@ -330,12 +316,46 @@ RunContentProcess(ContentMainParams params,
@@ -329,12 +317,46 @@ RunContentProcess(ContentMainParams params,
if (IsSubprocess())
CommonSubprocessInit();
@@ -103,7 +114,7 @@ index 4251459b695e6..d74286fec151b 100644
}
diff --git content/app/content_main_runner_impl.cc content/app/content_main_runner_impl.cc
index eedd753c7990a..87f342581607b 100644
index 78b9930f1ca5c..1d93552c3da25 100644
--- content/app/content_main_runner_impl.cc
+++ content/app/content_main_runner_impl.cc
@@ -52,6 +52,7 @@
@@ -114,7 +125,7 @@ index eedd753c7990a..87f342581607b 100644
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
@@ -1361,6 +1362,11 @@ void ContentMainRunnerImpl::Shutdown() {
@@ -1342,6 +1343,11 @@ void ContentMainRunnerImpl::Shutdown() {
is_shutdown_ = true;
}
@@ -149,10 +160,22 @@ index cbbc2f3ec12fa..f097b3cdded2f 100644
int RunBrowser(MainFunctionParams main_function_params,
bool start_minimal_browser);
diff --git content/public/app/content_main.h content/public/app/content_main.h
index 7f9b515297357..89b52e34fa31a 100644
index 7f9b515297357..5606867e43780 100644
--- content/public/app/content_main.h
+++ content/public/app/content_main.h
@@ -94,6 +94,13 @@ struct CONTENT_EXPORT ContentMainParams {
@@ -66,6 +66,11 @@ struct CONTENT_EXPORT ContentMainParams {
// are left uninitialized.
bool minimal_browser_mode = false;
+#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
+ // Indicates whether to disable signal handlers
+ bool disable_signal_handlers = false;
+#endif
+
#if BUILDFLAG(IS_MAC)
// The outermost autorelease pool to pass to main entry points.
STACK_ALLOCATED_IGNORE("https://crbug.com/1424190")
@@ -94,6 +99,13 @@ struct CONTENT_EXPORT ContentMainParams {
}
};