Skip to content
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<<b7ef80c2c39c734ae511fe6457b89ce7>>
* @generated SignedSource<<81881de9b76278747729c885278d5979>>
*/

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

/**
* Make the batched-event-dispatch Choreographer frame callback one-shot on Android instead of re-posting itself every frame
*/
@JvmStatic
public fun disableIdleEventDispatchFrameCallbackRearmAndroid(): Boolean = accessor.disableIdleEventDispatchFrameCallbackRearmAndroid()

/**
* Force disable view preallocation for images triggered from createNode off the main thread on Android
*/
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<<68aefd0293540d56f57e8badc0de04c8>>
* @generated SignedSource<<b86faf6298413867cd15a961c471ef61>>
*/

/**
Expand All @@ -25,6 +25,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var cxxNativeAnimatedEnabledCache: Boolean? = null
private var defaultTextToOverflowHiddenCache: Boolean? = null
private var disableEarlyViewCommandExecutionCache: Boolean? = null
private var disableIdleEventDispatchFrameCallbackRearmAndroidCache: Boolean? = null
private var disableImageViewPreallocationAndroidCache: Boolean? = null
private var disableMountItemReorderingAndroidCache: Boolean? = null
private var disableSubviewClippingAndroidCache: Boolean? = null
Expand Down Expand Up @@ -152,6 +153,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

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

override fun disableImageViewPreallocationAndroid(): Boolean {
var cached = disableImageViewPreallocationAndroidCache
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<<247f721796621af8615014477518bcd9>>
* @generated SignedSource<<0aa893cd993b1de7807374abe9afac6e>>
*/

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

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

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

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

@DoNotStrip @JvmStatic public external fun disableMountItemReorderingAndroid(): 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<<33071257f9c96a8664c9af429e387061>>
* @generated SignedSource<<73704199efa601629d7daecd72bfd757>>
*/

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

override fun disableEarlyViewCommandExecution(): Boolean = false

override fun disableIdleEventDispatchFrameCallbackRearmAndroid(): Boolean = false

override fun disableImageViewPreallocationAndroid(): Boolean = false

override fun disableMountItemReorderingAndroid(): Boolean = false
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<<f218220c66b8367211cae49adba46afc>>
* @generated SignedSource<<8e7dc15c83b5f199fe0bdef94cd4b146>>
*/

/**
Expand All @@ -29,6 +29,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var cxxNativeAnimatedEnabledCache: Boolean? = null
private var defaultTextToOverflowHiddenCache: Boolean? = null
private var disableEarlyViewCommandExecutionCache: Boolean? = null
private var disableIdleEventDispatchFrameCallbackRearmAndroidCache: Boolean? = null
private var disableImageViewPreallocationAndroidCache: Boolean? = null
private var disableMountItemReorderingAndroidCache: Boolean? = null
private var disableSubviewClippingAndroidCache: Boolean? = null
Expand Down Expand Up @@ -161,6 +162,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}

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

override fun disableImageViewPreallocationAndroid(): Boolean {
var cached = disableImageViewPreallocationAndroidCache
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<<bad3dbaf92a0a869dfb91523ef4904f9>>
* @generated SignedSource<<0dafba2616cd5ae3f83064e1ef48e86b>>
*/

/**
Expand All @@ -23,6 +23,8 @@ public open class ReactNativeFeatureFlagsOverrides_RNOSS_Experimental_Android :
// We could use JNI to get the defaults from C++,
// but that is more expensive than just duplicating the defaults here.

override fun disableIdleEventDispatchFrameCallbackRearmAndroid(): Boolean = true

override fun enableFlexboxAutoMinSizeInStrictMode(): Boolean = true

override fun preventShadowTreeCommitExhaustion(): 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<<915bf918212b9898319de61d4cadaa13>>
* @generated SignedSource<<08a63133bb8e8f4bbd7826f425220292>>
*/

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

@DoNotStrip public fun disableEarlyViewCommandExecution(): Boolean

@DoNotStrip public fun disableIdleEventDispatchFrameCallbackRearmAndroid(): Boolean

@DoNotStrip public fun disableImageViewPreallocationAndroid(): Boolean

@DoNotStrip public fun disableMountItemReorderingAndroid(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReactSoftExceptionLogger
import com.facebook.react.bridge.UiThreadUtil
import com.facebook.react.common.annotations.UnstableReactNativeAPI
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
import com.facebook.react.modules.core.ReactChoreographer
import com.facebook.react.uimanager.UIManagerHelper
import com.facebook.react.uimanager.common.UIManagerType
Expand Down Expand Up @@ -147,10 +148,18 @@ internal class FabricEventDispatcher(
override fun doFrame(frameTimeNanos: Long) {
UiThreadUtil.assertOnUiThread()

if (shouldStop) {
isFrameCallbackDispatchScheduled = false
if (!ReactNativeFeatureFlags.disableIdleEventDispatchFrameCallbackRearmAndroid()) {
if (shouldStop) {
isFrameCallbackDispatchScheduled = false
} else {
dispatchBatchedEvents()
}
} else {
dispatchBatchedEvents()
// One-shot semantics: events are dispatched synchronously as they are emitted, so a
// posted callback only needs to fire the batch-dispatched listeners once. Re-posting
// here kept the Choreographer armed at vsync rate while idle; new events re-post via
// maybeDispatchBatchedEvents (see scheduleDispatchOfBatchedEvents/dispatchEvent).
isFrameCallbackDispatchScheduled = false
}

Systrace.beginSection(Systrace.TRACE_TAG_REACT, "BatchEventDispatchedListeners")
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<<177c5cc7f6e970a2d4454c32d7f777ef>>
* @generated SignedSource<<2766e7e4ae9175ce3c44ce64f613dce3>>
*/

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

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

bool disableImageViewPreallocationAndroid() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("disableImageViewPreallocationAndroid");
Expand Down Expand Up @@ -584,6 +590,11 @@ bool JReactNativeFeatureFlagsCxxInterop::disableEarlyViewCommandExecution(
return ReactNativeFeatureFlags::disableEarlyViewCommandExecution();
}

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

bool JReactNativeFeatureFlagsCxxInterop::disableImageViewPreallocationAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::disableImageViewPreallocationAndroid();
Expand Down Expand Up @@ -1035,6 +1046,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"disableEarlyViewCommandExecution",
JReactNativeFeatureFlagsCxxInterop::disableEarlyViewCommandExecution),
makeNativeMethod(
"disableIdleEventDispatchFrameCallbackRearmAndroid",
JReactNativeFeatureFlagsCxxInterop::disableIdleEventDispatchFrameCallbackRearmAndroid),
makeNativeMethod(
"disableImageViewPreallocationAndroid",
JReactNativeFeatureFlagsCxxInterop::disableImageViewPreallocationAndroid),
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<<eab10e240a16c8ef3f659bd8ded290f0>>
* @generated SignedSource<<eabe14de70d72996fb1bbd807754afff>>
*/

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

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

static bool disableImageViewPreallocationAndroid(
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<<7b726d7483bb35062b79e582323f0d7e>>
* @generated SignedSource<<3ba5626c6372ae6aaae6907937ee5841>>
*/

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

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

bool ReactNativeFeatureFlags::disableImageViewPreallocationAndroid() {
return getAccessor().disableImageViewPreallocationAndroid();
}
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<<1e9009301b79f977132c4fa5599aebdd>>
* @generated SignedSource<<0e3a9c187cdb83b596e45b3ead29d5a7>>
*/

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

/**
* Make the batched-event-dispatch Choreographer frame callback one-shot on Android instead of re-posting itself every frame
*/
RN_EXPORT static bool disableIdleEventDispatchFrameCallbackRearmAndroid();

/**
* Force disable view preallocation for images triggered from createNode off the main thread on Android
*/
Expand Down
Loading
Loading