mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-02 22:37:50 +00:00
Bug 1214967 - Proxy observer service notification across to content process when GMPs are added/removed. r=billm,jwwang
This commit is contained in:
parent
5802a627b3
commit
419cfce138
@ -195,6 +195,7 @@
|
||||
#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
|
||||
|
||||
@ -1463,6 +1464,13 @@ 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,6 +287,8 @@ 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,6 +692,7 @@ static const char* sObserverTopics[] = {
|
||||
"profiler-subprocess-gather",
|
||||
"profiler-subprocess",
|
||||
#endif
|
||||
"gmp-changed",
|
||||
};
|
||||
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
@ -3293,6 +3294,9 @@ ContentParent::Observe(nsISupports* aSubject,
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcmp(aTopic, "gmp-changed")) {
|
||||
unused << SendNotifyGMPsChanged();
|
||||
}
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -677,6 +677,11 @@ 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,6 +42,7 @@
|
||||
#include "nsPrintfCString.h"
|
||||
#endif
|
||||
#include "nsIXULRuntime.h"
|
||||
#include "GMPDecoderModule.h"
|
||||
#include <limits>
|
||||
|
||||
namespace mozilla {
|
||||
@ -700,6 +701,27 @@ 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()
|
||||
{
|
||||
@ -710,6 +732,14 @@ 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;
|
||||
}
|
||||
|
||||
@ -935,27 +965,6 @@ 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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user