mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Disable preallocation of views in Mounting layer of fabric
Summary: This diff adds an experiment to disable the preallocation of views on the mounting layer of Fabric Changelog: Add a ReactNativeConfig to configure the preallocation of views in the mounting layer of Fabric Reviewed By: shergin Differential Revision: D17949681 fbshipit-source-id: 0af63df22aff9e94289bc8a8217c79222f1fd61c
This commit is contained in:
committed by
Facebook Github Bot
parent
d61b381320
commit
585dfff22b
@@ -238,6 +238,8 @@ void Binding::installFabricUIManager(
|
||||
reactNativeConfig_ = config;
|
||||
shouldCollateRemovesAndDeletes_ = reactNativeConfig_->getBool("react_fabric:enable_removedelete_collation_android");
|
||||
|
||||
disablePreallocateViews_ = reactNativeConfig_->getBool("react_fabric:disabled_view_preallocation_android");
|
||||
|
||||
auto toolbox = SchedulerToolbox{};
|
||||
toolbox.contextContainer = contextContainer;
|
||||
toolbox.componentRegistryFactory = componentsRegistry->buildRegistryFunction;
|
||||
@@ -602,7 +604,7 @@ void Binding::schedulerDidFinishTransaction(
|
||||
|
||||
switch (mutation.type) {
|
||||
case ShadowViewMutation::Create: {
|
||||
if (mutation.newChildShadowView.props->revision > 1 ||
|
||||
if (disablePreallocateViews_ || mutation.newChildShadowView.props->revision > 1 ||
|
||||
deletedViewTags.find(mutation.newChildShadowView.tag) !=
|
||||
deletedViewTags.end()) {
|
||||
mountItems[position++] =
|
||||
@@ -683,7 +685,7 @@ void Binding::schedulerDidFinishTransaction(
|
||||
mountItems[position++] =
|
||||
createInsertMountItem(localJavaUIManager, mutation);
|
||||
|
||||
if (mutation.newChildShadowView.props->revision > 1 ||
|
||||
if (disablePreallocateViews_ || mutation.newChildShadowView.props->revision > 1 ||
|
||||
deletedViewTags.find(mutation.newChildShadowView.tag) !=
|
||||
deletedViewTags.end()) {
|
||||
mountItems[position++] =
|
||||
@@ -780,6 +782,10 @@ void Binding::schedulerDidRequestPreliminaryViewAllocation(
|
||||
const SurfaceId surfaceId,
|
||||
const ShadowView &shadowView) {
|
||||
|
||||
if (disablePreallocateViews_) {
|
||||
return;
|
||||
}
|
||||
|
||||
jni::global_ref<jobject> localJavaUIManager = getJavaUIManager();
|
||||
if (!localJavaUIManager) {
|
||||
LOG(ERROR) << "Binding::schedulerDidRequestPreliminaryViewAllocation: JavaUIManager disappeared";
|
||||
|
||||
@@ -105,6 +105,7 @@ class Binding : public jni::HybridClass<Binding>, public SchedulerDelegate {
|
||||
|
||||
std::shared_ptr<const ReactNativeConfig> reactNativeConfig_{nullptr};
|
||||
bool shouldCollateRemovesAndDeletes_{false};
|
||||
bool disablePreallocateViews_{false};
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
|
||||
Reference in New Issue
Block a user