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

Unified Diff: components/nacl/browser/nacl_process_host.cc

Issue 1532423003: Have each SandboxedProcessLauncherDelegate maintain a zygote. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Load and initialize all zygotes on browser startup. Created 4 years, 11 months 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: components/nacl/browser/nacl_process_host.cc
diff --git a/components/nacl/browser/nacl_process_host.cc b/components/nacl/browser/nacl_process_host.cc
index 41e337a408bb0fd76fb89ad7381449f100fd71f6..8fb0616cbfaeccabce2f31714dcf9622fdcac905 100644
--- a/components/nacl/browser/nacl_process_host.cc
+++ b/components/nacl/browser/nacl_process_host.cc
@@ -68,6 +68,7 @@
#include <netinet/in.h>
#include <sys/socket.h>
+#include "content/public/browser/zygote_host_linux.h"
#include "ipc/ipc_channel_posix.h"
#elif defined(OS_WIN)
#include <windows.h>
@@ -155,6 +156,10 @@ bool RunningOnWOW64() {
namespace {
+#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
+content::ZygoteHandle zygote;
mdempsky 2016/01/15 20:29:41 Google C++ style guide encourages prefixing global
Greg K 2016/01/19 19:34:18 Done.
+#endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
+
// NOTE: changes to this class need to be reviewed by the security team.
class NaClSandboxedProcessLauncherDelegate
: public content::SandboxedProcessLauncherDelegate {
@@ -181,7 +186,10 @@ class NaClSandboxedProcessLauncherDelegate
}
}
#elif defined(OS_POSIX)
- bool ShouldUseZygote() override { return true; }
+#if !defined(OS_MACOSX) && !defined(OS_ANDROID)
+ content::ZygoteHandle* GetZygote() override { return &zygote; }
+#endif // !defined(OS_MACOSX) && !defined(OS_ANDROID)
+
base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); }
#endif // OS_WIN
@@ -417,6 +425,14 @@ void NaClProcessHost::EarlyStartup() {
NaClBrowser::GetDelegate()->SetDebugPatterns(nacl_debug_mask);
}
+#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
+// static
+void NaClProcessHost::EarlyZygoteLaunch() {
+ DCHECK(!zygote);
+ zygote = content::ZygoteHost::CreateZygote();
+}
+#endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
+
// static
void NaClProcessHost::SetPpapiKeepAliveThrottleForTesting(
unsigned milliseconds) {

Powered by Google App Engine
This is Rietveld 408576698