Skip to content

Commit

Permalink
Wire up configuration to use microtasks in RuntimeScheduler, Hermes a…
Browse files Browse the repository at this point in the history
…nd React (#41090)

Summary:
Pull Request resolved: #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
  • Loading branch information
rubennorte authored and facebook-github-bot committed Oct 23, 2023
1 parent 04042de commit 1923a4e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -119,6 +130,7 @@ std::unique_ptr<jsi::Runtime> HermesInstance::createJSRuntime(
.build())
.withES6Proxy(false)
.withEnableSampleProfiling(true)
.withMicrotaskQueue(enableMicrotasks)
.withVMExperimentFlags(vmExperimentFlags);

if (cm) {
Expand Down

0 comments on commit 1923a4e

Please sign in to comment.