зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1510265 - P2. Don't use AllPromiseType in GMPServiceParent. r=gerald
It's not needed, and only makes code harder to follow. Differential Revision: https://phabricator.services.mozilla.com/D13869 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
44594dd77a
Коммит
a3f78d31a5
|
@ -486,26 +486,22 @@ void GeckoMediaPluginServiceParent::CrashPlugins() {
|
|||
}
|
||||
}
|
||||
|
||||
RefPtr<GenericPromise::AllPromiseType>
|
||||
GeckoMediaPluginServiceParent::LoadFromEnvironment() {
|
||||
RefPtr<GenericPromise> GeckoMediaPluginServiceParent::LoadFromEnvironment() {
|
||||
MOZ_ASSERT(mGMPThread->EventTarget()->IsOnCurrentThread());
|
||||
RefPtr<AbstractThread> thread(GetAbstractGMPThread());
|
||||
if (!thread) {
|
||||
return GenericPromise::AllPromiseType::CreateAndReject(NS_ERROR_FAILURE,
|
||||
__func__);
|
||||
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||
}
|
||||
|
||||
const char* env = PR_GetEnv("MOZ_GMP_PATH");
|
||||
if (!env || !*env) {
|
||||
return GenericPromise::AllPromiseType::CreateAndResolve(
|
||||
nsTArray<bool>{true}, __func__);
|
||||
return GenericPromise::CreateAndResolve(true, __func__);
|
||||
}
|
||||
|
||||
nsString allpaths;
|
||||
if (NS_WARN_IF(NS_FAILED(
|
||||
NS_CopyNativeToUnicode(nsDependentCString(env), allpaths)))) {
|
||||
return GenericPromise::AllPromiseType::CreateAndReject(NS_ERROR_FAILURE,
|
||||
__func__);
|
||||
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||
}
|
||||
|
||||
nsTArray<RefPtr<GenericPromise>> promises;
|
||||
|
@ -526,7 +522,13 @@ GeckoMediaPluginServiceParent::LoadFromEnvironment() {
|
|||
}
|
||||
|
||||
mScannedPluginOnDisk = true;
|
||||
return GenericPromise::All(thread, promises);
|
||||
return GenericPromise::All(thread, promises)
|
||||
->Then(thread, __func__,
|
||||
[]() { return GenericPromise::CreateAndResolve(true, __func__); },
|
||||
[]() {
|
||||
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE,
|
||||
__func__);
|
||||
});
|
||||
}
|
||||
|
||||
class NotifyObserversTask final : public mozilla::Runnable {
|
||||
|
|
|
@ -114,7 +114,7 @@ class GeckoMediaPluginServiceParent final
|
|||
void ReAddOnGMPThread(const RefPtr<GMPParent>& aOld);
|
||||
void PluginTerminated(const RefPtr<GMPParent>& aOld);
|
||||
void InitializePlugins(AbstractThread* aAbstractGMPThread) override;
|
||||
RefPtr<GenericPromise::AllPromiseType> LoadFromEnvironment();
|
||||
RefPtr<GenericPromise> LoadFromEnvironment();
|
||||
RefPtr<GenericPromise> AddOnGMPThread(nsString aDirectory);
|
||||
|
||||
virtual RefPtr<GetGMPContentParentPromise> GetContentParent(
|
||||
|
|
Загрузка…
Ссылка в новой задаче