--- a/xpcom/threads/MozPromise.h
+++ b/xpcom/threads/MozPromise.h
@@ -371,17 +371,17 @@ protected:
// Promise consumers are allowed to disconnect the Request object and
// then shut down the thread or task queue that the promise result would
// be dispatched on. So we unfortunately can't assert that promise
// dispatch succeeds. :-(
mResponseTarget->Dispatch(runnable.forget(), AbstractThread::DontAssertDispatchSuccess);
}
- virtual void Disconnect() override
+ void Disconnect() override
{
MOZ_ASSERT(ThenValueBase::mResponseTarget->IsCurrentThreadIn());
MOZ_DIAGNOSTIC_ASSERT(!Request::mComplete);
Request::mDisconnected = true;
// We could support rejecting the completion promise on disconnection, but
// then we'd need to have some sort of default reject value. The use cases
// of disconnection and completion promise chaining seem pretty orthogonal,
@@ -481,28 +481,28 @@ protected:
MethodThenValue(AbstractThread* aResponseTarget, ThisType* aThisVal,
ResolveMethodType aResolveMethod, RejectMethodType aRejectMethod,
const char* aCallSite)
: ThenValueBase(aResponseTarget, aCallSite)
, mThisVal(aThisVal)
, mResolveMethod(aResolveMethod)
, mRejectMethod(aRejectMethod) {}
- virtual void Disconnect() override
- {
- ThenValueBase::Disconnect();
+ void Disconnect() override
+ {
+ ThenValueBase::Disconnect();
- // If a Request has been disconnected, we don't guarantee that the
- // resolve/reject runnable will be dispatched. Null out our refcounted
- // this-value now so that it's released predictably on the dispatch thread.
- mThisVal = nullptr;
- }
+ // If a Request has been disconnected, we don't guarantee that the
+ // resolve/reject runnable will be dispatched. Null out our refcounted
+ // this-value now so that it's released predictably on the dispatch thread.
+ mThisVal = nullptr;
+ }
protected:
- virtual already_AddRefed<MozPromise> DoResolveOrRejectInternal(const ResolveOrRejectValue& aValue) override
+ already_AddRefed<MozPromise> DoResolveOrRejectInternal(const ResolveOrRejectValue& aValue) override
{
RefPtr<MozPromise> completion;
if (aValue.IsResolve()) {
completion = InvokeCallbackMethod(mThisVal.get(), mResolveMethod, aValue.ResolveValue());
} else {
completion = InvokeCallbackMethod(mThisVal.get(), mRejectMethod, aValue.RejectValue());
}
@@ -531,30 +531,30 @@ protected:
RejectFunction&& aRejectFunction,
const char* aCallSite)
: ThenValueBase(aResponseTarget, aCallSite)
{
mResolveFunction.emplace(Move(aResolveFunction));
mRejectFunction.emplace(Move(aRejectFunction));
}
- virtual void Disconnect() override
- {
- ThenValueBase::Disconnect();
+ void Disconnect() override
+ {
+ ThenValueBase::Disconnect();
- // If a Request has been disconnected, we don't guarantee that the
- // resolve/reject runnable will be dispatched. Destroy our callbacks
- // now so that any references in closures are released predictable on
- // the dispatch thread.
- mResolveFunction.reset();
- mRejectFunction.reset();
- }
+ // If a Request has been disconnected, we don't guarantee that the
+ // resolve/reject runnable will be dispatched. Destroy our callbacks
+ // now so that any references in closures are released predictable on
+ // the dispatch thread.
+ mResolveFunction.reset();
+ mRejectFunction.reset();
+ }
protected:
- virtual already_AddRefed<MozPromise> DoResolveOrRejectInternal(const ResolveOrRejectValue& aValue) override
+ already_AddRefed<MozPromise> DoResolveOrRejectInternal(const ResolveOrRejectValue& aValue) override
{
// Note: The usage of InvokeCallbackMethod here requires that
// ResolveFunction/RejectFunction are capture-lambdas (i.e. anonymous
// classes with ::operator()), since it allows us to share code more easily.
// We could fix this if need be, though it's quite easy to work around by
// just capturing something.
RefPtr<MozPromise> completion;
if (aValue.IsResolve()) {
@@ -662,17 +662,17 @@ private:
private:
AbstractThread* mResponseThread;
const char* mCallSite;
RefPtr<ThenValueBase> mThenValue;
MozPromise* mReceiver;
};
- public:
+public:
template<typename ThisType, typename ResolveMethodType, typename RejectMethodType>
ThenCommand Then(AbstractThread* aResponseThread, const char* aCallSite,
ThisType* aThisVal, ResolveMethodType aResolveMethod, RejectMethodType aRejectMethod)
{
using ThenType = MethodThenValue<ThisType, ResolveMethodType, RejectMethodType>;
RefPtr<ThenValueBase> thenValue = new ThenType(aResponseThread,
aThisVal, aResolveMethod, aRejectMethod, aCallSite);
return ThenCommand(aResponseThread, aCallSite, thenValue.forget(), this);