mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-27 12:15:33 +00:00
Bug 1155939 - GMPServiceParent fixes for GMP deletion - r=cpearce
This commit is contained in:
parent
b67d865b08
commit
a6f18578e9
@ -737,6 +737,11 @@ GeckoMediaPluginServiceParent::RemoveOnGMPThread(const nsAString& aDirectory,
|
||||
return;
|
||||
}
|
||||
|
||||
// Plugin destruction can modify |mPlugins|. Put them aside for now and
|
||||
// destroy them once we're done with |mPlugins|.
|
||||
nsTArray<nsRefPtr<GMPParent>> deadPlugins;
|
||||
|
||||
bool inUse = false;
|
||||
MutexAutoLock lock(mMutex);
|
||||
for (size_t i = mPlugins.Length() - 1; i < mPlugins.Length(); i--) {
|
||||
nsCOMPtr<nsIFile> pluginpath = mPlugins[i]->GetDirectory();
|
||||
@ -749,6 +754,7 @@ GeckoMediaPluginServiceParent::RemoveOnGMPThread(const nsAString& aDirectory,
|
||||
if (aDeleteFromDisk && gmp->State() != GMPStateNotLoaded) {
|
||||
// We have to wait for the child process to release its lib handle
|
||||
// before we can delete the GMP.
|
||||
inUse = true;
|
||||
gmp->MarkForDeletion();
|
||||
|
||||
if (!mPluginsWaitingForDeletion.Contains(aDirectory)) {
|
||||
@ -758,13 +764,20 @@ GeckoMediaPluginServiceParent::RemoveOnGMPThread(const nsAString& aDirectory,
|
||||
|
||||
if (gmp->State() == GMPStateNotLoaded || !aCanDefer) {
|
||||
// GMP not in use or shutdown is being forced; can shut it down now.
|
||||
gmp->AbortAsyncShutdown();
|
||||
gmp->CloseActive(true);
|
||||
deadPlugins.AppendElement(gmp);
|
||||
mPlugins.RemoveElementAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (aDeleteFromDisk) {
|
||||
{
|
||||
MutexAutoUnlock unlock(mMutex);
|
||||
for (auto& gmp : deadPlugins) {
|
||||
gmp->AbortAsyncShutdown();
|
||||
gmp->CloseActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (aDeleteFromDisk && !inUse) {
|
||||
if (NS_SUCCEEDED(directory->Remove(true))) {
|
||||
mPluginsWaitingForDeletion.RemoveElement(aDirectory);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user