From 755778772fadbb26b820be53fcbc1f9f91a64b8d Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Mon, 8 Dec 2014 17:19:05 -0800 Subject: [PATCH] Bug 1108767 - Add MediaPromise::{Resolve,Reject}IfExists. r=cpearce --- dom/media/MediaPromise.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dom/media/MediaPromise.h b/dom/media/MediaPromise.h index 92601fff634..a4ffc7f02d8 100644 --- a/dom/media/MediaPromise.h +++ b/dom/media/MediaPromise.h @@ -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 mPromise;