Bug 1280743 - Put Widevine stuff under #ifdef MOZ_EME to make this file compile under --disable-eme. r=cpearce, a=lizzard
authorMats Palmgren <mats@mozilla.com>
Tue, 21 Jun 2016 13:23:29 +0200
changeset 342427 16dac3dd9af01a52c34756b5769e5291ab9ea75e
parent 342426 382c9188549da7e46cc173ba9c6009c5b06126c0
child 342428 878f4c530d611318aec18c207c846dc1bca20778
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce, lizzard
bugs1280743
milestone49.0
Bug 1280743 - Put Widevine stuff under #ifdef MOZ_EME to make this file compile under --disable-eme. r=cpearce, a=lizzard
dom/media/gmp/GMPParent.cpp
--- a/dom/media/gmp/GMPParent.cpp
+++ b/dom/media/gmp/GMPParent.cpp
@@ -35,18 +35,20 @@ using CrashReporter::GetIDFromMinidump;
 #endif
 
 #include "mozilla/Telemetry.h"
 
 #ifdef XP_WIN
 #include "WMFDecoderModule.h"
 #endif
 
+#ifdef MOZ_EME
 #include "mozilla/dom/WidevineCDMManifestBinding.h"
 #include "widevine-adapter/WidevineAdapter.h"
+#endif
 
 namespace mozilla {
 
 #undef LOG
 #undef LOGD
 
 extern LogModule* GetGMPLog();
 #define LOG(level, x, ...) MOZ_LOG(GetGMPLog(), (level), (x, ##__VA_ARGS__))
@@ -802,24 +804,28 @@ GMPParent::ReadGMPMetaData()
     return GenericPromise::CreateAndReject(rv, __func__);
   }
   infoFile->AppendRelativePath(mName + NS_LITERAL_STRING(".info"));
 
   if (FileExists(infoFile)) {
     return ReadGMPInfoFile(infoFile);
   }
 
+#ifdef MOZ_EME
   // Maybe this is the Widevine adapted plugin?
   nsCOMPtr<nsIFile> manifestFile;
   rv = mDirectory->Clone(getter_AddRefs(manifestFile));
   if (NS_FAILED(rv)) {
     return GenericPromise::CreateAndReject(rv, __func__);
   }
   manifestFile->AppendRelativePath(NS_LITERAL_STRING("manifest.json"));
   return ReadChromiumManifestFile(manifestFile);
+#else
+  return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
+#endif
 }
 
 RefPtr<GenericPromise>
 GMPParent::ReadGMPInfoFile(nsIFile* aFile)
 {
   GMPInfoFileParser parser;
   if (!parser.Init(aFile)) {
     return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
@@ -923,16 +929,17 @@ GMPParent::ReadChromiumManifestFile(nsIF
 }
 
 RefPtr<GenericPromise>
 GMPParent::ParseChromiumManifest(nsString aJSON)
 {
   LOGD("%s: for '%s'", __FUNCTION__, NS_LossyConvertUTF16toASCII(aJSON).get());
 
   MOZ_ASSERT(NS_IsMainThread());
+#ifdef MOZ_EME
   mozilla::dom::WidevineCDMManifest m;
   if (!m.Init(aJSON)) {
     return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
   }
 
   nsresult ignored; // Note: ToInteger returns 0 on failure.
   if (!WidevineAdapter::Supports(m.mX_cdm_module_versions.ToInteger(&ignored),
                                  m.mX_cdm_interface_versions.ToInteger(&ignored),
@@ -955,16 +962,20 @@ GMPParent::ParseChromiumManifest(nsStrin
 
   MOZ_ASSERT(mName.EqualsLiteral("widevinecdm"));
   mAdapter = NS_LITERAL_STRING("widevine");
 #ifdef XP_WIN
   mLibs = NS_LITERAL_CSTRING("dxva2.dll");
 #endif
 
   return GenericPromise::CreateAndResolve(true, __func__);
+#else
+  MOZ_ASSERT_UNREACHABLE("don't call me if EME isn't enabled");
+  return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
+#endif
 }
 
 bool
 GMPParent::CanBeSharedCrossNodeIds() const
 {
   return !mAsyncShutdownInProgress &&
          mNodeId.IsEmpty() &&
          // XXX bug 1159300 hack -- maybe remove after openh264 1.4