In the media code, we queue a lot of tasks to be run later once a previous task has completed. We currently do this with the use of CompletionHandler but this becomes cumbersome once more than two tasks are still pending. This is particularly visible if we want to fix bug 254079. The alternative is to keep queues of operations to run. Mozilla successfully implemented MozPromise which became thoroughly used in their code. It makes for easy to ready asynchronous code and remove all guesses on which thread a completion task may run. Which should have a similar object. We could then do promise1->then(thread, []() { taskToRun1(); })->then(thread, []() { taskToRun2(); })
<rdar://problem/107546076>
Pull request: https://github.com/WebKit/WebKit/pull/17344
Renamed as per Youenn's suggestion.
Committed 268120@main (a53ad484a1c9): <https://commits.webkit.org/268120@main> Reviewed commits have been landed. Closing PR #17344 and removing active labels.