зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1352924 - Block creation of new GMPs once parent process begins shutdown. r=gerald
This ensures that when we've started shutdown we don't try to start up new GMPs. Doing so would create more connections from the content process to the main process, and the main process can't shutdown until all such connections are shut down. MozReview-Commit-ID: KE8nCoLXjdd --HG-- extra : rebase_source : 674f3c4ddcb5bb93dd775a861b425d25510871e9
This commit is contained in:
Родитель
f1b6111764
Коммит
f41e5c06d9
|
@ -293,6 +293,13 @@ GeckoMediaPluginServiceChild::UpdateGMPCapabilities(nsTArray<GMPCapabilityData>&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
GeckoMediaPluginServiceChild::BeginShutdown()
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
|
||||||
|
mShuttingDownOnGMPThread = true;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
GeckoMediaPluginServiceChild::HasPluginForAPI(const nsACString& aAPI,
|
GeckoMediaPluginServiceChild::HasPluginForAPI(const nsACString& aAPI,
|
||||||
nsTArray<nsCString>* aTags,
|
nsTArray<nsCString>* aTags,
|
||||||
|
@ -374,6 +381,13 @@ GeckoMediaPluginServiceChild::GetServiceChild()
|
||||||
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
|
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
|
||||||
|
|
||||||
if (!mServiceChild) {
|
if (!mServiceChild) {
|
||||||
|
if (mShuttingDownOnGMPThread) {
|
||||||
|
// We have begun shutdown. Don't allow a new connection to the main
|
||||||
|
// process to be instantiated. This also prevents new plugins being
|
||||||
|
// instantiated.
|
||||||
|
return GetServiceChildPromise::CreateAndReject(NS_ERROR_FAILURE,
|
||||||
|
__func__);
|
||||||
|
}
|
||||||
dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
|
dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
|
||||||
if (!contentChild) {
|
if (!contentChild) {
|
||||||
return GetServiceChildPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
return GetServiceChildPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||||
|
@ -515,5 +529,23 @@ GMPServiceChild::Create(Endpoint<PGMPServiceChild>&& aGMPService)
|
||||||
return NS_SUCCEEDED(rv);
|
return NS_SUCCEEDED(rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ipc::IPCResult
|
||||||
|
GMPServiceChild::RecvBeginShutdown()
|
||||||
|
{
|
||||||
|
RefPtr<GeckoMediaPluginServiceChild> service =
|
||||||
|
GeckoMediaPluginServiceChild::GetSingleton();
|
||||||
|
MOZ_ASSERT(service && service->mServiceChild.get() == this);
|
||||||
|
if (service) {
|
||||||
|
service->BeginShutdown();
|
||||||
|
}
|
||||||
|
return IPC_OK();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
GMPServiceChild::HaveContentParents() const
|
||||||
|
{
|
||||||
|
return mContentParents.Count() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace gmp
|
} // namespace gmp
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -42,6 +42,8 @@ public:
|
||||||
|
|
||||||
static void UpdateGMPCapabilities(nsTArray<mozilla::dom::GMPCapabilityData>&& aCapabilities);
|
static void UpdateGMPCapabilities(nsTArray<mozilla::dom::GMPCapabilityData>&& aCapabilities);
|
||||||
|
|
||||||
|
void BeginShutdown();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void InitializePlugins(AbstractThread*) override
|
void InitializePlugins(AbstractThread*) override
|
||||||
{
|
{
|
||||||
|
@ -85,6 +87,10 @@ public:
|
||||||
|
|
||||||
static bool Create(Endpoint<PGMPServiceChild>&& aGMPService);
|
static bool Create(Endpoint<PGMPServiceChild>&& aGMPService);
|
||||||
|
|
||||||
|
ipc::IPCResult RecvBeginShutdown() override;
|
||||||
|
|
||||||
|
bool HaveContentParents() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsRefPtrHashtable<nsUint64HashKey, GMPContentParent> mContentParents;
|
nsRefPtrHashtable<nsUint64HashKey, GMPContentParent> mContentParents;
|
||||||
};
|
};
|
||||||
|
|
|
@ -468,6 +468,10 @@ GeckoMediaPluginServiceParent::UnloadPlugins()
|
||||||
// Move all plugins references to a local array. This way mMutex won't be
|
// Move all plugins references to a local array. This way mMutex won't be
|
||||||
// locked when calling CloseActive (to avoid inter-locking).
|
// locked when calling CloseActive (to avoid inter-locking).
|
||||||
Swap(plugins, mPlugins);
|
Swap(plugins, mPlugins);
|
||||||
|
|
||||||
|
for (GMPServiceParent* parent : mServiceParents) {
|
||||||
|
Unused << parent->SendBeginShutdown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGD(("%s::%s plugins:%" PRIuSIZE, __CLASS__, __FUNCTION__,
|
LOGD(("%s::%s plugins:%" PRIuSIZE, __CLASS__, __FUNCTION__,
|
||||||
|
|
|
@ -36,6 +36,8 @@ parent:
|
||||||
|
|
||||||
sync GetGMPNodeId(nsString origin, nsString topLevelOrigin, nsString gmpName)
|
sync GetGMPNodeId(nsString origin, nsString topLevelOrigin, nsString gmpName)
|
||||||
returns (nsCString id);
|
returns (nsCString id);
|
||||||
|
child:
|
||||||
|
async BeginShutdown();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace gmp
|
} // namespace gmp
|
||||||
|
|
Загрузка…
Ссылка в новой задаче