Bug 1328130. Part 3 - remove unused functions and fix comments.
MozReview-Commit-ID: JURmHasmhOU
--- a/xpcom/threads/MozPromise.h
+++ b/xpcom/threads/MozPromise.h
@@ -690,19 +690,18 @@ public:
mThenValues.AppendElement(aThenValue);
}
}
private:
/*
* A command object to store all information needed to make a request to
* the promise. This allows us to delay the request until further use is
- * known (whether it is ->Then() again for more promise chaining or passed
- * to MozPromiseRequestHolder::Begin() to terminate chaining and issue
- * the request).
+ * known (whether it is ->Then() again for more promise chaining or ->Track()
+ * to terminate chaining and issue the request).
*
* This allows a unified syntax for promise chaining and disconnection
* and feels more like its JS counterpart.
*/
class ThenCommand
{
friend class MozPromise;
@@ -721,24 +720,16 @@ private:
~ThenCommand()
{
// Issue the request now if the return value of Then() is not used.
if (mThenValue) {
mReceiver->ThenInternal(mResponseThread, mThenValue, mCallSite);
}
}
- // Allow passing Then() to MozPromiseRequestHolder::Begin().
- operator RefPtr<Request>()
- {
- RefPtr<ThenValueBase> thenValue = mThenValue.forget();
- mReceiver->ThenInternal(mResponseThread, thenValue, mCallSite);
- return thenValue.forget();
- }
-
// Allow RefPtr<MozPromise> p = somePromise->Then();
// p->Then(thread1, ...);
// p->Then(thread2, ...);
operator RefPtr<MozPromise>()
{
RefPtr<ThenValueBase> thenValue = mThenValue.forget();
// mCompletionPromise must be created before ThenInternal() to avoid race.
RefPtr<MozPromise> p = new MozPromise::Private(
@@ -754,17 +745,19 @@ private:
auto Then(Ts&&... aArgs)
-> decltype(DeclVal<MozPromise>().Then(Forward<Ts>(aArgs)...))
{
return static_cast<RefPtr<MozPromise>>(*this)->Then(Forward<Ts>(aArgs)...);
}
void Track(MozPromiseRequestHolder<MozPromise>& aRequestHolder)
{
- aRequestHolder.Track(*this);
+ RefPtr<ThenValueBase> thenValue = mThenValue.forget();
+ mReceiver->ThenInternal(mResponseThread, thenValue, mCallSite);
+ aRequestHolder.Track(thenValue.forget());
}
// Allow calling ->Then() again for more promise chaining or ->Track() to
// end chaining and track the request for future disconnection.
ThenCommand* operator->()
{
return this;
}