7310847758
Summary: Changelog: [Internal] This diff introduce a helper `performMicrotaskCheckpoint` to repetitively invoke `jsi::Runtime::drainMicrotasks` to exhaust the microtasks queue provided by JS VMs. Please refer to `jsi.h` for more details about the behavior of the API. Conceptually, the checkpoint needs to be performed whenever the JS stack is considered empty. In practice, we can just make a call whenever RN is returned from C++->JS calls. In the current RN, this happened in JSIExecutor: - `::callFunction` => `callFunctionReturnFlushedQueue_-> call` - `::invokeCallback` => `invokeCallbackAndReturnFlushedQueue_-> call` - `::flush` => `flushedQueue_->call` Each of them invoke a bound method on the JS bridge object. Note that `setImmediate` callbacks are executed before they returned. This means immmediates are invoked before engine microtasks. This is okay because the priority between `setImmediate` and engine "microtask" are not defined. (`setImmediate` is non-standard and RN already treat `setImmediate` in a similar priority as microtask for the existing Promise polyfill.) Reviewed By: RSNara Differential Revision: D27729702 fbshipit-source-id: b64b3705d2ff5100075d860c89f03a847369b7ac |
||
---|---|---|
.. | ||
jsireact | ||
.clang-tidy | ||
Android.mk | ||
BUCK | ||
React-jsiexecutor.podspec |