Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Unified Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 1532423003: Have each SandboxedProcessLauncherDelegate maintain a zygote. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fetch sandbox status Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 9197d0cb264e99f6ea28f71a90f9fada6df650d8..04c1d09ace0bf7ee439130d489f77407434d3339 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -199,6 +199,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"
@@ -387,12 +392,24 @@ class RendererSandboxedProcessLauncherDelegate
}
#elif defined(OS_POSIX)
- bool ShouldUseZygote() override {
+ 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()) {
+ static ZygoteHandle zygote;
+#if !defined(OS_MACOSX) && !defined(OS_ANDROID)
mdempsky 2015/12/22 21:21:33 We don't need the GetZygote function on OS X or An
Greg K 2016/01/05 21:42:13 Done.
+ if (zygote == nullptr) {
+ zygote = new ZygoteCommunication();
+ zygote->Init();
+ ZygoteHostImpl::GetInstance()->SetRendererSandboxStatus(
mdempsky 2015/12/22 21:21:33 This is kind of clunky, though I don't have a bett
Greg K 2016/01/05 21:42:13 Done.
+ zygote->GetSandboxStatus());
+ }
+#endif // !OS_MACOSX && !defined(OS_ANDROID)
+ return &zygote;
+ }
+ return nullptr;
}
base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); }
#endif // OS_WIN

Powered by Google App Engine
This is Rietveld 408576698