Skip to content

Commit

Permalink
Run the enableAccumulatedUpdatesInRawPropsAndroid QE for View only (f…
Browse files Browse the repository at this point in the history
…acebook#48852)

Summary:
Pull Request resolved: facebook#48852

The `enableAccumulatedUpdatesInRawPropsAndroid` param will be tested together with the `enablePropsUpdateReconciliationAndroid` param.

`enablePropsUpdateReconciliationAndroid` currently only supports `View` components.

This diff changes `enableAccumulatedUpdatesInRawPropsAndroid`  to also run only for `View`s.

Differential Revision: D68492332
  • Loading branch information
dmytrorykun authored and facebook-github-bot committed Jan 27, 2025
1 parent f06a97e commit 6a25fbe
Show file tree
Hide file tree
Showing 22 changed files with 157 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<841c26f98395a48dad2ff748dd009f07>>
* @generated SignedSource<<5c8f4dbd46e302a10305a736c337d124>>
*/

/**
Expand Down Expand Up @@ -220,6 +220,12 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean = accessor.traceTurboModulePromiseRejectionsOnAndroid()

/**
* Works together with enableAccumulatedUpdatesInRawPropsAndroid. Restricts its effect only to instances of View.
*/
@JvmStatic
public fun useAccumulatedRawPropsUpdatesOnlyInViewAndroid(): Boolean = accessor.useAccumulatedRawPropsUpdatesOnlyInViewAndroid()

/**
* In Bridgeless mode, use the always available javascript error reporting pipeline.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<735455b25aae2fa07a5e36e478b78f0f>>
* @generated SignedSource<<9a7eed189f3357a7477525c748edf179>>
*/

/**
Expand Down Expand Up @@ -52,6 +52,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var lazyAnimationCallbacksCache: Boolean? = null
private var loadVectorDrawablesOnImagesCache: Boolean? = null
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
private var useAccumulatedRawPropsUpdatesOnlyInViewAndroidCache: Boolean? = null
private var useAlwaysAvailableJSErrorHandlingCache: Boolean? = null
private var useEditTextStockAndroidFocusBehaviorCache: Boolean? = null
private var useFabricInteropCache: Boolean? = null
Expand Down Expand Up @@ -351,6 +352,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

override fun useAccumulatedRawPropsUpdatesOnlyInViewAndroid(): Boolean {
var cached = useAccumulatedRawPropsUpdatesOnlyInViewAndroidCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.useAccumulatedRawPropsUpdatesOnlyInViewAndroid()
useAccumulatedRawPropsUpdatesOnlyInViewAndroidCache = cached
}
return cached
}

override fun useAlwaysAvailableJSErrorHandling(): Boolean {
var cached = useAlwaysAvailableJSErrorHandlingCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<6390e3da6c736f01254531394b566e39>>
* @generated SignedSource<<accb7caf684f0af3d53024ffceb15be6>>
*/

/**
Expand Down Expand Up @@ -92,6 +92,8 @@ public object ReactNativeFeatureFlagsCxxInterop {

@DoNotStrip @JvmStatic public external fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean

@DoNotStrip @JvmStatic public external fun useAccumulatedRawPropsUpdatesOnlyInViewAndroid(): Boolean

@DoNotStrip @JvmStatic public external fun useAlwaysAvailableJSErrorHandling(): Boolean

@DoNotStrip @JvmStatic public external fun useEditTextStockAndroidFocusBehavior(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<588a6c3434cdf6ccb470cd8bb914fae0>>
* @generated SignedSource<<303baf38d6d12c2b4ff744eace01481a>>
*/

/**
Expand Down Expand Up @@ -87,6 +87,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi

override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean = false

override fun useAccumulatedRawPropsUpdatesOnlyInViewAndroid(): Boolean = false

override fun useAlwaysAvailableJSErrorHandling(): Boolean = false

override fun useEditTextStockAndroidFocusBehavior(): Boolean = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<5d69e428af96cdbb839db2d22920c7fc>>
* @generated SignedSource<<59d42ccd66da6ec2bb74d9de4daa8066>>
*/

/**
Expand Down Expand Up @@ -56,6 +56,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var lazyAnimationCallbacksCache: Boolean? = null
private var loadVectorDrawablesOnImagesCache: Boolean? = null
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
private var useAccumulatedRawPropsUpdatesOnlyInViewAndroidCache: Boolean? = null
private var useAlwaysAvailableJSErrorHandlingCache: Boolean? = null
private var useEditTextStockAndroidFocusBehaviorCache: Boolean? = null
private var useFabricInteropCache: Boolean? = null
Expand Down Expand Up @@ -387,6 +388,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}

override fun useAccumulatedRawPropsUpdatesOnlyInViewAndroid(): Boolean {
var cached = useAccumulatedRawPropsUpdatesOnlyInViewAndroidCache
if (cached == null) {
cached = currentProvider.useAccumulatedRawPropsUpdatesOnlyInViewAndroid()
accessedFeatureFlags.add("useAccumulatedRawPropsUpdatesOnlyInViewAndroid")
useAccumulatedRawPropsUpdatesOnlyInViewAndroidCache = cached
}
return cached
}

override fun useAlwaysAvailableJSErrorHandling(): Boolean {
var cached = useAlwaysAvailableJSErrorHandlingCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<6ec0906be44bb10e8b87bce7d70fdce2>>
* @generated SignedSource<<45f9a83de606ec38f53a4c1149703991>>
*/

/**
Expand Down Expand Up @@ -87,6 +87,8 @@ public interface ReactNativeFeatureFlagsProvider {

@DoNotStrip public fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean

@DoNotStrip public fun useAccumulatedRawPropsUpdatesOnlyInViewAndroid(): Boolean

@DoNotStrip public fun useAlwaysAvailableJSErrorHandling(): Boolean

@DoNotStrip public fun useEditTextStockAndroidFocusBehavior(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,16 @@ jni::local_ref<jobject> getProps(
// is enabled.
auto* oldProps = oldShadowView.props.get();
auto* newProps = newShadowView.props.get();
auto isView = strcmp(newShadowView.componentName, "View") == 0;
if (ReactNativeFeatureFlags::enablePropsUpdateReconciliationAndroid() &&
strcmp(newShadowView.componentName, "View") == 0) {
isView) {
return ReadableNativeMap::newObjectCxxArgs(
newProps->getDiffProps(oldProps));
}
if (ReactNativeFeatureFlags::enableAccumulatedUpdatesInRawPropsAndroid()) {
if (ReactNativeFeatureFlags::enableAccumulatedUpdatesInRawPropsAndroid() ||
(ReactNativeFeatureFlags::
useAccumulatedRawPropsUpdatesOnlyInViewAndroid() &&
isView)) {
if (oldProps == nullptr) {
return ReadableNativeMap::newObjectCxxArgs(newProps->dynamicProps);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<0252081684dcdb8295018b34980fcac2>>
* @generated SignedSource<<e845c9709fdcee7e207ece82cc3949d5>>
*/

/**
Expand Down Expand Up @@ -231,6 +231,12 @@ class ReactNativeFeatureFlagsProviderHolder
return method(javaProvider_);
}

bool useAccumulatedRawPropsUpdatesOnlyInViewAndroid() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("useAccumulatedRawPropsUpdatesOnlyInViewAndroid");
return method(javaProvider_);
}

bool useAlwaysAvailableJSErrorHandling() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("useAlwaysAvailableJSErrorHandling");
Expand Down Expand Up @@ -455,6 +461,11 @@ bool JReactNativeFeatureFlagsCxxInterop::traceTurboModulePromiseRejectionsOnAndr
return ReactNativeFeatureFlags::traceTurboModulePromiseRejectionsOnAndroid();
}

bool JReactNativeFeatureFlagsCxxInterop::useAccumulatedRawPropsUpdatesOnlyInViewAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::useAccumulatedRawPropsUpdatesOnlyInViewAndroid();
}

bool JReactNativeFeatureFlagsCxxInterop::useAlwaysAvailableJSErrorHandling(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::useAlwaysAvailableJSErrorHandling();
Expand Down Expand Up @@ -632,6 +643,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"traceTurboModulePromiseRejectionsOnAndroid",
JReactNativeFeatureFlagsCxxInterop::traceTurboModulePromiseRejectionsOnAndroid),
makeNativeMethod(
"useAccumulatedRawPropsUpdatesOnlyInViewAndroid",
JReactNativeFeatureFlagsCxxInterop::useAccumulatedRawPropsUpdatesOnlyInViewAndroid),
makeNativeMethod(
"useAlwaysAvailableJSErrorHandling",
JReactNativeFeatureFlagsCxxInterop::useAlwaysAvailableJSErrorHandling),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<c751e39a2a924bf55d5529a4e86ad99b>>
* @generated SignedSource<<270330c549b039bdaba99dc5da6a3680>>
*/

/**
Expand Down Expand Up @@ -126,6 +126,9 @@ class JReactNativeFeatureFlagsCxxInterop
static bool traceTurboModulePromiseRejectionsOnAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool useAccumulatedRawPropsUpdatesOnlyInViewAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool useAlwaysAvailableJSErrorHandling(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<097c771aa1ff769709f7d08a75da50b6>>
* @generated SignedSource<<78cc4c4bc1afd0ba0ff0408f9d1200de>>
*/

/**
Expand Down Expand Up @@ -154,6 +154,10 @@ bool ReactNativeFeatureFlags::traceTurboModulePromiseRejectionsOnAndroid() {
return getAccessor().traceTurboModulePromiseRejectionsOnAndroid();
}

bool ReactNativeFeatureFlags::useAccumulatedRawPropsUpdatesOnlyInViewAndroid() {
return getAccessor().useAccumulatedRawPropsUpdatesOnlyInViewAndroid();
}

bool ReactNativeFeatureFlags::useAlwaysAvailableJSErrorHandling() {
return getAccessor().useAlwaysAvailableJSErrorHandling();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<25afc05f79ba873b70a39019ca245c39>>
* @generated SignedSource<<14cad42058f884744ed4b517ed62ef4e>>
*/

/**
Expand Down Expand Up @@ -199,6 +199,11 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool traceTurboModulePromiseRejectionsOnAndroid();

/**
* Works together with enableAccumulatedUpdatesInRawPropsAndroid. Restricts its effect only to instances of View.
*/
RN_EXPORT static bool useAccumulatedRawPropsUpdatesOnlyInViewAndroid();

/**
* In Bridgeless mode, use the always available javascript error reporting pipeline.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<a6053011a74345b21a800e88ab928816>>
* @generated SignedSource<<9ca742ec038b855728b6b54e7bbfea09>>
*/

/**
Expand Down Expand Up @@ -605,6 +605,24 @@ bool ReactNativeFeatureFlagsAccessor::traceTurboModulePromiseRejectionsOnAndroid
return flagValue.value();
}

bool ReactNativeFeatureFlagsAccessor::useAccumulatedRawPropsUpdatesOnlyInViewAndroid() {
auto flagValue = useAccumulatedRawPropsUpdatesOnlyInViewAndroid_.load();

if (!flagValue.has_value()) {
// This block is not exclusive but it is not necessary.
// If multiple threads try to initialize the feature flag, we would only
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.

markFlagAsAccessed(32, "useAccumulatedRawPropsUpdatesOnlyInViewAndroid");

flagValue = currentProvider_->useAccumulatedRawPropsUpdatesOnlyInViewAndroid();
useAccumulatedRawPropsUpdatesOnlyInViewAndroid_ = flagValue;
}

return flagValue.value();
}

bool ReactNativeFeatureFlagsAccessor::useAlwaysAvailableJSErrorHandling() {
auto flagValue = useAlwaysAvailableJSErrorHandling_.load();

Expand All @@ -614,7 +632,7 @@ bool ReactNativeFeatureFlagsAccessor::useAlwaysAvailableJSErrorHandling() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.

markFlagAsAccessed(32, "useAlwaysAvailableJSErrorHandling");
markFlagAsAccessed(33, "useAlwaysAvailableJSErrorHandling");

flagValue = currentProvider_->useAlwaysAvailableJSErrorHandling();
useAlwaysAvailableJSErrorHandling_ = flagValue;
Expand All @@ -632,7 +650,7 @@ bool ReactNativeFeatureFlagsAccessor::useEditTextStockAndroidFocusBehavior() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.

markFlagAsAccessed(33, "useEditTextStockAndroidFocusBehavior");
markFlagAsAccessed(34, "useEditTextStockAndroidFocusBehavior");

flagValue = currentProvider_->useEditTextStockAndroidFocusBehavior();
useEditTextStockAndroidFocusBehavior_ = flagValue;
Expand All @@ -650,7 +668,7 @@ bool ReactNativeFeatureFlagsAccessor::useFabricInterop() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.

markFlagAsAccessed(34, "useFabricInterop");
markFlagAsAccessed(35, "useFabricInterop");

flagValue = currentProvider_->useFabricInterop();
useFabricInterop_ = flagValue;
Expand All @@ -668,7 +686,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeViewConfigsInBridgelessMode() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.

markFlagAsAccessed(35, "useNativeViewConfigsInBridgelessMode");
markFlagAsAccessed(36, "useNativeViewConfigsInBridgelessMode");

flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode();
useNativeViewConfigsInBridgelessMode_ = flagValue;
Expand All @@ -686,7 +704,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimisedViewPreallocationOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.

markFlagAsAccessed(36, "useOptimisedViewPreallocationOnAndroid");
markFlagAsAccessed(37, "useOptimisedViewPreallocationOnAndroid");

flagValue = currentProvider_->useOptimisedViewPreallocationOnAndroid();
useOptimisedViewPreallocationOnAndroid_ = flagValue;
Expand All @@ -704,7 +722,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimizedEventBatchingOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.

markFlagAsAccessed(37, "useOptimizedEventBatchingOnAndroid");
markFlagAsAccessed(38, "useOptimizedEventBatchingOnAndroid");

flagValue = currentProvider_->useOptimizedEventBatchingOnAndroid();
useOptimizedEventBatchingOnAndroid_ = flagValue;
Expand All @@ -722,7 +740,7 @@ bool ReactNativeFeatureFlagsAccessor::useRawPropsJsiValue() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.

markFlagAsAccessed(38, "useRawPropsJsiValue");
markFlagAsAccessed(39, "useRawPropsJsiValue");

flagValue = currentProvider_->useRawPropsJsiValue();
useRawPropsJsiValue_ = flagValue;
Expand All @@ -740,7 +758,7 @@ bool ReactNativeFeatureFlagsAccessor::useRuntimeShadowNodeReferenceUpdate() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.

markFlagAsAccessed(39, "useRuntimeShadowNodeReferenceUpdate");
markFlagAsAccessed(40, "useRuntimeShadowNodeReferenceUpdate");

flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdate();
useRuntimeShadowNodeReferenceUpdate_ = flagValue;
Expand All @@ -758,7 +776,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModuleInterop() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.

markFlagAsAccessed(40, "useTurboModuleInterop");
markFlagAsAccessed(41, "useTurboModuleInterop");

flagValue = currentProvider_->useTurboModuleInterop();
useTurboModuleInterop_ = flagValue;
Expand All @@ -776,7 +794,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModules() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.

markFlagAsAccessed(41, "useTurboModules");
markFlagAsAccessed(42, "useTurboModules");

flagValue = currentProvider_->useTurboModules();
useTurboModules_ = flagValue;
Expand Down
Loading

0 comments on commit 6a25fbe

Please sign in to comment.