From db04fab7216d51f9930674ba6ea5ed77580b9f86 Mon Sep 17 00:00:00 2001 From: Uzair Date: Wed, 19 Sep 2018 18:02:25 +0530 Subject: [PATCH] [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 --- content/app/content_main_runner.cc | 11 ++++++++++- content/browser/child_process_launcher.cc | 7 ++++++- content/browser/child_process_launcher_helper_linux.cc | 5 +++++ 3 files changed, 21 insertions(+), 2 deletions(-) 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. -- 2.7.4