From 4cbcb7a13abc2f4824ee7b0022ce1d2530ab533d Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Thu, 3 Feb 2022 04:48:48 -0800 Subject: [PATCH] Abandon mc react_fabric.enable_event_emitter_wrapper_raw_pointer Summary: changelog: [internal] Remove gating. Reviewed By: philIip Differential Revision: D33944220 fbshipit-source-id: bba076a2166f8d676119d5c069a3894e3d547285 --- .../com/facebook/react/fabric/jni/Binding.cpp | 8 ++------ .../com/facebook/react/fabric/jni/Binding.h | 1 - .../react/fabric/jni/EventEmitterWrapper.cpp | 13 ------------ .../react/fabric/jni/EventEmitterWrapper.h | 1 - .../fabric/jni/FabricMountingManager.cpp | 20 +++---------------- .../react/fabric/jni/FabricMountingManager.h | 1 - 6 files changed, 5 insertions(+), 39 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp index 26eacc5cae0e50..bceda787150b6f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp @@ -60,9 +60,8 @@ Binding::getInspectorDataForInstance( } EventEmitterWrapper *cEventEmitter = cthis(eventEmitterWrapper); - InspectorData data = scheduler->getInspectorDataForInstance( - enableEventEmitterRawPointer_ ? *cEventEmitter->eventEmitterPointer - : *cEventEmitter->eventEmitter); + InspectorData data = + scheduler->getInspectorDataForInstance(*cEventEmitter->eventEmitter); folly::dynamic result = folly::dynamic::object; result["fileName"] = data.fileName; @@ -369,9 +368,6 @@ void Binding::installFabricUIManager( disableRevisionCheckForPreallocation_ = config->getBool("react_fabric:disable_revision_check_for_preallocation"); - enableEventEmitterRawPointer_ = - config->getBool("react_fabric:enable_event_emitter_wrapper_raw_pointer"); - if (enableFabricLogs_) { LOG(WARNING) << "Binding::installFabricUIManager() was called (address: " << this << ")."; diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h index db537efddbc6ab..90099106bbfc32 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h @@ -155,7 +155,6 @@ class Binding : public jni::HybridClass, bool disablePreallocateViews_{false}; bool enableFabricLogs_{false}; bool disableRevisionCheckForPreallocation_{false}; - bool enableEventEmitterRawPointer_{false}; bool dispatchPreallocationInBackground_{false}; }; diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.cpp index 262ac0d23d25e5..19a003793d339e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.cpp @@ -22,15 +22,6 @@ void EventEmitterWrapper::invokeEvent( std::string const &eventName, NativeMap *payload, int category) { - if (eventEmitterPointer) { - eventEmitterPointer->dispatchEvent( - eventName, - payload->consume(), - EventPriority::AsynchronousBatched, - static_cast(category)); - return; - } - // It is marginal, but possible for this to be constructed without a valid // EventEmitter. In those cases, make sure we noop/blackhole events instead of // crashing. @@ -47,10 +38,6 @@ void EventEmitterWrapper::invokeUniqueEvent( std::string const &eventName, NativeMap *payload, int customCoalesceKey) { - if (eventEmitterPointer) { - eventEmitterPointer->dispatchUniqueEvent(eventName, payload->consume()); - return; - } // TODO: customCoalesceKey currently unused // It is marginal, but possible for this to be constructed without a valid // EventEmitter. In those cases, make sure we noop/blackhole events instead of diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.h index f7a6d6e11fbd3d..4f4d68fb5cea38 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.h @@ -24,7 +24,6 @@ class EventEmitterWrapper : public jni::HybridClass { static void registerNatives(); SharedEventEmitter eventEmitter; - EventEmitter const *eventEmitterPointer; void invokeEvent(std::string const &eventName, NativeMap *params, int category); diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.cpp index e88af4c229918f..5121593409f4af 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.cpp @@ -545,11 +545,7 @@ void FabricMountingManager::executeMount( mountItem.newChildShadowView.eventEmitter; auto javaEventEmitter = EventEmitterWrapper::newObjectJavaArgs(); EventEmitterWrapper *cEventEmitter = cthis(javaEventEmitter); - if (enableEventEmitterRawPointer_) { - cEventEmitter->eventEmitterPointer = eventEmitter.get(); - } else { - cEventEmitter->eventEmitter = eventEmitter; - } + cEventEmitter->eventEmitter = eventEmitter; temp[0] = mountItem.newChildShadowView.tag; temp[1] = isLayoutable; env->SetIntArrayRegion(intBufferArray, intBufferPosition, 2, temp); @@ -729,11 +725,7 @@ void FabricMountingManager::executeMount( // Do not hold a reference to javaEventEmitter from the C++ side. auto javaEventEmitter = EventEmitterWrapper::newObjectJavaArgs(); EventEmitterWrapper *cEventEmitter = cthis(javaEventEmitter); - if (enableEventEmitterRawPointer_) { - cEventEmitter->eventEmitterPointer = eventEmitter.get(); - } else { - cEventEmitter->eventEmitter = eventEmitter; - } + cEventEmitter->eventEmitter = eventEmitter; (*objBufferArray)[objBufferPosition++] = javaEventEmitter.get(); } @@ -830,11 +822,7 @@ void FabricMountingManager::preallocateShadowView( if (eventEmitter != nullptr) { javaEventEmitter = EventEmitterWrapper::newObjectJavaArgs(); EventEmitterWrapper *cEventEmitter = cthis(javaEventEmitter); - if (enableEventEmitterRawPointer_) { - cEventEmitter->eventEmitterPointer = eventEmitter.get(); - } else { - cEventEmitter->eventEmitter = eventEmitter; - } + cEventEmitter->eventEmitter = eventEmitter; } } @@ -947,8 +935,6 @@ FabricMountingManager::FabricMountingManager( : javaUIManager_(javaUIManager) { enableEarlyEventEmitterUpdate_ = config->getBool("react_fabric:enable_early_event_emitter_update"); - enableEventEmitterRawPointer_ = - config->getBool("react_fabric:enable_event_emitter_wrapper_raw_pointer"); disablePreallocateViews_ = config->getBool("react_fabric:disabled_view_preallocation_android"); disableRevisionCheckForPreallocation_ = diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.h index 0ac9ac2e4ab543..618d24154b7113 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.h @@ -71,7 +71,6 @@ class FabricMountingManager { butter::map> allocatedViewRegistry_{}; std::recursive_mutex allocatedViewsMutex_; - bool enableEventEmitterRawPointer_{false}; bool enableEarlyEventEmitterUpdate_{false}; bool disablePreallocateViews_{false}; bool disableRevisionCheckForPreallocation_{false};