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

Unified Diff: content/browser/ppapi_plugin_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: content/browser/ppapi_plugin_process_host.cc
diff --git a/content/browser/ppapi_plugin_process_host.cc b/content/browser/ppapi_plugin_process_host.cc
index 1817c762d239b812fe1193dd63223d127a4a5b0d..8b87209d5548eea0c7a2241a07db1d51986180c5 100644
--- a/content/browser/ppapi_plugin_process_host.cc
+++ b/content/browser/ppapi_plugin_process_host.cc
@@ -35,6 +35,10 @@
#include "ppapi/proxy/ppapi_messages.h"
#include "ui/base/ui_base_switches.h"
+#if defined(OS_POSIX)
+#include "content/browser/zygote_host/zygote_communication_linux.h"
+#endif // defined(OS_POSIX)
+
#if defined(OS_WIN)
#include "content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h"
#include "content/common/sandbox_win.h"
@@ -45,6 +49,10 @@
namespace content {
+#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
+ZygoteHandle zygote;
+#endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
+
// NOTE: changes to this class need to be reviewed by the security team.
class PpapiPluginSandboxedProcessLauncherDelegate
: public content::SandboxedProcessLauncherDelegate {
@@ -97,13 +105,18 @@ class PpapiPluginSandboxedProcessLauncherDelegate
}
#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 plugin_launcher = browser_command_line
.GetSwitchValueNative(switches::kPpapiPluginLauncher);
- return !is_broker_ && plugin_launcher.empty();
+ if (is_broker_ || !plugin_launcher.empty())
+ return nullptr;
+ return &zygote;
}
+#endif // !defined(OS_MACOSX) && !defined(OS_ANDROID)
+
base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); }
#endif // OS_WIN
@@ -190,6 +203,15 @@ PpapiPluginProcessHost* PpapiPluginProcessHost::CreateBrokerHost(
return NULL;
}
+#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
+// static
+void PpapiPluginProcessHost::EarlyZygoteLaunch() {
+ DCHECK(!zygote);
+ zygote = new ZygoteCommunication();
mdempsky 2016/01/15 20:29:42 Use ZygoteHost::CreateZygote(). (Here and the nex
Greg K 2016/01/19 19:34:19 Done.
+ zygote->Init();
+}
+#endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
+
// static
void PpapiPluginProcessHost::DidCreateOutOfProcessInstance(
int plugin_process_id,

Powered by Google App Engine
This is Rietveld 408576698