Bug 1592488 - P12. Run MozPromise's IPDL callbacks via direct tasks when the promise is resolved. r=nika

Fix intermittent issues due to races.

We now run the MozPromise generated by the IPDL bindings to run their callbacks via a direct task dispatch.
This avoids a full trip to the back of the event queue for each additional asynchronous step when using MozPromise.
A consequence to this change is that each IPDL actor's thread must have an AbstractThread allocated if IPDL MozPromises are used.

It prevents unexpected racy behaviours when combining MozPromise with the other Resolve/Reject IPDL async declaration which was have lead to processing the events out of order.

Differential Revision: https://phabricator.services.mozilla.com/D71593
This commit is contained in:
Jean-Yves Avenard 2020-05-12 10:45:20 +00:00
parent 4738ae3ddd
commit 4e734f2a51

View File

@ -4873,6 +4873,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
stmt = StmtCode(
'''
RefPtr<${promise}> promise__ = new ${promise}(__func__);
promise__->UseDirectTaskDispatch(__func__);
${send}($,{args});
return promise__;
''',