Bug 1341138 - Move LogToConsole from GMPCDMProxy to GMPUtils. r=gerald
authorChris Pearce <cpearce@mozilla.com>
Tue, 21 Feb 2017 13:44:58 +1300
changeset 343883 9c60069211b548e688f026268a91c6876fd45105
parent 343882 e7c397118fd2088b00d5040de1e59b8783d93290
child 343884 cb9e42d09099878b27014ed046a956c870cf48a6
push id37681
push usercpearce@mozilla.com
push dateTue, 21 Feb 2017 01:13:00 +0000
treeherderautoland@9c60069211b5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1341138
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1341138 - Move LogToConsole from GMPCDMProxy to GMPUtils. r=gerald This means we can reuse LogToConsole inside the new CDM decoder backend. This change also makes GMPUtils.cpp build in non-unified build mode. MozReview-Commit-ID: AFkdHIos4X2
dom/media/gmp/GMPCDMProxy.cpp
dom/media/gmp/GMPService.h
dom/media/gmp/GMPUtils.cpp
dom/media/gmp/GMPUtils.h
--- a/dom/media/gmp/GMPCDMProxy.cpp
+++ b/dom/media/gmp/GMPCDMProxy.cpp
@@ -7,27 +7,25 @@
 #include "GMPCDMProxy.h"
 #include "mozilla/EMEUtils.h"
 #include "mozilla/PodOperations.h"
 
 #include "mozilla/dom/MediaKeys.h"
 #include "mozilla/dom/MediaKeySession.h"
 
 #include "mozIGeckoMediaPluginService.h"
-#include "nsContentCID.h"
-#include "nsIConsoleService.h"
 #include "nsPrintfCString.h"
-#include "nsServiceManagerUtils.h"
 #include "nsString.h"
 #include "prenv.h"
 #include "GMPCDMCallbackProxy.h"
 #include "GMPService.h"
 #include "MainThreadUtils.h"
 #include "MediaData.h"
 #include "DecryptJob.h"
+#include "GMPUtils.h"
 
 namespace mozilla {
 
 GMPCDMProxy::GMPCDMProxy(dom::MediaKeys* aKeys,
                          const nsAString& aKeySystem,
                          GMPCrashHelper* aCrashHelper,
                          bool aDistinctiveIdentifierRequired,
                          bool aPersistentStateRequired)
@@ -632,29 +630,16 @@ void
 GMPCDMProxy::OnDecrypted(uint32_t aId,
                          DecryptStatus aResult,
                          const nsTArray<uint8_t>& aDecryptedData)
 {
   MOZ_ASSERT(IsOnOwnerThread());
   gmp_Decrypted(aId, aResult, aDecryptedData);
 }
 
-static void
-LogToConsole(const nsAString& aMsg)
-{
-  nsCOMPtr<nsIConsoleService> console(
-    do_GetService("@mozilla.org/consoleservice;1"));
-  if (!console) {
-    NS_WARNING("Failed to log message to console.");
-    return;
-  }
-  nsAutoString msg(aMsg);
-  console->LogStringMessage(msg.get());
-}
-
 void
 GMPCDMProxy::OnSessionError(const nsAString& aSessionId,
                          nsresult aException,
                          uint32_t aSystemCode,
                          const nsAString& aMsg)
 {
   MOZ_ASSERT(NS_IsMainThread());
   if (mKeys.IsNull()) {
--- a/dom/media/gmp/GMPService.h
+++ b/dom/media/gmp/GMPService.h
@@ -18,16 +18,17 @@
 #include "nsThreadUtils.h"
 #include "nsIDocument.h"
 #include "nsIWeakReference.h"
 #include "mozilla/AbstractThread.h"
 #include "nsClassHashtable.h"
 #include "nsISupportsImpl.h"
 #include "mozilla/MozPromise.h"
 #include "GMPContentParent.h"
+#include "GMPCrashHelper.h"
 
 template <class> struct already_AddRefed;
 
 namespace mozilla {
 
 class GMPCrashHelper;
 
 extern LogModule* GetGMPLog();
--- a/dom/media/gmp/GMPUtils.cpp
+++ b/dom/media/gmp/GMPUtils.cpp
@@ -7,16 +7,19 @@
 #include "GMPUtils.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsIFile.h"
 #include "nsCOMPtr.h"
 #include "nsLiteralString.h"
 #include "nsCRTGlue.h"
 #include "mozilla/Base64.h"
 #include "nsISimpleEnumerator.h"
+#include "prio.h"
+#include "nsIConsoleService.h"
+#include "mozIGeckoMediaPluginService.h"
 
 namespace mozilla {
 
 void
 SplitAt(const char* aDelims,
         const nsACString& aInput,
         nsTArray<nsCString>& aOutTokens)
 {
@@ -209,10 +212,22 @@ HaveGMPFor(const nsCString& aAPI,
 
   bool hasPlugin = false;
   if (NS_FAILED(mps->HasPluginForAPI(aAPI, &aTags, &hasPlugin))) {
     return false;
   }
   return hasPlugin;
 }
 
+void
+LogToConsole(const nsAString& aMsg)
+{
+  nsCOMPtr<nsIConsoleService> console(
+    do_GetService("@mozilla.org/consoleservice;1"));
+  if (!console) {
+    NS_WARNING("Failed to log message to console.");
+    return;
+  }
+  nsAutoString msg(aMsg);
+  console->LogStringMessage(msg.get());
+}
 
 } // namespace mozilla
--- a/dom/media/gmp/GMPUtils.h
+++ b/dom/media/gmp/GMPUtils.h
@@ -73,11 +73,14 @@ bool
 ReadIntoString(nsIFile* aFile,
                nsCString& aOutDst,
                size_t aMaxLength);
 
 bool
 HaveGMPFor(const nsCString& aAPI,
            nsTArray<nsCString>&& aTags);
 
+void
+LogToConsole(const nsAString& aMsg);
+
 } // namespace mozilla
 
 #endif