Skip to content

Commit 3895831

Browse files
sammy-SCfacebook-github-bot
authored andcommitted
ship releaseImageDataWhenConsumed (#53576)
Summary: Pull Request resolved: #53576 ## Changelog: [iOS] [Fixed] - Images are removed from memory more aggressively to prevent OOMs Reviewed By: rshest Differential Revision: D81490116 fbshipit-source-id: d6b12af2d80e1c0a9ab3c624a549088b300feb3e
1 parent 9fbce3e commit 3895831

21 files changed

Lines changed: 40 additions & 159 deletions

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

Lines changed: 1 addition & 7 deletions
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<<a5534457a42ada7d6e2a5d820844b782>>
7+
* @generated SignedSource<<a59b42b84160c18d214f8b2be76bc743>>
88
*/
99

1010
/**
@@ -336,12 +336,6 @@ public object ReactNativeFeatureFlags {
336336
@JvmStatic
337337
public fun preventShadowTreeCommitExhaustion(): Boolean = accessor.preventShadowTreeCommitExhaustion()
338338

339-
/**
340-
* Releases the cached image data when it is consumed by the observers.
341-
*/
342-
@JvmStatic
343-
public fun releaseImageDataWhenConsumed(): Boolean = accessor.releaseImageDataWhenConsumed()
344-
345339
/**
346340
* Function used to enable / disable Pressibility from using W3C Pointer Events for its hover callbacks
347341
*/

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

Lines changed: 1 addition & 11 deletions
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<<7dbb21bddd9c2ae447c83923a25372e4>>
7+
* @generated SignedSource<<37203dffb9421d1036aaeaeaa7319e28>>
88
*/
99

1010
/**
@@ -71,7 +71,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
7171
private var perfMonitorV2EnabledCache: Boolean? = null
7272
private var preparedTextCacheSizeCache: Double? = null
7373
private var preventShadowTreeCommitExhaustionCache: Boolean? = null
74-
private var releaseImageDataWhenConsumedCache: Boolean? = null
7574
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
7675
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
7776
private var sweepActiveTouchOnChildNativeGesturesAndroidCache: Boolean? = null
@@ -549,15 +548,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
549548
return cached
550549
}
551550

552-
override fun releaseImageDataWhenConsumed(): Boolean {
553-
var cached = releaseImageDataWhenConsumedCache
554-
if (cached == null) {
555-
cached = ReactNativeFeatureFlagsCxxInterop.releaseImageDataWhenConsumed()
556-
releaseImageDataWhenConsumedCache = cached
557-
}
558-
return cached
559-
}
560-
561551
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean {
562552
var cached = shouldPressibilityUseW3CPointerEventsForHoverCache
563553
if (cached == null) {

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

Lines changed: 1 addition & 3 deletions
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<<4f93b4eb8f3cb427d3b926ffa18f9f9b>>
7+
* @generated SignedSource<<9c0acc876e3205fe2ea181e71eb512c9>>
88
*/
99

1010
/**
@@ -130,8 +130,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
130130

131131
@DoNotStrip @JvmStatic public external fun preventShadowTreeCommitExhaustion(): Boolean
132132

133-
@DoNotStrip @JvmStatic public external fun releaseImageDataWhenConsumed(): Boolean
134-
135133
@DoNotStrip @JvmStatic public external fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean
136134

137135
@DoNotStrip @JvmStatic public external fun skipActivityIdentityAssertionOnHostPause(): Boolean

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

Lines changed: 1 addition & 3 deletions
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<<731176315c5589990865a0995f8b7e20>>
7+
* @generated SignedSource<<05bfed9fc7131062c8b16246986fc999>>
88
*/
99

1010
/**
@@ -125,8 +125,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
125125

126126
override fun preventShadowTreeCommitExhaustion(): Boolean = false
127127

128-
override fun releaseImageDataWhenConsumed(): Boolean = false
129-
130128
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean = false
131129

132130
override fun skipActivityIdentityAssertionOnHostPause(): Boolean = false

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

Lines changed: 1 addition & 12 deletions
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<<7af6546cb6e02afcfca90635b3cbe603>>
7+
* @generated SignedSource<<9a18369464f81c3d03f2702716dfdb29>>
88
*/
99

1010
/**
@@ -75,7 +75,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
7575
private var perfMonitorV2EnabledCache: Boolean? = null
7676
private var preparedTextCacheSizeCache: Double? = null
7777
private var preventShadowTreeCommitExhaustionCache: Boolean? = null
78-
private var releaseImageDataWhenConsumedCache: Boolean? = null
7978
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
8079
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
8180
private var sweepActiveTouchOnChildNativeGesturesAndroidCache: Boolean? = null
@@ -604,16 +603,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
604603
return cached
605604
}
606605

607-
override fun releaseImageDataWhenConsumed(): Boolean {
608-
var cached = releaseImageDataWhenConsumedCache
609-
if (cached == null) {
610-
cached = currentProvider.releaseImageDataWhenConsumed()
611-
accessedFeatureFlags.add("releaseImageDataWhenConsumed")
612-
releaseImageDataWhenConsumedCache = cached
613-
}
614-
return cached
615-
}
616-
617606
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean {
618607
var cached = shouldPressibilityUseW3CPointerEventsForHoverCache
619608
if (cached == null) {

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

Lines changed: 1 addition & 3 deletions
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<<9a982d4167179619629627529916259b>>
7+
* @generated SignedSource<<845b2ee5edc9aedbdbd052d9a930f666>>
88
*/
99

1010
/**
@@ -125,8 +125,6 @@ public interface ReactNativeFeatureFlagsProvider {
125125

126126
@DoNotStrip public fun preventShadowTreeCommitExhaustion(): Boolean
127127

128-
@DoNotStrip public fun releaseImageDataWhenConsumed(): Boolean
129-
130128
@DoNotStrip public fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean
131129

132130
@DoNotStrip public fun skipActivityIdentityAssertionOnHostPause(): Boolean

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

Lines changed: 1 addition & 15 deletions
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<<6e451f1b402ee9f80e86d0ee6b808f05>>
7+
* @generated SignedSource<<d1dda9d6cd1c0179472fcc0631e46fcd>>
88
*/
99

1010
/**
@@ -345,12 +345,6 @@ class ReactNativeFeatureFlagsJavaProvider
345345
return method(javaProvider_);
346346
}
347347

348-
bool releaseImageDataWhenConsumed() override {
349-
static const auto method =
350-
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("releaseImageDataWhenConsumed");
351-
return method(javaProvider_);
352-
}
353-
354348
bool shouldPressibilityUseW3CPointerEventsForHover() override {
355349
static const auto method =
356350
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("shouldPressibilityUseW3CPointerEventsForHover");
@@ -712,11 +706,6 @@ bool JReactNativeFeatureFlagsCxxInterop::preventShadowTreeCommitExhaustion(
712706
return ReactNativeFeatureFlags::preventShadowTreeCommitExhaustion();
713707
}
714708

715-
bool JReactNativeFeatureFlagsCxxInterop::releaseImageDataWhenConsumed(
716-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
717-
return ReactNativeFeatureFlags::releaseImageDataWhenConsumed();
718-
}
719-
720709
bool JReactNativeFeatureFlagsCxxInterop::shouldPressibilityUseW3CPointerEventsForHover(
721710
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
722711
return ReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover();
@@ -986,9 +975,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
986975
makeNativeMethod(
987976
"preventShadowTreeCommitExhaustion",
988977
JReactNativeFeatureFlagsCxxInterop::preventShadowTreeCommitExhaustion),
989-
makeNativeMethod(
990-
"releaseImageDataWhenConsumed",
991-
JReactNativeFeatureFlagsCxxInterop::releaseImageDataWhenConsumed),
992978
makeNativeMethod(
993979
"shouldPressibilityUseW3CPointerEventsForHover",
994980
JReactNativeFeatureFlagsCxxInterop::shouldPressibilityUseW3CPointerEventsForHover),

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

Lines changed: 1 addition & 4 deletions
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<<81d70a5d005d308fdc3df3d0e7ec69b9>>
7+
* @generated SignedSource<<31298767c1dd669d2a755e67edacc911>>
88
*/
99

1010
/**
@@ -183,9 +183,6 @@ class JReactNativeFeatureFlagsCxxInterop
183183
static bool preventShadowTreeCommitExhaustion(
184184
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
185185

186-
static bool releaseImageDataWhenConsumed(
187-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
188-
189186
static bool shouldPressibilityUseW3CPointerEventsForHover(
190187
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
191188

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

Lines changed: 1 addition & 5 deletions
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<<c9ccf7038a26788fe2853ba1fabe8615>>
7+
* @generated SignedSource<<9a538d3ebb58173e7e4e34453b71454b>>
88
*/
99

1010
/**
@@ -230,10 +230,6 @@ bool ReactNativeFeatureFlags::preventShadowTreeCommitExhaustion() {
230230
return getAccessor().preventShadowTreeCommitExhaustion();
231231
}
232232

233-
bool ReactNativeFeatureFlags::releaseImageDataWhenConsumed() {
234-
return getAccessor().releaseImageDataWhenConsumed();
235-
}
236-
237233
bool ReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover() {
238234
return getAccessor().shouldPressibilityUseW3CPointerEventsForHover();
239235
}

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

Lines changed: 1 addition & 6 deletions
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<<83c1c5b181d47f4a54cb097f8d31c48a>>
7+
* @generated SignedSource<<3321d357fe5c74fa42c2d0b15a744f87>>
88
*/
99

1010
/**
@@ -294,11 +294,6 @@ class ReactNativeFeatureFlags {
294294
*/
295295
RN_EXPORT static bool preventShadowTreeCommitExhaustion();
296296

297-
/**
298-
* Releases the cached image data when it is consumed by the observers.
299-
*/
300-
RN_EXPORT static bool releaseImageDataWhenConsumed();
301-
302297
/**
303298
* Function used to enable / disable Pressibility from using W3C Pointer Events for its hover callbacks
304299
*/

0 commit comments

Comments
 (0)