Back out 2 changesets (bug 1214967) for b2g debug mochitest-14 hangs, or perhaps fatal assertions failing to be fatal until a hang, or summat

CLOSED TREE

Backed out changeset 120b53ea0f41 (bug 1214967)
Backed out changeset af6b752acbd0 (bug 1214967)
This commit is contained in:
Phil Ringnalda 2015-10-16 20:26:20 -07:00
Родитель 65c005fc8d
Коммит 915c3cb404
7 изменённых файлов: 46 добавлений и 147 удалений

Просмотреть файл

@ -195,7 +195,6 @@
#include "mozilla/widget/PuppetBidiKeyboard.h"
#include "mozilla/RemoteSpellCheckEngineChild.h"
#include "GMPServiceChild.h"
#include "GMPDecoderModule.h"
#include "gfxPlatform.h"
#include "nscore.h" // for NS_FREE_PERMANENT_DATA
@ -1464,13 +1463,6 @@ ContentChild::RecvNotifyPresentationReceiverCleanUp(const nsString& aSessionId)
return true;
}
bool
ContentChild::RecvNotifyGMPsChanged()
{
GMPDecoderModule::UpdateUsableCodecs();
return true;
}
PCrashReporterChild*
ContentChild::AllocPCrashReporterChild(const mozilla::dom::NativeThreadId& id,
const uint32_t& processType)

Просмотреть файл

@ -287,8 +287,6 @@ public:
const nsString& aSessionId) override;
virtual bool RecvNotifyPresentationReceiverCleanUp(const nsString& aSessionId) override;
virtual bool RecvNotifyGMPsChanged() override;
virtual PSpeechSynthesisChild* AllocPSpeechSynthesisChild() override;
virtual bool DeallocPSpeechSynthesisChild(PSpeechSynthesisChild* aActor) override;

Просмотреть файл

@ -692,7 +692,6 @@ static const char* sObserverTopics[] = {
"profiler-subprocess-gather",
"profiler-subprocess",
#endif
"gmp-changed",
};
#ifdef MOZ_NUWA_PROCESS
@ -3294,9 +3293,6 @@ ContentParent::Observe(nsISupports* aSubject,
}
}
}
else if (!strcmp(aTopic, "gmp-changed")) {
unused << SendNotifyGMPsChanged();
}
#endif
return NS_OK;
}

Просмотреть файл

@ -677,11 +677,6 @@ child:
*/
async NotifyPresentationReceiverCleanUp(nsString aSessionId);
/**
* Notify the child that the Gecko Media Plugins installed changed.
*/
async NotifyGMPsChanged();
parent:
/**
* Tell the content process some attributes of itself. This is

Просмотреть файл

@ -42,7 +42,6 @@
#include "nsPrintfCString.h"
#endif
#include "nsIXULRuntime.h"
#include "GMPDecoderModule.h"
#include <limits>
namespace mozilla {
@ -701,27 +700,6 @@ GeckoMediaPluginServiceParent::LoadFromEnvironment()
mScannedPluginOnDisk = true;
}
class NotifyObserversTask final : public nsRunnable {
public:
explicit NotifyObserversTask(const char* aTopic, nsString aData = EmptyString())
: mTopic(aTopic)
, mData(aData)
{}
NS_IMETHOD Run() override {
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIObserverService> obsService = mozilla::services::GetObserverService();
MOZ_ASSERT(obsService);
if (obsService) {
obsService->NotifyObservers(nullptr, mTopic, mData.get());
}
return NS_OK;
}
private:
~NotifyObserversTask() {}
const char* mTopic;
const nsString mData;
};
NS_IMETHODIMP
GeckoMediaPluginServiceParent::PathRunnable::Run()
{
@ -732,14 +710,6 @@ GeckoMediaPluginServiceParent::PathRunnable::Run()
mOperation == REMOVE_AND_DELETE_FROM_DISK,
mDefer);
}
// For e10s, we must fire a notification so that all ContentParents notify
// their children to update the codecs that the GMPDecoderModule can use.
NS_DispatchToMainThread(new NotifyObserversTask("gmp-changed"), NS_DISPATCH_NORMAL);
// For non-e10s, and for decoding in the chrome process, must update GMP
// PDM's codecs list directly.
NS_DispatchToMainThread(NS_NewRunnableFunction([]() -> void {
GMPDecoderModule::UpdateUsableCodecs();
}));
return NS_OK;
}
@ -965,6 +935,27 @@ GeckoMediaPluginServiceParent::ClonePlugin(const GMPParent* aOriginal)
return gmp.get();
}
class NotifyObserversTask final : public nsRunnable {
public:
explicit NotifyObserversTask(const char* aTopic, nsString aData = EmptyString())
: mTopic(aTopic)
, mData(aData)
{}
NS_IMETHOD Run() override {
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIObserverService> obsService = mozilla::services::GetObserverService();
MOZ_ASSERT(obsService);
if (obsService) {
obsService->NotifyObservers(nullptr, mTopic, mData.get());
}
return NS_OK;
}
private:
~NotifyObserversTask() {}
const char* mTopic;
const nsString mData;
};
void
GeckoMediaPluginServiceParent::AddOnGMPThread(const nsAString& aDirectory)
{

Просмотреть файл

@ -11,12 +11,8 @@
#include "mozIGeckoMediaPluginService.h"
#include "nsServiceManagerUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/StaticMutex.h"
#include "gmp-audio-decode.h"
#include "gmp-video-decode.h"
#ifdef XP_WIN
#include "WMFDecoderModule.h"
#endif
namespace mozilla {
@ -93,71 +89,6 @@ GMPDecoderModule::DecoderNeedsConversion(const TrackInfo& aConfig) const
}
}
static bool
HasGMPFor(const nsACString& aAPI,
const nsACString& aCodec,
const nsACString& aGMP)
{
MOZ_ASSERT(NS_IsMainThread());
#ifdef XP_WIN
// gmp-clearkey uses WMF for decoding, so if we're using clearkey we must
// verify that WMF works before continuing.
if (aGMP.EqualsLiteral("org.w3.clearkey")) {
nsRefPtr<WMFDecoderModule> pdm(new WMFDecoderModule());
if (aCodec.EqualsLiteral("aac") &&
!pdm->SupportsMimeType(NS_LITERAL_CSTRING("audio/mp4a-latm"))) {
return false;
}
if (aCodec.EqualsLiteral("h264") &&
!pdm->SupportsMimeType(NS_LITERAL_CSTRING("video/avc"))) {
return false;
}
}
#endif
nsTArray<nsCString> tags;
tags.AppendElement(aCodec);
tags.AppendElement(aGMP);
nsCOMPtr<mozIGeckoMediaPluginService> mps =
do_GetService("@mozilla.org/gecko-media-plugin-service;1");
if (NS_WARN_IF(!mps)) {
return false;
}
bool hasPlugin = false;
if (NS_FAILED(mps->HasPluginForAPI(aAPI, &tags, &hasPlugin))) {
return false;
}
return hasPlugin;
}
StaticMutex sGMPCodecsMutex;
struct GMPCodecs {
const char* mKeySystem;
bool mHasAAC;
bool mHasH264;
};
static GMPCodecs sGMPCodecs[] = {
{ "org.w3.clearkey", false, false },
{ "com.adobe.primetime", false, false },
};
void
GMPDecoderModule::UpdateUsableCodecs()
{
MOZ_ASSERT(NS_IsMainThread());
StaticMutexAutoLock lock(sGMPCodecsMutex);
for (GMPCodecs& gmp : sGMPCodecs) {
gmp.mHasAAC = HasGMPFor(NS_LITERAL_CSTRING(GMP_API_AUDIO_DECODER),
NS_LITERAL_CSTRING("aac"),
nsDependentCString(gmp.mKeySystem));
gmp.mHasH264 = HasGMPFor(NS_LITERAL_CSTRING(GMP_API_VIDEO_DECODER),
NS_LITERAL_CSTRING("h264"),
nsDependentCString(gmp.mKeySystem));
}
}
static uint32_t sPreferredAacGmp = 0;
static uint32_t sPreferredH264Gmp = 0;
@ -165,13 +96,6 @@ static uint32_t sPreferredH264Gmp = 0;
void
GMPDecoderModule::Init()
{
MOZ_ASSERT(NS_IsMainThread());
// GMPService::HasPluginForAPI is main thread only, so to implement
// SupportsMimeType() we build a table of the codecs which each whitelisted
// GMP has and update it when any GMPs are removed or added at runtime.
UpdateUsableCodecs();
Preferences::AddUintVarCache(&sPreferredAacGmp,
"media.gmp.decoder.aac", 0);
Preferences::AddUintVarCache(&sPreferredH264Gmp,
@ -191,8 +115,7 @@ GMPDecoderModule::PreferredGMP(const nsACString& aMimeType)
}
}
if (aMimeType.EqualsLiteral("video/avc") ||
aMimeType.EqualsLiteral("video/mp4")) {
if (aMimeType.EqualsLiteral("video/avc")) {
switch (sPreferredH264Gmp) {
case 1: rv.emplace(NS_LITERAL_CSTRING("org.w3.clearkey")); break;
case 2: rv.emplace(NS_LITERAL_CSTRING("com.adobe.primetime")); break;
@ -203,28 +126,35 @@ GMPDecoderModule::PreferredGMP(const nsACString& aMimeType)
return rv;
}
/* static */
bool
GMPDecoderModule::SupportsMimeType(const nsACString& aMimeType,
const Maybe<nsCString>& aGMP)
{
const bool isAAC = aMimeType.EqualsLiteral("audio/mp4a-latm");
const bool isH264 = aMimeType.EqualsLiteral("video/avc") ||
aMimeType.EqualsLiteral("video/mp4");
StaticMutexAutoLock lock(sGMPCodecsMutex);
for (GMPCodecs& gmp : sGMPCodecs) {
if (isAAC && gmp.mHasAAC &&
(aGMP.isNothing() || aGMP.value().EqualsASCII(gmp.mKeySystem))) {
return true;
}
if (isH264 && gmp.mHasH264 &&
(aGMP.isNothing() || aGMP.value().EqualsASCII(gmp.mKeySystem))) {
return true;
}
nsTArray<nsCString> tags;
nsCString api;
if (aMimeType.EqualsLiteral("audio/mp4a-latm")) {
tags.AppendElement(NS_LITERAL_CSTRING("aac"));
api = NS_LITERAL_CSTRING(GMP_API_AUDIO_DECODER);
} else if (aMimeType.EqualsLiteral("video/avc") ||
aMimeType.EqualsLiteral("video/mp4")) {
tags.AppendElement(NS_LITERAL_CSTRING("h264"));
api = NS_LITERAL_CSTRING(GMP_API_VIDEO_DECODER);
} else {
return false;
}
return false;
if (aGMP.isSome()) {
tags.AppendElement(aGMP.value());
}
nsCOMPtr<mozIGeckoMediaPluginService> mps =
do_GetService("@mozilla.org/gecko-media-plugin-service;1");
if (NS_WARN_IF(!mps)) {
return false;
}
bool hasPlugin = false;
if (NS_FAILED(mps->HasPluginForAPI(api, &tags, &hasPlugin))) {
return false;
}
return hasPlugin;
}
bool

Просмотреть файл

@ -38,7 +38,6 @@ public:
bool
SupportsMimeType(const nsACString& aMimeType) override;
// Main thread only.
static void Init();
static const Maybe<nsCString> PreferredGMP(const nsACString& aMimeType);
@ -46,8 +45,6 @@ public:
static bool SupportsMimeType(const nsACString& aMimeType,
const Maybe<nsCString>& aGMP);
// Main thread only.
static void UpdateUsableCodecs();
};
} // namespace mozilla