Skip to content

Commit 4d152ff

Browse files
Nick Lefevermeta-codesync[bot]
authored andcommitted
Add updateRuntimeShadowNodeReferencesOnCommitThread feature flag (#55515)
Summary: Pull Request resolved: #55515 Add updateRuntimeShadowNodeReferencesOnCommitThread feature flag to enable syncing the shadow nodes on commits running on the allowed thread. This feature flag is more flexible than updateRuntimeShadowNodeReferencesOnCommit, which only would sync on commits originating from the React renderer. Changelog: [Internal] Reviewed By: javache Differential Revision: D92913632 fbshipit-source-id: ff619d3f88580de2d290305d2fc67bd75d52be79
1 parent 19faf7e commit 4d152ff

23 files changed

Lines changed: 170 additions & 35 deletions

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<f04d7cddd72c435fcce120b71366c81c>>
7+
* @generated SignedSource<<049cc0a1aa5ab53ad2ab11c359f49827>>
88
*/
99

1010
/**
@@ -444,6 +444,12 @@ public object ReactNativeFeatureFlags {
444444
@JvmStatic
445445
public fun updateRuntimeShadowNodeReferencesOnCommit(): Boolean = accessor.updateRuntimeShadowNodeReferencesOnCommit()
446446

447+
/**
448+
* When enabled, runtime shadow node references will be updated during the commit only on the allowed thread.
449+
*/
450+
@JvmStatic
451+
public fun updateRuntimeShadowNodeReferencesOnCommitThread(): Boolean = accessor.updateRuntimeShadowNodeReferencesOnCommitThread()
452+
447453
/**
448454
* In Bridgeless mode, use the always available javascript error reporting pipeline.
449455
*/

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<9158cc3ba1ea8ea65140b582a02a5112>>
7+
* @generated SignedSource<<6d1fc28e24576c1a63dceaa8c974cc1f>>
88
*/
99

1010
/**
@@ -89,6 +89,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
8989
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
9090
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
9191
private var updateRuntimeShadowNodeReferencesOnCommitCache: Boolean? = null
92+
private var updateRuntimeShadowNodeReferencesOnCommitThreadCache: Boolean? = null
9293
private var useAlwaysAvailableJSErrorHandlingCache: Boolean? = null
9394
private var useFabricInteropCache: Boolean? = null
9495
private var useNativeViewConfigsInBridgelessModeCache: Boolean? = null
@@ -721,6 +722,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
721722
return cached
722723
}
723724

725+
override fun updateRuntimeShadowNodeReferencesOnCommitThread(): Boolean {
726+
var cached = updateRuntimeShadowNodeReferencesOnCommitThreadCache
727+
if (cached == null) {
728+
cached = ReactNativeFeatureFlagsCxxInterop.updateRuntimeShadowNodeReferencesOnCommitThread()
729+
updateRuntimeShadowNodeReferencesOnCommitThreadCache = cached
730+
}
731+
return cached
732+
}
733+
724734
override fun useAlwaysAvailableJSErrorHandling(): Boolean {
725735
var cached = useAlwaysAvailableJSErrorHandlingCache
726736
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<8f93f5e6ce460e2337bbdc51bde69558>>
7+
* @generated SignedSource<<26410c9e406969734991456f635be4af>>
88
*/
99

1010
/**
@@ -166,6 +166,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
166166

167167
@DoNotStrip @JvmStatic public external fun updateRuntimeShadowNodeReferencesOnCommit(): Boolean
168168

169+
@DoNotStrip @JvmStatic public external fun updateRuntimeShadowNodeReferencesOnCommitThread(): Boolean
170+
169171
@DoNotStrip @JvmStatic public external fun useAlwaysAvailableJSErrorHandling(): Boolean
170172

171173
@DoNotStrip @JvmStatic public external fun useFabricInterop(): Boolean

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<afd4040a9d72ea4af7a20084723506aa>>
7+
* @generated SignedSource<<b088aaa5805b084d234c20bed0dec3ab>>
88
*/
99

1010
/**
@@ -161,6 +161,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
161161

162162
override fun updateRuntimeShadowNodeReferencesOnCommit(): Boolean = false
163163

164+
override fun updateRuntimeShadowNodeReferencesOnCommitThread(): Boolean = false
165+
164166
override fun useAlwaysAvailableJSErrorHandling(): Boolean = false
165167

166168
override fun useFabricInterop(): Boolean = true

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<377c50a9a022344cba12a1ad6c23b68d>>
7+
* @generated SignedSource<<ee633c2c40fc07aa6cbb5601dfb36cf6>>
88
*/
99

1010
/**
@@ -93,6 +93,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
9393
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
9494
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
9595
private var updateRuntimeShadowNodeReferencesOnCommitCache: Boolean? = null
96+
private var updateRuntimeShadowNodeReferencesOnCommitThreadCache: Boolean? = null
9697
private var useAlwaysAvailableJSErrorHandlingCache: Boolean? = null
9798
private var useFabricInteropCache: Boolean? = null
9899
private var useNativeViewConfigsInBridgelessModeCache: Boolean? = null
@@ -794,6 +795,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
794795
return cached
795796
}
796797

798+
override fun updateRuntimeShadowNodeReferencesOnCommitThread(): Boolean {
799+
var cached = updateRuntimeShadowNodeReferencesOnCommitThreadCache
800+
if (cached == null) {
801+
cached = currentProvider.updateRuntimeShadowNodeReferencesOnCommitThread()
802+
accessedFeatureFlags.add("updateRuntimeShadowNodeReferencesOnCommitThread")
803+
updateRuntimeShadowNodeReferencesOnCommitThreadCache = cached
804+
}
805+
return cached
806+
}
807+
797808
override fun useAlwaysAvailableJSErrorHandling(): Boolean {
798809
var cached = useAlwaysAvailableJSErrorHandlingCache
799810
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<c14e7e11bfb4404e2e8f94e551e1bb4d>>
7+
* @generated SignedSource<<fa7f50fd466b7cb65b208c0b0aaec704>>
88
*/
99

1010
/**
@@ -161,6 +161,8 @@ public interface ReactNativeFeatureFlagsProvider {
161161

162162
@DoNotStrip public fun updateRuntimeShadowNodeReferencesOnCommit(): Boolean
163163

164+
@DoNotStrip public fun updateRuntimeShadowNodeReferencesOnCommitThread(): Boolean
165+
164166
@DoNotStrip public fun useAlwaysAvailableJSErrorHandling(): Boolean
165167

166168
@DoNotStrip public fun useFabricInterop(): Boolean

packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<3c268f88d2df4ad8500e29b91f1fecc0>>
7+
* @generated SignedSource<<698b775afb6ad9295c181ea3d12118d3>>
88
*/
99

1010
/**
@@ -453,6 +453,12 @@ class ReactNativeFeatureFlagsJavaProvider
453453
return method(javaProvider_);
454454
}
455455

456+
bool updateRuntimeShadowNodeReferencesOnCommitThread() override {
457+
static const auto method =
458+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("updateRuntimeShadowNodeReferencesOnCommitThread");
459+
return method(javaProvider_);
460+
}
461+
456462
bool useAlwaysAvailableJSErrorHandling() override {
457463
static const auto method =
458464
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("useAlwaysAvailableJSErrorHandling");
@@ -862,6 +868,11 @@ bool JReactNativeFeatureFlagsCxxInterop::updateRuntimeShadowNodeReferencesOnComm
862868
return ReactNativeFeatureFlags::updateRuntimeShadowNodeReferencesOnCommit();
863869
}
864870

871+
bool JReactNativeFeatureFlagsCxxInterop::updateRuntimeShadowNodeReferencesOnCommitThread(
872+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
873+
return ReactNativeFeatureFlags::updateRuntimeShadowNodeReferencesOnCommitThread();
874+
}
875+
865876
bool JReactNativeFeatureFlagsCxxInterop::useAlwaysAvailableJSErrorHandling(
866877
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
867878
return ReactNativeFeatureFlags::useAlwaysAvailableJSErrorHandling();
@@ -1150,6 +1161,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
11501161
makeNativeMethod(
11511162
"updateRuntimeShadowNodeReferencesOnCommit",
11521163
JReactNativeFeatureFlagsCxxInterop::updateRuntimeShadowNodeReferencesOnCommit),
1164+
makeNativeMethod(
1165+
"updateRuntimeShadowNodeReferencesOnCommitThread",
1166+
JReactNativeFeatureFlagsCxxInterop::updateRuntimeShadowNodeReferencesOnCommitThread),
11531167
makeNativeMethod(
11541168
"useAlwaysAvailableJSErrorHandling",
11551169
JReactNativeFeatureFlagsCxxInterop::useAlwaysAvailableJSErrorHandling),

packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<cd6ac6eb0dff3dc55780c809041b76e4>>
7+
* @generated SignedSource<<7be3a44c6ffc2c9d390f66902ef80d30>>
88
*/
99

1010
/**
@@ -237,6 +237,9 @@ class JReactNativeFeatureFlagsCxxInterop
237237
static bool updateRuntimeShadowNodeReferencesOnCommit(
238238
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
239239

240+
static bool updateRuntimeShadowNodeReferencesOnCommitThread(
241+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
242+
240243
static bool useAlwaysAvailableJSErrorHandling(
241244
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
242245

packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<fbd62713d66b440e7c18498ccd2a7c0b>>
7+
* @generated SignedSource<<88b22330e8486a820eb42b59fb7279e4>>
88
*/
99

1010
/**
@@ -302,6 +302,10 @@ bool ReactNativeFeatureFlags::updateRuntimeShadowNodeReferencesOnCommit() {
302302
return getAccessor().updateRuntimeShadowNodeReferencesOnCommit();
303303
}
304304

305+
bool ReactNativeFeatureFlags::updateRuntimeShadowNodeReferencesOnCommitThread() {
306+
return getAccessor().updateRuntimeShadowNodeReferencesOnCommitThread();
307+
}
308+
305309
bool ReactNativeFeatureFlags::useAlwaysAvailableJSErrorHandling() {
306310
return getAccessor().useAlwaysAvailableJSErrorHandling();
307311
}

packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<bdc8ad1004183077c5a459efd6b0c8f6>>
7+
* @generated SignedSource<<af0f34b904e1e555e18f186fb44ca089>>
88
*/
99

1010
/**
@@ -384,6 +384,11 @@ class ReactNativeFeatureFlags {
384384
*/
385385
RN_EXPORT static bool updateRuntimeShadowNodeReferencesOnCommit();
386386

387+
/**
388+
* When enabled, runtime shadow node references will be updated during the commit only on the allowed thread.
389+
*/
390+
RN_EXPORT static bool updateRuntimeShadowNodeReferencesOnCommitThread();
391+
387392
/**
388393
* In Bridgeless mode, use the always available javascript error reporting pipeline.
389394
*/

0 commit comments

Comments
 (0)