Skip to content

Commit

Permalink
Add config flag for RuntimeScheduler
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Apr 8, 2021
1 parent 49b6c60 commit 0b8731d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions ReactCommon/react/renderer/scheduler/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ rn_xplat_cxx_library(
react_native_xplat_target("react/renderer/core:core"),
react_native_xplat_target("react/renderer/mounting:mounting"),
react_native_xplat_target("react/renderer/uimanager:uimanager"),
react_native_xplat_target("react/renderer/runtimescheduler:runtimescheduler"),
react_native_xplat_target("react/renderer/templateprocessor:templateprocessor"),
react_native_xplat_target("react/renderer/componentregistry:componentregistry"),
react_native_xplat_target("react/renderer/debug:debug"),
Expand Down
12 changes: 12 additions & 0 deletions ReactCommon/react/renderer/scheduler/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <react/renderer/debug/SystraceSection.h>
#include <react/renderer/mounting/MountingOverrideDelegate.h>
#include <react/renderer/mounting/ShadowViewMutation.h>
#include <react/renderer/runtimescheduler/RuntimeSchedulerBinding.h>
#include <react/renderer/templateprocessor/UITemplateProcessor.h>
#include <react/renderer/uimanager/UIManager.h>
#include <react/renderer/uimanager/UIManagerBinding.h>
Expand Down Expand Up @@ -86,9 +87,20 @@ Scheduler::Scheduler(
uiManager->setDelegate(this);
uiManager->setComponentDescriptorRegistry(componentDescriptorRegistry_);

#ifdef ANDROID
auto enableRuntimeScheduler = reactNativeConfig_->getBool(
"react_fabric:enable_runtime_scheduler_android");
#else
auto enableRuntimeScheduler =
reactNativeConfig_->getBool("react_fabric:enable_runtime_scheduler_ios");
#endif

runtimeExecutor_([=](jsi::Runtime &runtime) {
auto uiManagerBinding = UIManagerBinding::createAndInstallIfNeeded(runtime);
uiManagerBinding->attach(uiManager);
if (enableRuntimeScheduler) {
RuntimeSchedulerBinding::createAndInstallIfNeeded(runtime);
}
});

auto componentDescriptorRegistryKey =
Expand Down

0 comments on commit 0b8731d

Please sign in to comment.