From 131844f40e15359fedd87ca2716a2880e0dd5ce4 Mon Sep 17 00:00:00 2001 From: Andrei Shikov Date: Tue, 1 Mar 2022 18:10:49 -0800 Subject: [PATCH] Add feature flag to disable pre-allocation on clone Summary: Disables preallocation for cloned nodes, switching to create during commit for those cases instead. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D34555621 fbshipit-source-id: 21fc834cea318ca299aa37a9aab28a2f2a9675b5 --- .../src/main/java/com/facebook/react/fabric/jni/Binding.cpp | 6 ++++++ .../src/main/java/com/facebook/react/fabric/jni/Binding.h | 1 + 2 files changed, 7 insertions(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp index bf6495340eb7cb..b80b5109f3010e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp @@ -367,6 +367,9 @@ void Binding::installFabricUIManager( disableRevisionCheckForPreallocation_ = config->getBool("react_fabric:disable_revision_check_for_preallocation"); + disablePreallocationOnClone_ = config->getBool( + "react_native_new_architecture:disable_preallocation_on_clone_android"); + if (enableFabricLogs_) { LOG(WARNING) << "Binding::installFabricUIManager() was called (address: " << this << ")."; @@ -505,6 +508,9 @@ void Binding::schedulerDidCloneShadowNode( SurfaceId surfaceId, ShadowNode const &oldShadowNode, ShadowNode const &newShadowNode) { + if (disablePreallocationOnClone_) { + return; + } // This is only necessary if view preallocation was skipped during // createShadowNode diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h index 90099106bbfc32..b7df029f3d2ed7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h @@ -156,6 +156,7 @@ class Binding : public jni::HybridClass, bool enableFabricLogs_{false}; bool disableRevisionCheckForPreallocation_{false}; bool dispatchPreallocationInBackground_{false}; + bool disablePreallocationOnClone_{false}; }; } // namespace react