Index: content/browser/renderer_host/render_process_host_impl.cc |
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc |
index a1200cd44c2826616e453387a09ea16e438adbf6..1463dd0950b349b7684816e97154ed82cc1d6c67 100644 |
--- a/content/browser/renderer_host/render_process_host_impl.cc |
+++ b/content/browser/renderer_host/render_process_host_impl.cc |
@@ -201,6 +201,11 @@ |
#include "content/browser/mach_broker_mac.h" |
#endif |
+#if defined(OS_POSIX) |
+#include "content/browser/zygote_host/zygote_communication_linux.h" |
+#include "content/browser/zygote_host/zygote_host_impl_linux.h" |
+#endif // defined(OS_POSIX) |
+ |
#if defined(USE_OZONE) |
#include "ui/ozone/public/client_native_pixmap_factory.h" |
#include "ui/ozone/public/ozone_platform.h" |
@@ -389,13 +394,28 @@ class RendererSandboxedProcessLauncherDelegate |
} |
#elif defined(OS_POSIX) |
- bool ShouldUseZygote() override { |
+#if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
+ ZygoteHandle* GetZygote() override { |
const base::CommandLine& browser_command_line = |
*base::CommandLine::ForCurrentProcess(); |
base::CommandLine::StringType renderer_prefix = |
browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); |
- return renderer_prefix.empty(); |
+ if (!renderer_prefix.empty()) |
+ return nullptr; |
+ |
+ static ZygoteHandle zygote; |
+ if (zygote == nullptr) { |
+ zygote = new ZygoteCommunication(); |
+ zygote->Init(); |
+ //TODO(kerrnel): Investigate doing this without the ZygoteHostImpl as a |
+ //proxy. It is currently done this way due to concerns about race |
+ //conditions. |
+ ZygoteHostImpl::GetInstance()->SetRendererSandboxStatus( |
+ zygote->GetSandboxStatus()); |
+ } |
+ return &zygote; |
} |
+#endif // !defined(OS_MACOSX) && !defined(OS_ANDROID) |
base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); } |
#endif // OS_WIN |