diff --git a/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java b/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java index 25752febfa2..133bba6a9f5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java +++ b/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java @@ -82,8 +82,6 @@ public class ReactFeatureFlags { /** Feature Flag to use overflowInset values provided by Yoga */ public static boolean useOverflowInset = false; - public static boolean enableLockFreeEventDispatcher = false; - public static boolean enableAggressiveEventEmitterCleanup = false; public static boolean insertZReorderBarriersOnViewGroupChildren = true; diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java index a46b984e9e7..e0947264fd9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java @@ -81,7 +81,6 @@ import com.facebook.react.uimanager.ViewManagerRegistry; import com.facebook.react.uimanager.events.EventCategoryDef; import com.facebook.react.uimanager.events.EventDispatcher; import com.facebook.react.uimanager.events.EventDispatcherImpl; -import com.facebook.react.uimanager.events.LockFreeEventDispatcherImpl; import com.facebook.react.views.text.TextLayoutManager; import com.facebook.react.views.text.TextLayoutManagerMapBuffer; import java.util.HashMap; @@ -241,10 +240,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener { mMountingManager = new MountingManager(viewManagerRegistry, mMountItemExecutor); mMountItemDispatcher = new MountItemDispatcher(mMountingManager, new MountItemDispatchListener()); - mEventDispatcher = - ReactFeatureFlags.enableLockFreeEventDispatcher - ? new LockFreeEventDispatcherImpl(reactContext) - : new EventDispatcherImpl(reactContext); + mEventDispatcher = new EventDispatcherImpl(reactContext); mShouldDeallocateEventDispatcher = true; mEventBeatManager = eventBeatManager; mReactApplicationContext.addLifecycleEventListener(this); diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/LockFreeEventDispatcherImpl.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/LockFreeEventDispatcherImpl.java deleted file mode 100644 index 4c62d7aeca7..00000000000 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/LockFreeEventDispatcherImpl.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.uimanager.events; - -import com.facebook.common.logging.FLog; -import com.facebook.infer.annotation.Assertions; -import com.facebook.react.bridge.LifecycleEventListener; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.UiThreadUtil; -import com.facebook.react.common.build.ReactBuildConfig; -import com.facebook.react.modules.core.ChoreographerCompat; -import com.facebook.react.modules.core.ReactChoreographer; -import com.facebook.react.uimanager.common.UIManagerType; -import java.util.concurrent.CopyOnWriteArrayList; - -/** - * Class responsible for dispatching UI events to JS. The main purpose of this class is to act as an - * intermediary between UI code generating events and JS, making sure we don't send more events than - * JS can process. - * - *
To use it, create a subclass of {@link Event} and call {@link #dispatchEvent(Event)} whenever - * there's a UI event to dispatch. - * - *
This class works by installing a Choreographer frame callback on the main thread. This - * callback then enqueues a runnable on the JS thread (if one is not already pending) that is - * responsible for actually dispatch events to JS. This implementation depends on the properties - * that 1) FrameCallbacks run after UI events have been processed in Choreographer.java 2) when we - * enqueue a runnable on the JS queue thread, it won't be called until after any previously enqueued - * JS jobs have finished processing - * - *
If JS is taking a long time processing events, then the UI events generated on the UI thread - * can be coalesced into fewer events so that when the runnable runs, we don't overload JS with a - * ton of events and make it get even farther behind. - * - *
Ideally, we don't need this and JS is fast enough to process all the events each frame, but - * bad things happen, including load on CPUs from the system, and we should handle this case well. - * - *
== Event Cookies == - * - *
An event cookie is made up of the event type id, view tag, and a custom coalescing key. Only - * Events that have the same cookie can be coalesced. - * - *
Event Cookie Composition: VIEW_TAG_MASK = 0x00000000ffffffff EVENT_TYPE_ID_MASK = - * 0x0000ffff00000000 COALESCING_KEY_MASK = 0xffff000000000000 - * - *
This is a copy of EventDispatcherImpl, meant only to remove locking and synchronization.
- */
-public class LockFreeEventDispatcherImpl implements EventDispatcher, LifecycleEventListener {
-
- private final boolean DEBUG_MODE = ReactBuildConfig.DEBUG;
- private final String TAG = LockFreeEventDispatcherImpl.class.getSimpleName();
-
- private final ReactApplicationContext mReactContext;
- private final CopyOnWriteArrayList If this class ships for Fabric, we should remove `driveEventBeats` from here entirely,
- * because it no longer needs to be connected to this event dispatcher. We should/probably can
- * also delete `onRequestEventBeat` entirely.
- */
- private void driveEventBeats() {
- for (BatchEventDispatchedListener listener : mPostEventDispatchListeners) {
- listener.onBatchEventDispatched();
- }
- }
-}