mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1504531 - P2. Add MozPromiseHolder::ResolveOrReject methods. r=gerald
Depends on D10833 Differential Revision: https://phabricator.services.mozilla.com/D10834 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
6f99745b62
commit
91dbdb0a68
@ -1256,6 +1256,29 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
template<typename ResolveOrRejectValueType_>
|
||||
void ResolveOrReject(ResolveOrRejectValueType_&& aValue,
|
||||
const char* aMethodName)
|
||||
{
|
||||
if (mMonitor) {
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
}
|
||||
MOZ_ASSERT(mPromise);
|
||||
mPromise->ResolveOrReject(std::forward<ResolveOrRejectValueType_>(aValue),
|
||||
aMethodName);
|
||||
mPromise = nullptr;
|
||||
}
|
||||
|
||||
template<typename ResolveOrRejectValueType_>
|
||||
void ResolveOrRejectIfExists(ResolveOrRejectValueType_&& aValue,
|
||||
const char* aMethodName)
|
||||
{
|
||||
if (!IsEmpty()) {
|
||||
ResolveOrReject(std::forward<ResolveOrRejectValueType_>(aValue),
|
||||
aMethodName);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Monitor* mMonitor;
|
||||
RefPtr<typename PromiseType::Private> mPromise;
|
||||
|
Loading…
Reference in New Issue
Block a user