ship releaseImageDataWhenConsumed (#53576)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53576

## Changelog:

[iOS] [Fixed] - Images are removed from memory more aggressively to prevent OOMs

Reviewed By: rshest

Differential Revision: D81490116

fbshipit-source-id: d6b12af2d80e1c0a9ab3c624a549088b300feb3e
This commit is contained in:
Samuel Susla
2025-09-03 04:41:32 -07:00
committed by Facebook GitHub Bot
parent 9fbce3eff1
commit 3895831c2b
21 changed files with 40 additions and 159 deletions
@@ -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<<a5534457a42ada7d6e2a5d820844b782>>
* @generated SignedSource<<a59b42b84160c18d214f8b2be76bc743>>
*/
/**
@@ -336,12 +336,6 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun preventShadowTreeCommitExhaustion(): Boolean = accessor.preventShadowTreeCommitExhaustion()
/**
* Releases the cached image data when it is consumed by the observers.
*/
@JvmStatic
public fun releaseImageDataWhenConsumed(): Boolean = accessor.releaseImageDataWhenConsumed()
/**
* Function used to enable / disable Pressibility from using W3C Pointer Events for its hover callbacks
*/
@@ -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<<7dbb21bddd9c2ae447c83923a25372e4>>
* @generated SignedSource<<37203dffb9421d1036aaeaeaa7319e28>>
*/
/**
@@ -71,7 +71,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var perfMonitorV2EnabledCache: Boolean? = null
private var preparedTextCacheSizeCache: Double? = null
private var preventShadowTreeCommitExhaustionCache: Boolean? = null
private var releaseImageDataWhenConsumedCache: Boolean? = null
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
private var sweepActiveTouchOnChildNativeGesturesAndroidCache: Boolean? = null
@@ -549,15 +548,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun releaseImageDataWhenConsumed(): Boolean {
var cached = releaseImageDataWhenConsumedCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.releaseImageDataWhenConsumed()
releaseImageDataWhenConsumedCache = cached
}
return cached
}
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean {
var cached = shouldPressibilityUseW3CPointerEventsForHoverCache
if (cached == null) {
@@ -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<<4f93b4eb8f3cb427d3b926ffa18f9f9b>>
* @generated SignedSource<<9c0acc876e3205fe2ea181e71eb512c9>>
*/
/**
@@ -130,8 +130,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
@DoNotStrip @JvmStatic public external fun preventShadowTreeCommitExhaustion(): Boolean
@DoNotStrip @JvmStatic public external fun releaseImageDataWhenConsumed(): Boolean
@DoNotStrip @JvmStatic public external fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean
@DoNotStrip @JvmStatic public external fun skipActivityIdentityAssertionOnHostPause(): Boolean
@@ -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<<731176315c5589990865a0995f8b7e20>>
* @generated SignedSource<<05bfed9fc7131062c8b16246986fc999>>
*/
/**
@@ -125,8 +125,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun preventShadowTreeCommitExhaustion(): Boolean = false
override fun releaseImageDataWhenConsumed(): Boolean = false
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean = false
override fun skipActivityIdentityAssertionOnHostPause(): Boolean = false
@@ -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<<7af6546cb6e02afcfca90635b3cbe603>>
* @generated SignedSource<<9a18369464f81c3d03f2702716dfdb29>>
*/
/**
@@ -75,7 +75,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var perfMonitorV2EnabledCache: Boolean? = null
private var preparedTextCacheSizeCache: Double? = null
private var preventShadowTreeCommitExhaustionCache: Boolean? = null
private var releaseImageDataWhenConsumedCache: Boolean? = null
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
private var sweepActiveTouchOnChildNativeGesturesAndroidCache: Boolean? = null
@@ -604,16 +603,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}
override fun releaseImageDataWhenConsumed(): Boolean {
var cached = releaseImageDataWhenConsumedCache
if (cached == null) {
cached = currentProvider.releaseImageDataWhenConsumed()
accessedFeatureFlags.add("releaseImageDataWhenConsumed")
releaseImageDataWhenConsumedCache = cached
}
return cached
}
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean {
var cached = shouldPressibilityUseW3CPointerEventsForHoverCache
if (cached == null) {
@@ -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<<9a982d4167179619629627529916259b>>
* @generated SignedSource<<845b2ee5edc9aedbdbd052d9a930f666>>
*/
/**
@@ -125,8 +125,6 @@ public interface ReactNativeFeatureFlagsProvider {
@DoNotStrip public fun preventShadowTreeCommitExhaustion(): Boolean
@DoNotStrip public fun releaseImageDataWhenConsumed(): Boolean
@DoNotStrip public fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean
@DoNotStrip public fun skipActivityIdentityAssertionOnHostPause(): Boolean
@@ -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<<6e451f1b402ee9f80e86d0ee6b808f05>>
* @generated SignedSource<<d1dda9d6cd1c0179472fcc0631e46fcd>>
*/
/**
@@ -345,12 +345,6 @@ class ReactNativeFeatureFlagsJavaProvider
return method(javaProvider_);
}
bool releaseImageDataWhenConsumed() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("releaseImageDataWhenConsumed");
return method(javaProvider_);
}
bool shouldPressibilityUseW3CPointerEventsForHover() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("shouldPressibilityUseW3CPointerEventsForHover");
@@ -712,11 +706,6 @@ bool JReactNativeFeatureFlagsCxxInterop::preventShadowTreeCommitExhaustion(
return ReactNativeFeatureFlags::preventShadowTreeCommitExhaustion();
}
bool JReactNativeFeatureFlagsCxxInterop::releaseImageDataWhenConsumed(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::releaseImageDataWhenConsumed();
}
bool JReactNativeFeatureFlagsCxxInterop::shouldPressibilityUseW3CPointerEventsForHover(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover();
@@ -986,9 +975,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"preventShadowTreeCommitExhaustion",
JReactNativeFeatureFlagsCxxInterop::preventShadowTreeCommitExhaustion),
makeNativeMethod(
"releaseImageDataWhenConsumed",
JReactNativeFeatureFlagsCxxInterop::releaseImageDataWhenConsumed),
makeNativeMethod(
"shouldPressibilityUseW3CPointerEventsForHover",
JReactNativeFeatureFlagsCxxInterop::shouldPressibilityUseW3CPointerEventsForHover),
@@ -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<<81d70a5d005d308fdc3df3d0e7ec69b9>>
* @generated SignedSource<<31298767c1dd669d2a755e67edacc911>>
*/
/**
@@ -183,9 +183,6 @@ class JReactNativeFeatureFlagsCxxInterop
static bool preventShadowTreeCommitExhaustion(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool releaseImageDataWhenConsumed(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool shouldPressibilityUseW3CPointerEventsForHover(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
@@ -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<<c9ccf7038a26788fe2853ba1fabe8615>>
* @generated SignedSource<<9a538d3ebb58173e7e4e34453b71454b>>
*/
/**
@@ -230,10 +230,6 @@ bool ReactNativeFeatureFlags::preventShadowTreeCommitExhaustion() {
return getAccessor().preventShadowTreeCommitExhaustion();
}
bool ReactNativeFeatureFlags::releaseImageDataWhenConsumed() {
return getAccessor().releaseImageDataWhenConsumed();
}
bool ReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover() {
return getAccessor().shouldPressibilityUseW3CPointerEventsForHover();
}
@@ -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<<83c1c5b181d47f4a54cb097f8d31c48a>>
* @generated SignedSource<<3321d357fe5c74fa42c2d0b15a744f87>>
*/
/**
@@ -294,11 +294,6 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool preventShadowTreeCommitExhaustion();
/**
* Releases the cached image data when it is consumed by the observers.
*/
RN_EXPORT static bool releaseImageDataWhenConsumed();
/**
* Function used to enable / disable Pressibility from using W3C Pointer Events for its hover callbacks
*/
@@ -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<<5a84827d553809907a015b01cc5cff66>>
* @generated SignedSource<<041526548ef83b4afb12229a0345e29e>>
*/
/**
@@ -947,24 +947,6 @@ bool ReactNativeFeatureFlagsAccessor::preventShadowTreeCommitExhaustion() {
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::releaseImageDataWhenConsumed() {
auto flagValue = releaseImageDataWhenConsumed_.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(51, "releaseImageDataWhenConsumed");
flagValue = currentProvider_->releaseImageDataWhenConsumed();
releaseImageDataWhenConsumed_ = flagValue;
}
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::shouldPressibilityUseW3CPointerEventsForHover() {
auto flagValue = shouldPressibilityUseW3CPointerEventsForHover_.load();
@@ -974,7 +956,7 @@ bool ReactNativeFeatureFlagsAccessor::shouldPressibilityUseW3CPointerEventsForHo
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(52, "shouldPressibilityUseW3CPointerEventsForHover");
markFlagAsAccessed(51, "shouldPressibilityUseW3CPointerEventsForHover");
flagValue = currentProvider_->shouldPressibilityUseW3CPointerEventsForHover();
shouldPressibilityUseW3CPointerEventsForHover_ = flagValue;
@@ -992,7 +974,7 @@ bool ReactNativeFeatureFlagsAccessor::skipActivityIdentityAssertionOnHostPause()
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(53, "skipActivityIdentityAssertionOnHostPause");
markFlagAsAccessed(52, "skipActivityIdentityAssertionOnHostPause");
flagValue = currentProvider_->skipActivityIdentityAssertionOnHostPause();
skipActivityIdentityAssertionOnHostPause_ = flagValue;
@@ -1010,7 +992,7 @@ bool ReactNativeFeatureFlagsAccessor::sweepActiveTouchOnChildNativeGesturesAndro
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(54, "sweepActiveTouchOnChildNativeGesturesAndroid");
markFlagAsAccessed(53, "sweepActiveTouchOnChildNativeGesturesAndroid");
flagValue = currentProvider_->sweepActiveTouchOnChildNativeGesturesAndroid();
sweepActiveTouchOnChildNativeGesturesAndroid_ = flagValue;
@@ -1028,7 +1010,7 @@ bool ReactNativeFeatureFlagsAccessor::traceTurboModulePromiseRejectionsOnAndroid
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(55, "traceTurboModulePromiseRejectionsOnAndroid");
markFlagAsAccessed(54, "traceTurboModulePromiseRejectionsOnAndroid");
flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid();
traceTurboModulePromiseRejectionsOnAndroid_ = flagValue;
@@ -1046,7 +1028,7 @@ bool ReactNativeFeatureFlagsAccessor::updateRuntimeShadowNodeReferencesOnCommit(
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(56, "updateRuntimeShadowNodeReferencesOnCommit");
markFlagAsAccessed(55, "updateRuntimeShadowNodeReferencesOnCommit");
flagValue = currentProvider_->updateRuntimeShadowNodeReferencesOnCommit();
updateRuntimeShadowNodeReferencesOnCommit_ = flagValue;
@@ -1064,7 +1046,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(57, "useAlwaysAvailableJSErrorHandling");
markFlagAsAccessed(56, "useAlwaysAvailableJSErrorHandling");
flagValue = currentProvider_->useAlwaysAvailableJSErrorHandling();
useAlwaysAvailableJSErrorHandling_ = flagValue;
@@ -1082,7 +1064,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(58, "useFabricInterop");
markFlagAsAccessed(57, "useFabricInterop");
flagValue = currentProvider_->useFabricInterop();
useFabricInterop_ = flagValue;
@@ -1100,7 +1082,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeEqualsInNativeReadableArrayAndroi
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(59, "useNativeEqualsInNativeReadableArrayAndroid");
markFlagAsAccessed(58, "useNativeEqualsInNativeReadableArrayAndroid");
flagValue = currentProvider_->useNativeEqualsInNativeReadableArrayAndroid();
useNativeEqualsInNativeReadableArrayAndroid_ = flagValue;
@@ -1118,7 +1100,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeTransformHelperAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(60, "useNativeTransformHelperAndroid");
markFlagAsAccessed(59, "useNativeTransformHelperAndroid");
flagValue = currentProvider_->useNativeTransformHelperAndroid();
useNativeTransformHelperAndroid_ = flagValue;
@@ -1136,7 +1118,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(61, "useNativeViewConfigsInBridgelessMode");
markFlagAsAccessed(60, "useNativeViewConfigsInBridgelessMode");
flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode();
useNativeViewConfigsInBridgelessMode_ = flagValue;
@@ -1154,7 +1136,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(62, "useOptimizedEventBatchingOnAndroid");
markFlagAsAccessed(61, "useOptimizedEventBatchingOnAndroid");
flagValue = currentProvider_->useOptimizedEventBatchingOnAndroid();
useOptimizedEventBatchingOnAndroid_ = flagValue;
@@ -1172,7 +1154,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(63, "useRawPropsJsiValue");
markFlagAsAccessed(62, "useRawPropsJsiValue");
flagValue = currentProvider_->useRawPropsJsiValue();
useRawPropsJsiValue_ = flagValue;
@@ -1190,7 +1172,7 @@ bool ReactNativeFeatureFlagsAccessor::useShadowNodeStateOnClone() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(64, "useShadowNodeStateOnClone");
markFlagAsAccessed(63, "useShadowNodeStateOnClone");
flagValue = currentProvider_->useShadowNodeStateOnClone();
useShadowNodeStateOnClone_ = flagValue;
@@ -1208,7 +1190,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(65, "useTurboModuleInterop");
markFlagAsAccessed(64, "useTurboModuleInterop");
flagValue = currentProvider_->useTurboModuleInterop();
useTurboModuleInterop_ = flagValue;
@@ -1226,7 +1208,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(66, "useTurboModules");
markFlagAsAccessed(65, "useTurboModules");
flagValue = currentProvider_->useTurboModules();
useTurboModules_ = flagValue;
@@ -1244,7 +1226,7 @@ double ReactNativeFeatureFlagsAccessor::virtualViewHysteresisRatio() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(67, "virtualViewHysteresisRatio");
markFlagAsAccessed(66, "virtualViewHysteresisRatio");
flagValue = currentProvider_->virtualViewHysteresisRatio();
virtualViewHysteresisRatio_ = flagValue;
@@ -1262,7 +1244,7 @@ double ReactNativeFeatureFlagsAccessor::virtualViewPrerenderRatio() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(68, "virtualViewPrerenderRatio");
markFlagAsAccessed(67, "virtualViewPrerenderRatio");
flagValue = currentProvider_->virtualViewPrerenderRatio();
virtualViewPrerenderRatio_ = flagValue;
@@ -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<<3e2e6e95c530a18cfd248908e99d6878>>
* @generated SignedSource<<9c51131fae9f19d03050be0c74ca3d4b>>
*/
/**
@@ -83,7 +83,6 @@ class ReactNativeFeatureFlagsAccessor {
bool perfMonitorV2Enabled();
double preparedTextCacheSize();
bool preventShadowTreeCommitExhaustion();
bool releaseImageDataWhenConsumed();
bool shouldPressibilityUseW3CPointerEventsForHover();
bool skipActivityIdentityAssertionOnHostPause();
bool sweepActiveTouchOnChildNativeGesturesAndroid();
@@ -112,7 +111,7 @@ class ReactNativeFeatureFlagsAccessor {
std::unique_ptr<ReactNativeFeatureFlagsProvider> currentProvider_;
bool wasOverridden_;
std::array<std::atomic<const char*>, 69> accessedFeatureFlags_;
std::array<std::atomic<const char*>, 68> accessedFeatureFlags_;
std::atomic<std::optional<bool>> commonTestFlag_;
std::atomic<std::optional<bool>> cdpInteractionMetricsEnabled_;
@@ -165,7 +164,6 @@ class ReactNativeFeatureFlagsAccessor {
std::atomic<std::optional<bool>> perfMonitorV2Enabled_;
std::atomic<std::optional<double>> preparedTextCacheSize_;
std::atomic<std::optional<bool>> preventShadowTreeCommitExhaustion_;
std::atomic<std::optional<bool>> releaseImageDataWhenConsumed_;
std::atomic<std::optional<bool>> shouldPressibilityUseW3CPointerEventsForHover_;
std::atomic<std::optional<bool>> skipActivityIdentityAssertionOnHostPause_;
std::atomic<std::optional<bool>> sweepActiveTouchOnChildNativeGesturesAndroid_;
@@ -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<<1285e1c404d7a9554a5285ac3dc63cd1>>
* @generated SignedSource<<5f9c3ecf7887653fd5348a05391ab7d0>>
*/
/**
@@ -231,10 +231,6 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
return false;
}
bool releaseImageDataWhenConsumed() override {
return false;
}
bool shouldPressibilityUseW3CPointerEventsForHover() override {
return false;
}
@@ -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<<d89b539d4473bdc88ea28ea7deacde39>>
* @generated SignedSource<<027cef9dd44f14a71be7c0d1b90238b3>>
*/
/**
@@ -504,15 +504,6 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef
return ReactNativeFeatureFlagsDefaults::preventShadowTreeCommitExhaustion();
}
bool releaseImageDataWhenConsumed() override {
auto value = values_["releaseImageDataWhenConsumed"];
if (!value.isNull()) {
return value.getBool();
}
return ReactNativeFeatureFlagsDefaults::releaseImageDataWhenConsumed();
}
bool shouldPressibilityUseW3CPointerEventsForHover() override {
auto value = values_["shouldPressibilityUseW3CPointerEventsForHover"];
if (!value.isNull()) {
@@ -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<<31a4308a13ed1445409f3e5edfd0d388>>
* @generated SignedSource<<a78e171b87f70a1b2ab0de2f9e48012b>>
*/
/**
@@ -76,7 +76,6 @@ class ReactNativeFeatureFlagsProvider {
virtual bool perfMonitorV2Enabled() = 0;
virtual double preparedTextCacheSize() = 0;
virtual bool preventShadowTreeCommitExhaustion() = 0;
virtual bool releaseImageDataWhenConsumed() = 0;
virtual bool shouldPressibilityUseW3CPointerEventsForHover() = 0;
virtual bool skipActivityIdentityAssertionOnHostPause() = 0;
virtual bool sweepActiveTouchOnChildNativeGesturesAndroid() = 0;
@@ -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<<40877a198ee2fbcbed13d85abc6f793d>>
* @generated SignedSource<<07df05bf452f78603bbf79594aa0cba0>>
*/
/**
@@ -299,11 +299,6 @@ bool NativeReactNativeFeatureFlags::preventShadowTreeCommitExhaustion(
return ReactNativeFeatureFlags::preventShadowTreeCommitExhaustion();
}
bool NativeReactNativeFeatureFlags::releaseImageDataWhenConsumed(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::releaseImageDataWhenConsumed();
}
bool NativeReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover();
@@ -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<<77f248a7c43e9f11f6e727319a72e1a0>>
* @generated SignedSource<<228d7484ef89bb01fee8dcff2657c56a>>
*/
/**
@@ -138,8 +138,6 @@ class NativeReactNativeFeatureFlags
bool preventShadowTreeCommitExhaustion(jsi::Runtime& runtime);
bool releaseImageDataWhenConsumed(jsi::Runtime& runtime);
bool shouldPressibilityUseW3CPointerEventsForHover(jsi::Runtime& runtime);
bool skipActivityIdentityAssertionOnHostPause(jsi::Runtime& runtime);
@@ -123,11 +123,9 @@ void ImageResponseObserverCoordinator::nativeImageResponseFailed(
}
void ImageResponseObserverCoordinator::consumeResponse() const {
if (ReactNativeFeatureFlags::releaseImageDataWhenConsumed()) {
status_ = ImageResponse::Status::Consumed;
imageData_.reset();
imageMetadata_.reset();
}
status_ = ImageResponse::Status::Consumed;
imageData_.reset();
imageMetadata_.reset();
}
} // namespace facebook::react
@@ -591,17 +591,6 @@ const definitions: FeatureFlagDefinitions = {
},
ossReleaseStage: 'experimental',
},
releaseImageDataWhenConsumed: {
defaultValue: false,
metadata: {
dateAdded: '2025-07-10',
description:
'Releases the cached image data when it is consumed by the observers.',
expectedReleaseValue: true,
purpose: 'experimentation',
},
ossReleaseStage: 'none',
},
shouldPressibilityUseW3CPointerEventsForHover: {
defaultValue: false,
metadata: {
@@ -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<<22523248acc3e378f3f81ef43406f106>>
* @generated SignedSource<<7de65fc90fa1275f89375fd214b94172>>
* @flow strict
* @noformat
*/
@@ -101,7 +101,6 @@ export type ReactNativeFeatureFlags = $ReadOnly<{
perfMonitorV2Enabled: Getter<boolean>,
preparedTextCacheSize: Getter<number>,
preventShadowTreeCommitExhaustion: Getter<boolean>,
releaseImageDataWhenConsumed: Getter<boolean>,
shouldPressibilityUseW3CPointerEventsForHover: Getter<boolean>,
skipActivityIdentityAssertionOnHostPause: Getter<boolean>,
sweepActiveTouchOnChildNativeGesturesAndroid: Getter<boolean>,
@@ -404,10 +403,6 @@ export const preparedTextCacheSize: Getter<number> = createNativeFlagGetter('pre
* Enables a new mechanism in ShadowTree to prevent problems caused by multiple threads trying to commit concurrently. If a thread tries to commit a few times unsuccessfully, it will acquire a lock and try again.
*/
export const preventShadowTreeCommitExhaustion: Getter<boolean> = createNativeFlagGetter('preventShadowTreeCommitExhaustion', false);
/**
* Releases the cached image data when it is consumed by the observers.
*/
export const releaseImageDataWhenConsumed: Getter<boolean> = createNativeFlagGetter('releaseImageDataWhenConsumed', false);
/**
* Function used to enable / disable Pressibility from using W3C Pointer Events for its hover callbacks
*/
@@ -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<<6d699b7dc91fce5814db79d7f19ba511>>
* @generated SignedSource<<1e6f17de0ebb06a085d4cc563df1e32b>>
* @flow strict
* @noformat
*/
@@ -76,7 +76,6 @@ export interface Spec extends TurboModule {
+perfMonitorV2Enabled?: () => boolean;
+preparedTextCacheSize?: () => number;
+preventShadowTreeCommitExhaustion?: () => boolean;
+releaseImageDataWhenConsumed?: () => boolean;
+shouldPressibilityUseW3CPointerEventsForHover?: () => boolean;
+skipActivityIdentityAssertionOnHostPause?: () => boolean;
+sweepActiveTouchOnChildNativeGesturesAndroid?: () => boolean;