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

Unified Diff: content/zygote/zygote_main_linux.cc

Issue 20172004: Split PepperPluginRegistry into the pieces that are needed in each process. content/common only nee… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 5 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
« no previous file with comments | « content/renderer/renderer_main.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/zygote/zygote_main_linux.cc
===================================================================
--- content/zygote/zygote_main_linux.cc (revision 213578)
+++ content/zygote/zygote_main_linux.cc (working copy)
@@ -20,6 +20,7 @@
#include "base/files/file_path.h"
#include "base/linux_util.h"
#include "base/memory/scoped_ptr.h"
+#include "base/native_library.h"
#include "base/pickle.h"
#include "base/posix/eintr_wrapper.h"
#include "base/posix/unix_domain_socket_linux.h"
@@ -28,11 +29,12 @@
#include "base/sys_info.h"
#include "build/build_config.h"
#include "content/common/font_config_ipc_linux.h"
-#include "content/common/pepper_plugin_registry.h"
+#include "content/common/pepper_plugin_list.h"
#include "content/common/sandbox_linux.h"
#include "content/common/zygote_commands_linux.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/main_function_params.h"
+#include "content/public/common/pepper_plugin_info.h"
#include "content/public/common/sandbox_linux.h"
#include "content/public/common/zygote_fork_delegate_linux.h"
#include "content/zygote/zygote_linux.h"
@@ -249,6 +251,27 @@
}
}
+#if defined(ENABLE_PLUGINS)
+// Loads the (native) libraries but does not initialize them (i.e., does not
+// call PPP_InitializeModule). This is needed by the zygote on Linux to get
+// access to the plugins before entering the sandbox.
+void PreloadPepperPlugins() {
+ std::vector<PepperPluginInfo> plugins;
+ ComputePepperPluginList(&plugins);
+ for (size_t i = 0; i < plugins.size(); ++i) {
+ if (!plugins[i].is_internal && plugins[i].is_sandboxed) {
+ std::string error;
+ base::NativeLibrary library = base::LoadNativeLibrary(plugins[i].path,
+ &error);
+ DLOG_IF(WARNING, !library) << "Unable to load plugin "
+ << plugins[i].path.value() << " "
+ << error;
+ (void)library; // Prevent release-mode warning.
+ }
+ }
+}
+#endif
+
// This function triggers the static and lazy construction of objects that need
// to be created before imposing the sandbox.
static void PreSandboxInit() {
@@ -277,7 +300,7 @@
#endif
#if defined(ENABLE_PLUGINS)
// Ensure access to the Pepper plugins before the sandbox is turned on.
- PepperPluginRegistry::PreloadModules();
+ PreloadPepperPlugins();
#endif
#if defined(ENABLE_WEBRTC)
InitializeWebRtcModule();
« no previous file with comments | « content/renderer/renderer_main.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698