Bug 1108767 - Add MediaPromise::{Resolve,Reject}IfExists. r=cpearce

This commit is contained in:
Bobby Holley 2014-12-08 17:19:05 -08:00
parent 72252dd9bc
commit e9cb8ab7de

View File

@ -316,6 +316,14 @@ public:
mPromise = nullptr;
}
void ResolveIfExists(typename PromiseType::ResolveValueType aResolveValue,
const char* aMethodName)
{
if (!IsEmpty()) {
Resolve(aResolveValue, aMethodName);
}
}
void Reject(typename PromiseType::RejectValueType aRejectValue,
const char* aMethodName)
{
@ -327,6 +335,14 @@ public:
mPromise = nullptr;
}
void RejectIfExists(typename PromiseType::RejectValueType aRejectValue,
const char* aMethodName)
{
if (!IsEmpty()) {
Reject(aRejectValue, aMethodName);
}
}
private:
Monitor* mMonitor;
nsRefPtr<PromiseType> mPromise;