Changeset View
Changeset View
Standalone View
Standalone View
head/www/chromium/files/patch-chrome_app_chrome__main__delegate.cc
--- chrome/app/chrome_main_delegate.cc.orig 2019-12-16 21:51:22 UTC | --- chrome/app/chrome_main_delegate.cc.orig 2020-03-03 18:53:48 UTC | ||||
+++ chrome/app/chrome_main_delegate.cc | +++ chrome/app/chrome_main_delegate.cc | ||||
@@ -100,7 +100,7 @@ | @@ -100,7 +100,7 @@ | ||||
#include "chrome/app/shutdown_signal_handlers_posix.h" | #include "chrome/app/shutdown_signal_handlers_posix.h" | ||||
#endif | #endif | ||||
-#if BUILDFLAG(ENABLE_NACL) && defined(OS_LINUX) | -#if BUILDFLAG(ENABLE_NACL) && defined(OS_LINUX) | ||||
+#if BUILDFLAG(ENABLE_NACL) && defined(OS_LINUX) && !defined(OS_BSD) | +#if BUILDFLAG(ENABLE_NACL) && defined(OS_LINUX) && !defined(OS_BSD) | ||||
#include "components/nacl/common/nacl_paths.h" | #include "components/nacl/common/nacl_paths.h" | ||||
#include "components/nacl/zygote/nacl_fork_delegate_linux.h" | #include "components/nacl/zygote/nacl_fork_delegate_linux.h" | ||||
#endif | #endif | ||||
@@ -139,7 +139,7 @@ | @@ -142,7 +142,7 @@ | ||||
#include "v8/include/v8.h" | #include "v8/include/v8.h" | ||||
#endif | #endif | ||||
-#if defined(OS_LINUX) | -#if defined(OS_LINUX) | ||||
+#if defined(OS_LINUX) || defined(OS_BSD) | +#if defined(OS_LINUX) || defined(OS_BSD) | ||||
#include "base/environment.h" | #include "base/environment.h" | ||||
#endif | #endif | ||||
@@ -243,7 +243,7 @@ bool UseHooks() { | @@ -246,7 +246,7 @@ bool UseHooks() { | ||||
#endif // defined(OS_WIN) | #endif // defined(OS_WIN) | ||||
-#if defined(OS_LINUX) | -#if defined(OS_LINUX) | ||||
+#if defined(OS_LINUX) && !defined(OS_BSD) | +#if defined(OS_LINUX) && !defined(OS_BSD) | ||||
void AdjustLinuxOOMScore(const std::string& process_type) { | void AdjustLinuxOOMScore(const std::string& process_type) { | ||||
// Browsers and zygotes should still be killable, but killed last. | // Browsers and zygotes should still be killable, but killed last. | ||||
const int kZygoteScore = 0; | const int kZygoteScore = 0; | ||||
@@ -302,13 +302,13 @@ void AdjustLinuxOOMScore(const std::string& process_ty | @@ -305,13 +305,13 @@ void AdjustLinuxOOMScore(const std::string& process_ty | ||||
if (score > -1) | if (score > -1) | ||||
base::AdjustOOMScore(base::GetCurrentProcId(), score); | base::AdjustOOMScore(base::GetCurrentProcId(), score); | ||||
} | } | ||||
-#endif // defined(OS_LINUX) | -#endif // defined(OS_LINUX) | ||||
+#endif // defined(OS_LINUX) && !defined(OS_BSD) | +#endif // defined(OS_LINUX) && !defined(OS_BSD) | ||||
// Returns true if this subprocess type needs the ResourceBundle initialized | // Returns true if this subprocess type needs the ResourceBundle initialized | ||||
// and resources loaded. | // and resources loaded. | ||||
bool SubprocessNeedsResourceBundle(const std::string& process_type) { | bool SubprocessNeedsResourceBundle(const std::string& process_type) { | ||||
return | return | ||||
-#if defined(OS_LINUX) | -#if defined(OS_LINUX) | ||||
+#if defined(OS_LINUX) || defined(OS_BSD) | +#if defined(OS_LINUX) || defined(OS_BSD) | ||||
// The zygote process opens the resources for the renderers. | // The zygote process opens the resources for the renderers. | ||||
process_type == service_manager::switches::kZygoteProcess || | process_type == service_manager::switches::kZygoteProcess || | ||||
#endif | #endif | ||||
@@ -347,7 +347,7 @@ bool HandleVersionSwitches(const base::CommandLine& co | @@ -350,7 +350,7 @@ bool HandleVersionSwitches(const base::CommandLine& co | ||||
return false; | return false; | ||||
} | } | ||||
-#if defined(OS_LINUX) && !defined(OS_CHROMEOS) | -#if defined(OS_LINUX) && !defined(OS_CHROMEOS) | ||||
+#if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_BSD) | +#if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_BSD) | ||||
// Show the man page if --help or -h is on the command line. | // Show the man page if --help or -h is on the command line. | ||||
void HandleHelpSwitches(const base::CommandLine& command_line) { | void HandleHelpSwitches(const base::CommandLine& command_line) { | ||||
if (command_line.HasSwitch(switches::kHelp) || | if (command_line.HasSwitch(switches::kHelp) || | ||||
@@ -357,7 +357,7 @@ void HandleHelpSwitches(const base::CommandLine& comma | @@ -360,7 +360,7 @@ void HandleHelpSwitches(const base::CommandLine& comma | ||||
PLOG(FATAL) << "execlp failed"; | PLOG(FATAL) << "execlp failed"; | ||||
} | } | ||||
} | } | ||||
-#endif // defined(OS_LINUX) && !defined(OS_CHROMEOS) | -#endif // defined(OS_LINUX) && !defined(OS_CHROMEOS) | ||||
+#endif // (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_BSD) | +#endif // (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_BSD) | ||||
#if !defined(OS_MACOSX) && !defined(OS_ANDROID) | #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | ||||
void SIGTERMProfilingShutdown(int signal) { | void SIGTERMProfilingShutdown(int signal) { | ||||
@@ -411,7 +411,7 @@ void InitializeUserDataDir(base::CommandLine* command_ | @@ -414,7 +414,7 @@ void InitializeUserDataDir(base::CommandLine* command_ | ||||
std::string process_type = | std::string process_type = | ||||
command_line->GetSwitchValueASCII(switches::kProcessType); | command_line->GetSwitchValueASCII(switches::kProcessType); | ||||
-#if defined(OS_LINUX) | -#if defined(OS_LINUX) | ||||
+#if defined(OS_LINUX) || defined(OS_BSD) | +#if defined(OS_LINUX) || defined(OS_BSD) | ||||
// On Linux, Chrome does not support running multiple copies under different | // On Linux, Chrome does not support running multiple copies under different | ||||
// DISPLAYs, so the profile directory can be specified in the environment to | // DISPLAYs, so the profile directory can be specified in the environment to | ||||
// support the virtual desktop use-case. | // support the virtual desktop use-case. | ||||
@@ -423,7 +423,7 @@ void InitializeUserDataDir(base::CommandLine* command_ | @@ -426,7 +426,7 @@ void InitializeUserDataDir(base::CommandLine* command_ | ||||
user_data_dir = base::FilePath::FromUTF8Unsafe(user_data_dir_string); | user_data_dir = base::FilePath::FromUTF8Unsafe(user_data_dir_string); | ||||
} | } | ||||
} | } | ||||
-#endif // OS_LINUX | -#endif // OS_LINUX | ||||
+#endif // OS_LINUX || OS_BSD | +#endif // OS_LINUX || OS_BSD | ||||
#if defined(OS_MACOSX) | #if defined(OS_MACOSX) | ||||
policy::path_parser::CheckUserDataDirPolicy(&user_data_dir); | policy::path_parser::CheckUserDataDirPolicy(&user_data_dir); | ||||
#endif // OS_MAC | #endif // OS_MAC | ||||
@@ -480,7 +480,7 @@ void InitLogging(const std::string& process_type) { | @@ -483,7 +483,7 @@ void InitLogging(const std::string& process_type) { | ||||
void RecordMainStartupMetrics(base::TimeTicks exe_entry_point_ticks) { | void RecordMainStartupMetrics(base::TimeTicks exe_entry_point_ticks) { | ||||
if (!exe_entry_point_ticks.is_null()) | if (!exe_entry_point_ticks.is_null()) | ||||
startup_metric_utils::RecordExeMainEntryPointTicks(exe_entry_point_ticks); | startup_metric_utils::RecordExeMainEntryPointTicks(exe_entry_point_ticks); | ||||
-#if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) | -#if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) | ||||
+#if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) || defined(OS_BSD) | +#if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) || defined(OS_BSD) | ||||
// Record the startup process creation time on supported platforms. | // Record the startup process creation time on supported platforms. | ||||
startup_metric_utils::RecordStartupProcessCreationTime( | startup_metric_utils::RecordStartupProcessCreationTime( | ||||
base::Process::Current().CreationTime()); | base::Process::Current().CreationTime()); | ||||
@@ -665,7 +665,7 @@ bool ChromeMainDelegate::BasicStartupComplete(int* exi | @@ -684,7 +684,7 @@ bool ChromeMainDelegate::BasicStartupComplete(int* exi | ||||
*exit_code = 0; | *exit_code = 0; | ||||
return true; // Got a --version switch; exit with a success error code. | return true; // Got a --version switch; exit with a success error code. | ||||
} | } | ||||
-#if defined(OS_LINUX) && !defined(OS_CHROMEOS) | -#if defined(OS_LINUX) && !defined(OS_CHROMEOS) | ||||
+#if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_BSD) | +#if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_BSD) | ||||
// This will directly exit if the user asked for help. | // This will directly exit if the user asked for help. | ||||
HandleHelpSwitches(command_line); | HandleHelpSwitches(command_line); | ||||
#endif | #endif | ||||
@@ -689,7 +689,7 @@ bool ChromeMainDelegate::BasicStartupComplete(int* exi | @@ -708,7 +708,7 @@ bool ChromeMainDelegate::BasicStartupComplete(int* exi | ||||
#if defined(OS_CHROMEOS) | #if defined(OS_CHROMEOS) | ||||
chromeos::RegisterPathProvider(); | chromeos::RegisterPathProvider(); | ||||
#endif | #endif | ||||
-#if BUILDFLAG(ENABLE_NACL) && defined(OS_LINUX) | -#if BUILDFLAG(ENABLE_NACL) && defined(OS_LINUX) | ||||
+#if BUILDFLAG(ENABLE_NACL) && defined(OS_LINUX) && !defined(OS_BSD) | +#if BUILDFLAG(ENABLE_NACL) && defined(OS_LINUX) && !defined(OS_BSD) | ||||
nacl::RegisterPathProvider(); | nacl::RegisterPathProvider(); | ||||
#endif | #endif | ||||
@@ -883,7 +883,7 @@ void ChromeMainDelegate::PreSandboxStartup() { | @@ -902,7 +902,7 @@ void ChromeMainDelegate::PreSandboxStartup() { | ||||
#if defined(OS_WIN) | #if defined(OS_WIN) | ||||
child_process_logging::Init(); | child_process_logging::Init(); | ||||
#endif | #endif | ||||
-#if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) | -#if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) | ||||
+#if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_BSD)) | +#if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_BSD)) | ||||
// Create an instance of the CPU class to parse /proc/cpuinfo and cache | // Create an instance of the CPU class to parse /proc/cpuinfo and cache | ||||
// cpu_brand info. | // cpu_brand info. | ||||
base::CPU cpu_info; | base::CPU cpu_info; | ||||
@@ -1007,7 +1007,7 @@ void ChromeMainDelegate::PreSandboxStartup() { | @@ -1026,7 +1026,7 @@ void ChromeMainDelegate::PreSandboxStartup() { | ||||
InitializePDF(); | InitializePDF(); | ||||
#endif | #endif | ||||
-#if defined(OS_POSIX) && !defined(OS_MACOSX) | -#if defined(OS_POSIX) && !defined(OS_MACOSX) | ||||
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_BSD) | +#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_BSD) | ||||
// Zygote needs to call InitCrashReporter() in RunZygote(). | // Zygote needs to call InitCrashReporter() in RunZygote(). | ||||
if (process_type != service_manager::switches::kZygoteProcess) { | if (process_type != service_manager::switches::kZygoteProcess) { | ||||
#if defined(OS_ANDROID) | #if defined(OS_ANDROID) | ||||
@@ -1028,7 +1028,7 @@ void ChromeMainDelegate::PreSandboxStartup() { | @@ -1047,7 +1047,7 @@ void ChromeMainDelegate::PreSandboxStartup() { | ||||
} | } | ||||
#endif // defined(OS_ANDROID) | #endif // defined(OS_ANDROID) | ||||
} | } | ||||
-#endif // defined(OS_POSIX) && !defined(OS_MACOSX) | -#endif // defined(OS_POSIX) && !defined(OS_MACOSX) | ||||
+#endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_BSD) | +#endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_BSD) | ||||
// After all the platform Breakpads have been initialized, store the command | // After all the platform Breakpads have been initialized, store the command | ||||
// line for crash reporting. | // line for crash reporting. | ||||
@@ -1038,7 +1038,7 @@ void ChromeMainDelegate::PreSandboxStartup() { | @@ -1057,7 +1057,7 @@ void ChromeMainDelegate::PreSandboxStartup() { | ||||
void ChromeMainDelegate::SandboxInitialized(const std::string& process_type) { | void ChromeMainDelegate::SandboxInitialized(const std::string& process_type) { | ||||
// Note: If you are adding a new process type below, be sure to adjust the | // Note: If you are adding a new process type below, be sure to adjust the | ||||
// AdjustLinuxOOMScore function too. | // AdjustLinuxOOMScore function too. | ||||
-#if defined(OS_LINUX) | -#if defined(OS_LINUX) | ||||
+#if defined(OS_LINUX) && !defined(OS_BSD) | +#if defined(OS_LINUX) && !defined(OS_BSD) | ||||
AdjustLinuxOOMScore(process_type); | AdjustLinuxOOMScore(process_type); | ||||
#endif | #endif | ||||
#if defined(OS_WIN) | #if defined(OS_WIN) |