bddff73790
Summary: Changelog: [Internal][Added] - Introduce drainMicrotasks to JSI This diff proposed a new JSI API `drainMicrotasks` to define how hosts may integrate with the JSVMs' internal microtask queue (a.k.a. job queue) and hence their native Promise. The name `drainMicrotasks` is slightly preferred over `drainJobs` to favor *host-friendliness* over *engine-friendliness*. This diff auto implement the new API in JSC and Hermes as stubs to make sure things compiled. Please refer to the doc-comments in the `jsi.h` for a detailed documentation on the semantics and the design of this API. ### Notes on the existing APIs from JSVMs The presence of such queue and APIs to operate on them are ubiquitous: - Hermes: `Runtime::drainJobs` - V8: `MicrotaskQueue::PerformCheckpoint` - JSC: `VM::drainMicrotasks` - QuickJS: `JS_ExecutePendingJob` The only exception is ChakraCore, which requires hosts to provide the queue and set up the `JsSetPromiseContinuationCallback`, but a JSI implementation can provide that queue trivially. ### Extra note on ECMA-262 ECMA-262 changed the spec at Mar 2020 from "asking an ECMAScript implementation to maintain a Job Queue" to "Ask the embedder to define its event loop, including the job queue" so technically: - the internal approach is closer to the old spec. - the ChakraCore approach is closer to the current spec. Reviewed By: mhorowitz Differential Revision: D27727920 fbshipit-source-id: b839b959facbc009f7d14b781e9287c46ea64373 |
||
---|---|---|
.. | ||
jsi | ||
.clang-tidy | ||
Android.mk | ||
BUCK | ||
JSCRuntime.cpp | ||
JSCRuntime.h | ||
React-jsi.podspec |