Bug 1315850 - Add GetGMPAbstractThread() to GMPUtils.h. r=gerald
MozReview-Commit-ID: G4sq6pa7jmS
--- 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