Bug 1315850 - Add GetGMPAbstractThread() to GMPUtils.h. r=gerald draft
authorChris Pearce <cpearce@mozilla.com>
Thu, 23 Feb 2017 14:04:25 +1300
changeset 504158 94dacb5107e7f098c7dde88e6d246edb9deb6a35
parent 504157 dd262cc875ece0d82b4af002341ee0566125a401
child 504159 df41a20a0fefaf26a63ed18f1ccdf7fa5a3a1e89
push id50748
push userbmo:cpearce@mozilla.com
push dateFri, 24 Mar 2017 01:10:17 +0000
reviewersgerald
bugs1315850
milestone55.0a1
Bug 1315850 - Add GetGMPAbstractThread() to GMPUtils.h. r=gerald MozReview-Commit-ID: G4sq6pa7jmS
dom/media/gmp/GMPUtils.cpp
dom/media/gmp/GMPUtils.h
--- a/dom/media/gmp/GMPUtils.cpp
+++ b/dom/media/gmp/GMPUtils.cpp
@@ -10,16 +10,17 @@
 #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"
+#include "GMPService.h"
 
 namespace mozilla {
 
 void
 SplitAt(const char* aDelims,
         const nsACString& aInput,
         nsTArray<nsCString>& aOutTokens)
 {
@@ -225,9 +226,17 @@ LogToConsole(const nsAString& aMsg)
   if (!console) {
     NS_WARNING("Failed to log message to console.");
     return;
   }
   nsAutoString msg(aMsg);
   console->LogStringMessage(msg.get());
 }
 
+RefPtr<AbstractThread>
+GetGMPAbstractThread()
+{
+  RefPtr<gmp::GeckoMediaPluginService> service =
+    gmp::GeckoMediaPluginService::GetGeckoMediaPluginService();
+  return service ? service->GetAbstractGMPThread() : nullptr;
+}
+
 } // namespace mozilla
--- a/dom/media/gmp/GMPUtils.h
+++ b/dom/media/gmp/GMPUtils.h
@@ -2,16 +2,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GMPUtils_h_
 #define GMPUtils_h_
 
 #include "mozilla/UniquePtr.h"
+#include "mozilla/RefPtr.h"
+#include "mozilla/AbstractThread.h"
 #include "nsTArray.h"
 #include "nsCOMPtr.h"
 #include "nsClassHashtable.h"
 
 #define CHROMIUM_CDM_API "chromium-cdm8-host4"
 
 class nsIFile;
 class nsCString;
@@ -78,11 +80,14 @@ ReadIntoString(nsIFile* aFile,
 
 bool
 HaveGMPFor(const nsCString& aAPI,
            nsTArray<nsCString>&& aTags);
 
 void
 LogToConsole(const nsAString& aMsg);
 
+RefPtr<AbstractThread>
+GetGMPAbstractThread();
+
 } // namespace mozilla
 
 #endif