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

Unified Diff: content/common/media/cdm_host_file.cc

Issue 2802853002: Revert of media: Simplify CdmHostFile(s) (Closed)
Patch Set: Created 3 years, 8 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/browser/zygote_host/zygote_communication_linux.cc ('k') | content/common/media/cdm_host_files.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/media/cdm_host_file.cc
diff --git a/content/common/media/cdm_host_file.cc b/content/common/media/cdm_host_file.cc
index ff023839ceac545d1a65f4dbdb129fd90923cfb8..99d5cca24a87bf106b481d4f6e288652e80f7dfc 100644
--- a/content/common/media/cdm_host_file.cc
+++ b/content/common/media/cdm_host_file.cc
@@ -10,25 +10,41 @@
#include "base/feature_list.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
+#include "media/base/media_switches.h"
#include "media/cdm/api/content_decryption_module_ext.h"
namespace content {
+
+namespace {
+
+bool IgnoreMissingCdmHostFile() {
+ return base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kIgnoreMissingCdmHostFile);
+}
+
+} // namespace
// static
std::unique_ptr<CdmHostFile> CdmHostFile::Create(
const base::FilePath& file_path,
const base::FilePath& sig_file_path) {
- DVLOG(1) << __func__;
-
// Open file at |file_path|.
base::File file(file_path, base::File::FLAG_OPEN | base::File::FLAG_READ);
- DVLOG(1) << " " << file.IsValid() << ": " << file_path.MaybeAsASCII();
+ if (!file.IsValid()) {
+ DVLOG(1) << "Failed to open file at " << file_path.MaybeAsASCII();
+ return nullptr;
+ }
// Also open the sig file at |sig_file_path|.
base::File sig_file(sig_file_path,
base::File::FLAG_OPEN | base::File::FLAG_READ);
- DVLOG(1) << " " << sig_file.IsValid() << ": "
- << sig_file_path.MaybeAsASCII();
+ if (!sig_file.IsValid()) {
+ DVLOG(1) << "Failed to open sig file at " << sig_file_path.MaybeAsASCII();
+ if (!IgnoreMissingCdmHostFile())
+ return nullptr;
+
+ DVLOG(1) << "Ignoring sig file failure at " << sig_file_path.MaybeAsASCII();
+ }
return std::unique_ptr<CdmHostFile>(
new CdmHostFile(file_path, std::move(file), std::move(sig_file)));
@@ -45,7 +61,12 @@
: file_path_(file_path),
file_(std::move(file)),
sig_file_(std::move(sig_file)) {
- DCHECK(!file_path_.empty());
+ DVLOG(1) << __func__ << ": " << file_path_.value();
+ DCHECK(!file_path_.empty()) << "File path is empty.";
+ DCHECK(file_.IsValid()) << "Invalid file.";
+
+ if (!IgnoreMissingCdmHostFile())
+ DCHECK(sig_file_.IsValid()) << "Invalid signature file.";
}
} // namespace content
« no previous file with comments | « content/browser/zygote_host/zygote_communication_linux.cc ('k') | content/common/media/cdm_host_files.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698