зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1504531 - P1. Use forward references in MozPromiseHolder. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D10833 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
42e2aee566
Коммит
6f99745b62
|
@ -820,7 +820,8 @@ void
|
|||
ChromiumCDMParent::ReorderAndReturnOutput(RefPtr<VideoData>&& aFrame)
|
||||
{
|
||||
if (mMaxRefFrames == 0) {
|
||||
mDecodePromise.ResolveIfExists({ std::move(aFrame) }, __func__);
|
||||
mDecodePromise.ResolveIfExists(
|
||||
MediaDataDecoder::DecodedData({ std::move(aFrame) }), __func__);
|
||||
return;
|
||||
}
|
||||
mReorderQueue.Push(std::move(aFrame));
|
||||
|
|
|
@ -1216,75 +1216,43 @@ public:
|
|||
return mPromise.forget();
|
||||
}
|
||||
|
||||
void Resolve(const typename PromiseType::ResolveValueType& aResolveValue,
|
||||
const char* aMethodName)
|
||||
template<typename ResolveValueType_>
|
||||
void Resolve(ResolveValueType_&& aResolveValue, const char* aMethodName)
|
||||
{
|
||||
if (mMonitor) {
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
}
|
||||
MOZ_ASSERT(mPromise);
|
||||
mPromise->Resolve(aResolveValue, aMethodName);
|
||||
mPromise = nullptr;
|
||||
}
|
||||
void Resolve(typename PromiseType::ResolveValueType&& aResolveValue,
|
||||
const char* aMethodName)
|
||||
{
|
||||
if (mMonitor) {
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
}
|
||||
MOZ_ASSERT(mPromise);
|
||||
mPromise->Resolve(std::move(aResolveValue), aMethodName);
|
||||
mPromise->Resolve(std::forward<ResolveValueType_>(aResolveValue),
|
||||
aMethodName);
|
||||
mPromise = nullptr;
|
||||
}
|
||||
|
||||
void ResolveIfExists(const typename PromiseType::ResolveValueType& aResolveValue,
|
||||
template<typename ResolveValueType_>
|
||||
void ResolveIfExists(ResolveValueType_&& aResolveValue,
|
||||
const char* aMethodName)
|
||||
{
|
||||
if (!IsEmpty()) {
|
||||
Resolve(aResolveValue, aMethodName);
|
||||
}
|
||||
}
|
||||
void ResolveIfExists(typename PromiseType::ResolveValueType&& aResolveValue,
|
||||
const char* aMethodName)
|
||||
{
|
||||
if (!IsEmpty()) {
|
||||
Resolve(std::move(aResolveValue), aMethodName);
|
||||
Resolve(std::forward<ResolveValueType_>(aResolveValue), aMethodName);
|
||||
}
|
||||
}
|
||||
|
||||
void Reject(const typename PromiseType::RejectValueType& aRejectValue,
|
||||
const char* aMethodName)
|
||||
template<typename RejectValueType_>
|
||||
void Reject(RejectValueType_&& aRejectValue, const char* aMethodName)
|
||||
{
|
||||
if (mMonitor) {
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
}
|
||||
MOZ_ASSERT(mPromise);
|
||||
mPromise->Reject(aRejectValue, aMethodName);
|
||||
mPromise = nullptr;
|
||||
}
|
||||
void Reject(typename PromiseType::RejectValueType&& aRejectValue,
|
||||
const char* aMethodName)
|
||||
{
|
||||
if (mMonitor) {
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
}
|
||||
MOZ_ASSERT(mPromise);
|
||||
mPromise->Reject(std::move(aRejectValue), aMethodName);
|
||||
mPromise->Reject(std::forward<RejectValueType_>(aRejectValue), aMethodName);
|
||||
mPromise = nullptr;
|
||||
}
|
||||
|
||||
void RejectIfExists(const typename PromiseType::RejectValueType& aRejectValue,
|
||||
const char* aMethodName)
|
||||
template<typename RejectValueType_>
|
||||
void RejectIfExists(RejectValueType_&& aRejectValue, const char* aMethodName)
|
||||
{
|
||||
if (!IsEmpty()) {
|
||||
Reject(aRejectValue, aMethodName);
|
||||
}
|
||||
}
|
||||
void RejectIfExists(typename PromiseType::RejectValueType&& aRejectValue,
|
||||
const char* aMethodName)
|
||||
{
|
||||
if (!IsEmpty()) {
|
||||
Reject(std::move(aRejectValue), aMethodName);
|
||||
Reject(std::forward<RejectValueType_>(aRejectValue), aMethodName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче