[M67 Migration] [Architecture] Disable zygote process for single process mode in... 66/189666/2
authorUzair <uzair.jaleel@samsung.com>
Wed, 19 Sep 2018 12:32:25 +0000 (18:02 +0530)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Mon, 24 Sep 2018 15:11:22 +0000 (15:11 +0000)
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 <uzair.jaleel@samsung.com>
content/app/content_main_runner.cc
content/browser/child_process_launcher.cc
content/browser/child_process_launcher_helper_linux.cc

index d1e6e7d..8f8b5be 100644 (file)
@@ -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)
 
index fcc37f2..b24557a 100644 (file)
@@ -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();
index 732970c..ece5a51 100644 (file)
@@ -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.