Bug 1245789 - Send name of GMPAdapter over to GMP process in StartPlugin message. r=gerald

This lets the GMPChild know whether it needs to instantiate the WidevineAdapter.

MozReview-Commit-ID: 5X6IrRZPHdu
This commit is contained in:
Chris Pearce 2016-04-12 16:12:21 +12:00
parent c4ed00c030
commit f744c99d0c
5 changed files with 12 additions and 5 deletions

View File

@ -21,6 +21,7 @@
#include "mozilla/dom/CrashReporterChild.h"
#include "GMPUtils.h"
#include "prio.h"
#include "widevine-adapter/WidevineAdapter.h"
using mozilla::dom::CrashReporterChild;
@ -345,7 +346,7 @@ GMPChild::GetUTF8LibPath(nsACString& aOutLibPath)
}
bool
GMPChild::AnswerStartPlugin()
GMPChild::AnswerStartPlugin(const nsString& aAdapter)
{
LOGD("%s", __FUNCTION__);
@ -378,11 +379,14 @@ GMPChild::AnswerStartPlugin()
}
#endif
GMPAdapter* adapter = aAdapter.EqualsLiteral("widevine")
? new WidevineAdapter() : nullptr;
if (!mGMPLoader->Load(libPath.get(),
libPath.Length(),
mNodeId.BeginWriting(),
mNodeId.Length(),
platformAPI)) {
platformAPI,
adapter)) {
NS_WARNING("Failed to load GMP");
delete platformAPI;
return false;

View File

@ -53,7 +53,7 @@ private:
bool GetUTF8LibPath(nsACString& aOutLibPath);
bool RecvSetNodeId(const nsCString& aNodeId) override;
bool AnswerStartPlugin() override;
bool AnswerStartPlugin(const nsString& aAdapter) override;
bool RecvPreloadLibs(const nsCString& aLibs) override;
PCrashReporterChild* AllocPCrashReporterChild(const NativeThreadId& aThread) override;

View File

@ -95,6 +95,7 @@ GMPParent::CloneFrom(const GMPParent* aOther)
for (const GMPCapability& cap : aOther->mCapabilities) {
mCapabilities.AppendElement(cap);
}
mAdapter = aOther->mAdapter;
return NS_OK;
}
@ -190,7 +191,7 @@ GMPParent::LoadProcess()
#endif
// Intr call to block initialization on plugin load.
ok = CallStartPlugin();
ok = CallStartPlugin(mAdapter);
if (!ok) {
LOGD("%s: Failed to send start to child process", __FUNCTION__);
return NS_ERROR_FAILURE;
@ -941,6 +942,7 @@ GMPParent::ParseChromiumManifest(nsString aJSON)
mCapabilities.AppendElement(Move(decrypt));
MOZ_ASSERT(mName.EqualsLiteral("widevinecdm"));
mAdapter = NS_LITERAL_STRING("widevine");
#ifdef XP_WIN
mLibs = NS_LITERAL_CSTRING("dxva2.dll");
#endif

View File

@ -213,6 +213,7 @@ private:
#ifdef XP_WIN
nsCString mLibs;
#endif
nsString mAdapter;
uint32_t mPluginId;
nsTArray<GMPCapability> mCapabilities;
GMPProcessParent* mProcess;

View File

@ -34,7 +34,7 @@ parent:
child:
async BeginAsyncShutdown();
async CrashPluginNow();
intr StartPlugin();
intr StartPlugin(nsString adapter);
async SetNodeId(nsCString nodeId);
async PreloadLibs(nsCString libs);
async CloseActive();