From: Uzair Date: Wed, 19 Sep 2018 12:32:25 +0000 (+0530) Subject: [M67 Migration] [Architecture] Disable zygote process for single process mode in... X-Git-Tag: submit/tizen/20201118.160233~249 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F66%2F189666%2F2;p=platform%2Fframework%2Fweb%2Fchromium-efl.git [M67 Migration] [Architecture] Disable zygote process for single process mode in tizen port This patch changes the codes to disable the zygote renderer process and IPC sandbox in single process mode except tizen tv product profile using OS_TIZEN_TV_PRODUCT flag. Reference: https://review.tizen.org/gerrit/#/c/174342 Change-Id: I9f0f564c05a0202bd7ae586d1dc9746989cd34a9 Signed-off-by: Uzair --- diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc index d1e6e7d..8f8b5be 100644 --- a/content/app/content_main_runner.cc +++ b/content/app/content_main_runner.cc @@ -312,6 +312,10 @@ void InitializeZygoteSandboxForBrowserProcess( // SandboxHostLinux needs to be initialized even if the sandbox and // zygote are both disabled. It initializes the sandboxed process socket. SandboxHostLinux::GetInstance()->Init(); +#if defined(OS_TIZEN) && !defined(OS_TIZEN_TV_PRODUCT) + if (parsed_command_line.HasSwitch(switches::kSingleProcess)) + return; +#endif if (parsed_command_line.HasSwitch(switches::kNoZygote) && !parsed_command_line.HasSwitch(switches::kNoSandbox)) { @@ -637,7 +641,12 @@ int RunNamedProcessTypeMain( #if BUILDFLAG(USE_ZYGOTE_HANDLE) // Zygote startup is special -- see RunZygote comments above // for why we don't use ZygoteMain directly. - if (process_type == switches::kZygoteProcess) + if (process_type == switches::kZygoteProcess +#if defined(OS_TIZEN) && !defined(OS_TIZEN_TV_PRODUCT) + && !base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kSingleProcess) +#endif + ) return RunZygote(delegate); #endif // BUILDFLAG(USE_ZYGOTE_HANDLE) diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc index fcc37f2..b24557a 100644 --- a/content/browser/child_process_launcher.cc +++ b/content/browser/child_process_launcher.cc @@ -12,6 +12,7 @@ #include "base/process/launch.h" #include "build/build_config.h" #include "content/public/browser/child_process_launcher_utils.h" +#include "content/public/common/content_switches.h" #include "content/public/common/result_codes.h" #include "content/public/common/sandboxed_process_launcher_delegate.h" @@ -75,7 +76,11 @@ void ChildProcessLauncher::Notify( int error_code) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); starting_ = false; - process_ = std::move(process); +#if defined(OS_TIZEN) && !defined(OS_TIZEN_TV_PRODUCT) + if (!base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kSingleProcess)) +#endif + process_ = std::move(process); if (process_.process.IsValid()) { client_->OnProcessLaunched(); diff --git a/content/browser/child_process_launcher_helper_linux.cc b/content/browser/child_process_launcher_helper_linux.cc index 732970c..ece5a51 100644 --- a/content/browser/child_process_launcher_helper_linux.cc +++ b/content/browser/child_process_launcher_helper_linux.cc @@ -75,6 +75,11 @@ ChildProcessLauncherHelper::LaunchProcessOnLauncherThread( base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoZygote) ? nullptr : delegate_->GetZygote(); +#if defined(OS_TIZEN) && !defined(OS_TIZEN_TV_PRODUCT) + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kSingleProcess)) + zygote_handle = nullptr; +#endif if (zygote_handle) { // TODO(crbug.com/569191): If chrome supported multiple zygotes they could // be created lazily here, or in the delegate GetZygote() implementations.