Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run the enableAccumulatedUpdatesInRawPropsAndroid QE for View only #48852

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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<<69be45d967e3883a960c49d760fc2ca1>>
* @generated SignedSource<<5305f75118d01f9836177d36a1641225>>
*/

/**
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<<e6816ffbe4d790d219c6aced5b3c695c>>
* @generated SignedSource<<9e9041983707511e02dfc8c5bbe54b90>>
*/

/**
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 @@ -350,6 +351,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<<fa884f44a3f1e00a3853393bb3e8dff7>>
* @generated SignedSource<<39bbdf6347c47d00708f1c8cbd5ac056>>
*/

/**
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<<71ea4cd62cc16ed718fdc764ec97d0e8>>
* @generated SignedSource<<72f1c6b155d77cb5231c719636aa02f7>>
*/

/**
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<<2896efd81aed8e0100d61e739cb2ba04>>
* @generated SignedSource<<4a0cc2d95839f21f0eb92b4d7303fc88>>
*/

/**
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 @@ -386,6 +387,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<<8f051d9cd1918cdf584de4d469f40ae9>>
* @generated SignedSource<<c480a9aeb546a518c86d8aab12f2deaf>>
*/

/**
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->rawProps);
} else {
Expand Down Expand Up @@ -597,7 +601,10 @@ void FabricMountingManager::executeMount(
bool shouldCreateView =
!allocatedViewTags.contains(newChildShadowView.tag);
if (ReactNativeFeatureFlags::
enableAccumulatedUpdatesInRawPropsAndroid()) {
enableAccumulatedUpdatesInRawPropsAndroid() ||
(ReactNativeFeatureFlags::
useAccumulatedRawPropsUpdatesOnlyInViewAndroid() &&
strcmp(newChildShadowView.componentName, "View") == 0)) {
if (shouldCreateView) {
LOG(ERROR) << "Emitting insert for unallocated view "
<< newChildShadowView.tag;
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<<f09ad92744f524ede76f699f3188288f>>
* @generated SignedSource<<56a6f66de0f2498e35332d1203592e78>>
*/

/**
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 @@ -449,6 +455,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 @@ -621,6 +632,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<<94c5db58f8b59d4ccc16e4983d3c6f2e>>
* @generated SignedSource<<c2821c5f381d28070b10436ca1b6f1b3>>
*/

/**
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<<1eb35511f4c5fd393c234c026709eb11>>
* @generated SignedSource<<aaa261eb2ca9ba839970d567cf46d340>>
*/

/**
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<<88118789d97156c16a7ab691ca181d00>>
* @generated SignedSource<<7f1a36b350cd878f146eb88f366606bf>>
*/

/**
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<<fc67fb2f9f1634fe4a477292f5098ab4>>
* @generated SignedSource<<a929a6a1c5ff2c74e62059d46c8b903e>>
*/

/**
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::useOptimizedEventBatchingOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.

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

flagValue = currentProvider_->useOptimizedEventBatchingOnAndroid();
useOptimizedEventBatchingOnAndroid_ = flagValue;
Expand All @@ -704,7 +722,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(37, "useRawPropsJsiValue");
markFlagAsAccessed(38, "useRawPropsJsiValue");

flagValue = currentProvider_->useRawPropsJsiValue();
useRawPropsJsiValue_ = flagValue;
Expand All @@ -722,7 +740,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(38, "useRuntimeShadowNodeReferenceUpdate");
markFlagAsAccessed(39, "useRuntimeShadowNodeReferenceUpdate");

flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdate();
useRuntimeShadowNodeReferenceUpdate_ = flagValue;
Expand All @@ -740,7 +758,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(39, "useTurboModuleInterop");
markFlagAsAccessed(40, "useTurboModuleInterop");

flagValue = currentProvider_->useTurboModuleInterop();
useTurboModuleInterop_ = flagValue;
Expand All @@ -758,7 +776,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(40, "useTurboModules");
markFlagAsAccessed(41, "useTurboModules");

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