Skip to content

Commit 0b8731d

Browse files
sammy-SCfacebook-github-bot
authored andcommitted
Add config flag for RuntimeScheduler
Summary: Changelog: [internal] Add config flags for RuntimeScheduler. Even with the flags, React will not be using it. Further changes on React side will be required. Reviewed By: mdvacca Differential Revision: D27616916 fbshipit-source-id: 296a040c2b6dd936dd9582e937e6db75e28f31a4
1 parent 49b6c60 commit 0b8731d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

ReactCommon/react/renderer/scheduler/BUCK

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ rn_xplat_cxx_library(
6060
react_native_xplat_target("react/renderer/core:core"),
6161
react_native_xplat_target("react/renderer/mounting:mounting"),
6262
react_native_xplat_target("react/renderer/uimanager:uimanager"),
63+
react_native_xplat_target("react/renderer/runtimescheduler:runtimescheduler"),
6364
react_native_xplat_target("react/renderer/templateprocessor:templateprocessor"),
6465
react_native_xplat_target("react/renderer/componentregistry:componentregistry"),
6566
react_native_xplat_target("react/renderer/debug:debug"),

ReactCommon/react/renderer/scheduler/Scheduler.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <react/renderer/debug/SystraceSection.h>
1818
#include <react/renderer/mounting/MountingOverrideDelegate.h>
1919
#include <react/renderer/mounting/ShadowViewMutation.h>
20+
#include <react/renderer/runtimescheduler/RuntimeSchedulerBinding.h>
2021
#include <react/renderer/templateprocessor/UITemplateProcessor.h>
2122
#include <react/renderer/uimanager/UIManager.h>
2223
#include <react/renderer/uimanager/UIManagerBinding.h>
@@ -86,9 +87,20 @@ Scheduler::Scheduler(
8687
uiManager->setDelegate(this);
8788
uiManager->setComponentDescriptorRegistry(componentDescriptorRegistry_);
8889

90+
#ifdef ANDROID
91+
auto enableRuntimeScheduler = reactNativeConfig_->getBool(
92+
"react_fabric:enable_runtime_scheduler_android");
93+
#else
94+
auto enableRuntimeScheduler =
95+
reactNativeConfig_->getBool("react_fabric:enable_runtime_scheduler_ios");
96+
#endif
97+
8998
runtimeExecutor_([=](jsi::Runtime &runtime) {
9099
auto uiManagerBinding = UIManagerBinding::createAndInstallIfNeeded(runtime);
91100
uiManagerBinding->attach(uiManager);
101+
if (enableRuntimeScheduler) {
102+
RuntimeSchedulerBinding::createAndInstallIfNeeded(runtime);
103+
}
92104
});
93105

94106
auto componentDescriptorRegistryKey =

0 commit comments

Comments
 (0)