Wire up configuration to use microtasks in RuntimeScheduler, Hermes and React (#41090)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41090

This propagates to enable the use of microtasks in the React reconciler, Runtime Scheduler and Hermes.

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D50177355

fbshipit-source-id: 6cf23cf72b63d19f50453d3e4cc4ac1b056dbd92
This commit is contained in:
Rubén Norte
2023-10-23 12:11:11 -07:00
committed by Facebook GitHub Bot
parent 04042decaf
commit 1923a4e2ff
2 changed files with 20 additions and 0 deletions
@@ -139,6 +139,14 @@ Scheduler::Scheduler(
reduceDeleteCreateMutationLayoutAnimation_ = true;
#endif
#ifdef ANDROID
CoreFeatures::enableMicrotasks =
reactNativeConfig_->getBool("react_fabric:enable_microtasks_android");
#else
CoreFeatures::enableMicrotasks =
reactNativeConfig_->getBool("react_fabric:enable_microtasks_ios");
#endif
CoreFeatures::blockPaintForUseLayoutEffect = reactNativeConfig_->getBool(
"react_fabric:block_paint_for_use_layout_effect");
@@ -105,6 +105,17 @@ std::unique_ptr<jsi::Runtime> HermesInstance::createJSRuntime(
auto heapSizeMB = heapSizeConfig > 0
? static_cast<::hermes::vm::gcheapsize_t>(heapSizeConfig)
: 3072;
#ifdef ANDROID
bool enableMicrotasks = reactNativeConfig
? reactNativeConfig->getBool("react_fabric:enable_microtasks_android")
: false;
#else
bool enableMicrotasks = reactNativeConfig
? reactNativeConfig->getBool("react_fabric:enable_microtasks_ios")
: false;
#endif
::hermes::vm::RuntimeConfig::Builder runtimeConfigBuilder =
::hermes::vm::RuntimeConfig::Builder()
.withGCConfig(::hermes::vm::GCConfig::Builder()
@@ -119,6 +130,7 @@ std::unique_ptr<jsi::Runtime> HermesInstance::createJSRuntime(
.build())
.withES6Proxy(false)
.withEnableSampleProfiling(true)
.withMicrotaskQueue(enableMicrotasks)
.withVMExperimentFlags(vmExperimentFlags);
if (cm) {