Skip to content
Closed
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<<66a87f8b82a1b3497eb9181a4ac6bab7>>
* @generated SignedSource<<9646ebeba75ec903be5ade7e2333f0c8>>
*/

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

/**
* Uses an optimized mechanism for event batching on Android that does not need to wait for a Choreographer frame callback.
*/
@JvmStatic
public fun useOptimizedEventBatchingOnAndroid(): Boolean = accessor.useOptimizedEventBatchingOnAndroid()

/**
* Instead of using folly::dynamic as internal representation in RawProps and RawValue, use jsi::Value
*/
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<<5112bb2a180751673d4197088af9fdd1>>
* @generated SignedSource<<9d6ccbe6d02608901fc18ad88baab176>>
*/

/**
Expand Down Expand Up @@ -93,7 +93,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var useNativeEqualsInNativeReadableArrayAndroidCache: Boolean? = null
private var useNativeTransformHelperAndroidCache: Boolean? = null
private var useNativeViewConfigsInBridgelessModeCache: Boolean? = null
private var useOptimizedEventBatchingOnAndroidCache: Boolean? = null
private var useRawPropsJsiValueCache: Boolean? = null
private var useShadowNodeStateOnCloneCache: Boolean? = null
private var useSharedAnimatedBackendCache: Boolean? = null
Expand Down Expand Up @@ -761,15 +760,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

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

override fun useRawPropsJsiValue(): Boolean {
var cached = useRawPropsJsiValueCache
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<<d98233be82b913d6327c29a897d09eb7>>
* @generated SignedSource<<fbc551ca005a7d8abcd2cf2e5d29a3a6>>
*/

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

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

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

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

@DoNotStrip @JvmStatic public external fun useShadowNodeStateOnClone(): 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<<32ad8dfa8f1c1d662ff0ea7b424eb070>>
* @generated SignedSource<<7b8a5ad9a3353ea32a39bd139e9174f7>>
*/

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

override fun useNativeViewConfigsInBridgelessMode(): Boolean = false

override fun useOptimizedEventBatchingOnAndroid(): Boolean = false

override fun useRawPropsJsiValue(): Boolean = true

override fun useShadowNodeStateOnClone(): 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<<b10ff10cb0d389a563da50c75a49c746>>
* @generated SignedSource<<9bb9a7cf89c92f5a397b2328fa983dc6>>
*/

/**
Expand Down Expand Up @@ -97,7 +97,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var useNativeEqualsInNativeReadableArrayAndroidCache: Boolean? = null
private var useNativeTransformHelperAndroidCache: Boolean? = null
private var useNativeViewConfigsInBridgelessModeCache: Boolean? = null
private var useOptimizedEventBatchingOnAndroidCache: Boolean? = null
private var useRawPropsJsiValueCache: Boolean? = null
private var useShadowNodeStateOnCloneCache: Boolean? = null
private var useSharedAnimatedBackendCache: Boolean? = null
Expand Down Expand Up @@ -838,16 +837,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}

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

override fun useRawPropsJsiValue(): Boolean {
var cached = useRawPropsJsiValueCache
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<<c4917c92012d904810ef7d832adf124c>>
* @generated SignedSource<<eeb5d70e45eecdef0d9307cbe8ff17c2>>
*/

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

@DoNotStrip public fun useNativeViewConfigsInBridgelessMode(): Boolean

@DoNotStrip public fun useOptimizedEventBatchingOnAndroid(): Boolean

@DoNotStrip public fun useRawPropsJsiValue(): Boolean

@DoNotStrip public fun useShadowNodeStateOnClone(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@

package com.facebook.react.uimanager.events

import android.os.Handler
import android.view.Choreographer
import com.facebook.react.bridge.LifecycleEventListener
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 All @@ -41,19 +39,6 @@ internal class FabricEventDispatcher(
private val postEventDispatchListeners = CopyOnWriteArrayList<BatchEventDispatchedListener>()
private val currentFrameCallback = ScheduleDispatchFrameCallback()

private var isDispatchScheduled = false
private val dispatchEventsRunnable = Runnable {
isDispatchScheduled = false
Systrace.beginSection(Systrace.TRACE_TAG_REACT, "BatchEventDispatchedListeners")
try {
for (listener in postEventDispatchListeners) {
listener.onBatchEventDispatched()
}
} finally {
Systrace.endSection(Systrace.TRACE_TAG_REACT)
}
}

init {
reactContext.addLifecycleEventListener(this)
eventEmitter.registerFabricEventEmitter(fabricEventEmitter)
Expand Down Expand Up @@ -109,14 +94,7 @@ internal class FabricEventDispatcher(
}

private fun scheduleDispatchOfBatchedEvents() {
if (ReactNativeFeatureFlags.useOptimizedEventBatchingOnAndroid()) {
if (!isDispatchScheduled) {
isDispatchScheduled = true
uiThreadHandler.postAtFrontOfQueue(dispatchEventsRunnable)
}
} else {
currentFrameCallback.maybeScheduleDispatchOfBatchedEvents()
}
currentFrameCallback.maybeScheduleDispatchOfBatchedEvents()
}

/** Add a listener to this EventDispatcher. */
Expand All @@ -139,9 +117,7 @@ internal class FabricEventDispatcher(

override fun onHostResume() {
scheduleDispatchOfBatchedEvents()
if (!ReactNativeFeatureFlags.useOptimizedEventBatchingOnAndroid()) {
currentFrameCallback.resume()
}
currentFrameCallback.resume()
}

override fun onHostPause() {
Expand All @@ -165,12 +141,7 @@ internal class FabricEventDispatcher(

private fun cancelDispatchOfBatchedEvents() {
UiThreadUtil.assertOnUiThread()
if (ReactNativeFeatureFlags.useOptimizedEventBatchingOnAndroid()) {
isDispatchScheduled = false
uiThreadHandler.removeCallbacks(dispatchEventsRunnable)
} else {
currentFrameCallback.stop()
}
currentFrameCallback.stop()
}

private inner class ScheduleDispatchFrameCallback : Choreographer.FrameCallback {
Expand Down Expand Up @@ -229,8 +200,4 @@ internal class FabricEventDispatcher(
}
}
}

private companion object {
private val uiThreadHandler: Handler = UiThreadUtil.getUiThreadHandler()
}
}
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<<ddcb4ebb0a1e5e80364d081650286b96>>
* @generated SignedSource<<0527dbb4a838be34b80d76b11d18cea0>>
*/

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

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

bool useRawPropsJsiValue() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("useRawPropsJsiValue");
Expand Down Expand Up @@ -906,11 +900,6 @@ bool JReactNativeFeatureFlagsCxxInterop::useNativeViewConfigsInBridgelessMode(
return ReactNativeFeatureFlags::useNativeViewConfigsInBridgelessMode();
}

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

bool JReactNativeFeatureFlagsCxxInterop::useRawPropsJsiValue(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::useRawPropsJsiValue();
Expand Down Expand Up @@ -1206,9 +1195,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"useNativeViewConfigsInBridgelessMode",
JReactNativeFeatureFlagsCxxInterop::useNativeViewConfigsInBridgelessMode),
makeNativeMethod(
"useOptimizedEventBatchingOnAndroid",
JReactNativeFeatureFlagsCxxInterop::useOptimizedEventBatchingOnAndroid),
makeNativeMethod(
"useRawPropsJsiValue",
JReactNativeFeatureFlagsCxxInterop::useRawPropsJsiValue),
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<<1e735f99b2d275f5065fb7959e45adc5>>
* @generated SignedSource<<a1deb0145d8c51d608903e1704e96b8d>>
*/

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

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

static bool useRawPropsJsiValue(
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<<5a7c80b50fda63afb95e8c6f4651eebc>>
* @generated SignedSource<<a2224b72c2e27abf6a158aa1b4fe9ed0>>
*/

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

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

bool ReactNativeFeatureFlags::useRawPropsJsiValue() {
return getAccessor().useRawPropsJsiValue();
}
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<<8122e5c1e177a8f3deb2462a86f7cf64>>
* @generated SignedSource<<467f48f2231ceb6772a9a9da9e3badb9>>
*/

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

/**
* Uses an optimized mechanism for event batching on Android that does not need to wait for a Choreographer frame callback.
*/
RN_EXPORT static bool useOptimizedEventBatchingOnAndroid();

/**
* Instead of using folly::dynamic as internal representation in RawProps and RawValue, use jsi::Value
*/
Expand Down
Loading
Loading