Bug 1263951 - Avoid trying to initialize new GMP instances once the browser enters shutdown. r=cpearce

MozReview-Commit-ID: G6ND2LyT0tp
This commit is contained in:
Jim Mathies 2016-04-26 12:11:26 -05:00
parent df49eace0b
commit 86d8f2f66f
4 changed files with 25 additions and 5 deletions

View File

@ -72,10 +72,11 @@ public:
base::ProcessId otherProcess;
nsCString displayName;
uint32_t pluginId;
nsresult rv;
bool ok = aGMPServiceChild->SendLoadGMP(mNodeId, mAPI, mTags,
alreadyBridgedTo, &otherProcess,
&displayName, &pluginId);
if (!ok) {
&displayName, &pluginId, &rv);
if (!ok && rv == NS_ERROR_ILLEGAL_DURING_SHUTDOWN) {
mCallback->Done(nullptr);
return;
}

View File

@ -685,6 +685,13 @@ GeckoMediaPluginServiceParent::NotifySyncShutdownComplete()
mWaitingForPluginsSyncShutdown = false;
}
bool
GeckoMediaPluginServiceParent::IsShuttingDown()
{
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
return mShuttingDownOnGMPThread;
}
void
GeckoMediaPluginServiceParent::UnloadPlugins()
{
@ -1785,8 +1792,15 @@ GMPServiceParent::RecvLoadGMP(const nsCString& aNodeId,
nsTArray<ProcessId>&& aAlreadyBridgedTo,
ProcessId* aId,
nsCString* aDisplayName,
uint32_t* aPluginId)
uint32_t* aPluginId,
nsresult* aRv)
{
*aRv = NS_OK;
if (mService->IsShuttingDown()) {
*aRv = NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
return true;
}
RefPtr<GMPParent> gmp = mService->SelectPluginForAPI(aNodeId, aAPI, aTags);
nsCString api = aTags[0];

View File

@ -59,6 +59,9 @@ public:
RefPtr<GenericPromise> EnsureInitialized();
RefPtr<GenericPromise> AsyncAddPluginDirectory(const nsAString& aDirectory);
// GMP thread access only
bool IsShuttingDown();
private:
friend class GMPServiceParent;
@ -221,7 +224,8 @@ public:
nsTArray<ProcessId>&& aAlreadyBridgedTo,
base::ProcessId* aID,
nsCString* aDisplayName,
uint32_t* aPluginId) override;
uint32_t* aPluginId,
nsresult* aRv) override;
bool RecvGetGMPNodeId(const nsString& aOrigin,
const nsString& aTopLevelOrigin,
const nsString& aGMPName,

View File

@ -17,7 +17,8 @@ sync protocol PGMPService
parent:
sync LoadGMP(nsCString nodeId, nsCString api, nsCString[] tags,
ProcessId[] alreadyBridgedTo)
returns (ProcessId id, nsCString displayName, uint32_t pluginId);
returns (ProcessId id, nsCString displayName, uint32_t pluginId,
nsresult aResult);
sync GetGMPNodeId(nsString origin, nsString topLevelOrigin,
nsString gmpName,
bool inPrivateBrowsing)