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

Unified Diff: content/zygote/zygote_main_linux.cc

Issue 1637083002: Add CdmService to keep track of CDMs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ContentDecryptionModule Created 4 years, 10 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/zygote/zygote_main_linux.cc
diff --git a/content/zygote/zygote_main_linux.cc b/content/zygote/zygote_main_linux.cc
index c30e1084a92c6eecaf07417f30c3d5464b9b0f8a..7c0f5c038a6c8b30ab5cf6e89f07d3dcfd267484 100644
--- a/content/zygote/zygote_main_linux.cc
+++ b/content/zygote/zygote_main_linux.cc
@@ -36,6 +36,7 @@
#include "content/common/sandbox_linux/sandbox_debug_handling_linux.h"
#include "content/common/sandbox_linux/sandbox_linux.h"
#include "content/common/zygote_commands_linux.h"
+#include "content/public/common/content_decryption_module_service.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/main_function_params.h"
#include "content/public/common/sandbox_linux.h"
@@ -318,6 +319,29 @@ void PreloadPepperPlugins() {
}
#endif
+// Loads any registered Content Decryption Modules but does not initialize
+// them. This is needed by the zygote on Linux to get access to the modules
+// before entering the sandbox.
+void PreloadContentDecryptionModules() {
+ std::vector<std::pair<std::string, base::FilePath>> modules;
+
+ ContentDecryptionModuleService::GetInstance()->GetAllRegisteredModules(
+ &modules);
+ for (const auto& module : modules) {
+ const auto& module_library_path = module.second;
+ if (!module_library_path.empty()) {
+ base::NativeLibraryLoadError error;
+ base::NativeLibrary library =
+ base::LoadNativeLibrary(module_library_path, &error);
+ VLOG_IF(1, !library) << "Unable to load key system "
+ << module_library_path.value() << " "
+ << error.ToString();
+
+ (void)library; // Prevent release-mode warning.
+ }
+ }
+}
+
// This function triggers the static and lazy construction of objects that need
// to be created before imposing the sandbox.
static void ZygotePreSandboxInit() {
@@ -346,6 +370,10 @@ static void ZygotePreSandboxInit() {
#endif
SkFontConfigInterface::SetGlobal(
new FontConfigIPC(GetSandboxFD()))->unref();
+
+ // Ensure access to Content Decryption Modules before the sandbox is
+ // turned on.
+ PreloadContentDecryptionModules();
}
static bool CreateInitProcessReaper(base::Closure* post_fork_parent_callback) {

Powered by Google App Engine
This is Rietveld 408576698