mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Remove unused NotThreadSafeViewHierarchyUpdateDebugListener (#54558)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54558 This class is no longer used. It's a legacy arch class used to populate the legacy FPS counter. We can safely remove it now because we're on NewArch only. Marking this as breaking because I removed some methods from some public classes. Changelog: [Android] [Breaking] - Remove unused internal `NotThreadSafeViewHierarchyUpdateDebugListener` Reviewed By: mdvacca Differential Revision: D86964844 fbshipit-source-id: 154da4ecbdcfbabe964725e82eb21f4b4e119dc0
This commit is contained in:
1 parent
67dda17ecb
commit
991dff2322
7 files changed
+5
-90
No files matched your search
@@ -4328,7 +4328,6 @@ public class com/facebook/react/uimanager/UIImplementation {
|
||||
public fun setJSResponder (IZ)V
|
||||
public fun setLayoutAnimationEnabledExperimental (Z)V
|
||||
public fun setLayoutUpdateListener (Lcom/facebook/react/uimanager/UIImplementation$LayoutUpdateListener;)V
|
||||
public fun setViewHierarchyUpdateDebugListener (Lcom/facebook/react/uimanager/debug/NotThreadSafeViewHierarchyUpdateDebugListener;)V
|
||||
public fun setViewLocalData (ILjava/lang/Object;)V
|
||||
public fun synchronouslyUpdateViewOnUIThread (ILcom/facebook/react/uimanager/ReactStylesDiffMap;)V
|
||||
public fun updateInsetsPadding (IIIII)V
|
||||
@@ -4412,7 +4411,6 @@ public class com/facebook/react/uimanager/UIManagerModule : com/facebook/react/b
|
||||
public fun setChildren (ILcom/facebook/react/bridge/ReadableArray;)V
|
||||
public fun setJSResponder (IZ)V
|
||||
public fun setLayoutAnimationEnabledExperimental (Z)V
|
||||
public fun setViewHierarchyUpdateDebugListener (Lcom/facebook/react/uimanager/debug/NotThreadSafeViewHierarchyUpdateDebugListener;)V
|
||||
public fun setViewLocalData (ILjava/lang/Object;)V
|
||||
public fun startSurface (Landroid/view/View;Ljava/lang/String;Lcom/facebook/react/bridge/WritableMap;II)I
|
||||
public fun stopSurface (I)V
|
||||
@@ -4460,7 +4458,6 @@ public class com/facebook/react/uimanager/UIViewOperationQueue {
|
||||
public fun isEmpty ()Z
|
||||
public fun prependUIBlock (Lcom/facebook/react/uimanager/UIBlock;)V
|
||||
public fun profileNextBatch ()V
|
||||
public fun setViewHierarchyUpdateDebugListener (Lcom/facebook/react/uimanager/debug/NotThreadSafeViewHierarchyUpdateDebugListener;)V
|
||||
}
|
||||
|
||||
public abstract interface class com/facebook/react/uimanager/UIViewOperationQueue$UIOperation {
|
||||
|
||||
+1
-13
@@ -12,7 +12,6 @@
|
||||
package com.facebook.react.modules.debug
|
||||
|
||||
import com.facebook.react.bridge.NotThreadSafeBridgeIdleDebugListener
|
||||
import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener
|
||||
|
||||
/**
|
||||
* Debug object that listens to bridge busy/idle events and UiManagerModule dispatches and uses it
|
||||
@@ -21,8 +20,7 @@ import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugL
|
||||
* [getDidJSHitFrameAndCleanup] should be called once per frame via a
|
||||
* [android.view.Choreographer.FrameCallback].
|
||||
*/
|
||||
internal class DidJSUpdateUiDuringFrameDetector :
|
||||
NotThreadSafeBridgeIdleDebugListener, NotThreadSafeViewHierarchyUpdateDebugListener {
|
||||
internal class DidJSUpdateUiDuringFrameDetector : NotThreadSafeBridgeIdleDebugListener {
|
||||
private val transitionToIdleEvents = ArrayList<Long>(20)
|
||||
private val transitionToBusyEvents = ArrayList<Long>(20)
|
||||
private val viewHierarchyUpdateEnqueuedEvents = ArrayList<Long>(20)
|
||||
@@ -44,16 +42,6 @@ internal class DidJSUpdateUiDuringFrameDetector :
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun onViewHierarchyUpdateEnqueued() {
|
||||
viewHierarchyUpdateEnqueuedEvents.add(System.nanoTime())
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun onViewHierarchyUpdateFinished() {
|
||||
viewHierarchyUpdateFinishedEvents.add(System.nanoTime())
|
||||
}
|
||||
|
||||
/**
|
||||
* Designed to be called from a [android.view.Choreographer.FrameCallback.doFrame] call.
|
||||
*
|
||||
|
||||
+4
-12
@@ -61,8 +61,6 @@ internal class FpsDebugFrameCallback(private val reactContext: ReactContext) :
|
||||
// removeBridgeIdleDebugListener for Bridgeless
|
||||
@Suppress("DEPRECATION")
|
||||
if (!ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE) {
|
||||
val uiManagerModule =
|
||||
reactContext.getNativeModule(com.facebook.react.uimanager.UIManagerModule::class.java)
|
||||
if (!reactContext.isBridgeless) {
|
||||
reactContext.catalystInstance.addBridgeIdleDebugListener(didJSUpdateUiDuringFrameDetector)
|
||||
isRunningOnFabric = false
|
||||
@@ -71,7 +69,6 @@ internal class FpsDebugFrameCallback(private val reactContext: ReactContext) :
|
||||
// for Fabric or point users to use RNDT.
|
||||
isRunningOnFabric = true
|
||||
}
|
||||
uiManagerModule?.setViewHierarchyUpdateDebugListener(didJSUpdateUiDuringFrameDetector)
|
||||
}
|
||||
this.targetFps = targetFps
|
||||
UiThreadUtil.runOnUiThread {
|
||||
@@ -82,15 +79,10 @@ internal class FpsDebugFrameCallback(private val reactContext: ReactContext) :
|
||||
|
||||
fun stop() {
|
||||
@Suppress("DEPRECATION")
|
||||
if (!ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE) {
|
||||
val uiManagerModule =
|
||||
reactContext.getNativeModule(com.facebook.react.uimanager.UIManagerModule::class.java)
|
||||
if (!reactContext.isBridgeless) {
|
||||
reactContext.catalystInstance.removeBridgeIdleDebugListener(
|
||||
didJSUpdateUiDuringFrameDetector
|
||||
)
|
||||
}
|
||||
uiManagerModule?.setViewHierarchyUpdateDebugListener(null)
|
||||
if (
|
||||
!ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE && !reactContext.isBridgeless
|
||||
) {
|
||||
reactContext.catalystInstance.removeBridgeIdleDebugListener(didJSUpdateUiDuringFrameDetector)
|
||||
}
|
||||
UiThreadUtil.runOnUiThread {
|
||||
choreographer = Choreographer.getInstance()
|
||||
|
||||
-8
@@ -26,7 +26,6 @@ import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger;
|
||||
import com.facebook.react.common.build.ReactBuildConfig;
|
||||
import com.facebook.react.modules.i18nmanager.I18nUtil;
|
||||
import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.systrace.Systrace;
|
||||
import com.facebook.systrace.SystraceMessage;
|
||||
@@ -782,13 +781,6 @@ public class UIImplementation {
|
||||
mViewManagers.invalidate();
|
||||
}
|
||||
|
||||
// NOTE: When converted to Kotlin this method should be `internal` due to
|
||||
// visibility restriction for `NotThreadSafeViewHierarchyUpdateDebugListener`
|
||||
public void setViewHierarchyUpdateDebugListener(
|
||||
@Nullable NotThreadSafeViewHierarchyUpdateDebugListener listener) {
|
||||
mOperationsQueue.setViewHierarchyUpdateDebugListener(listener);
|
||||
}
|
||||
|
||||
protected final void removeShadowNode(ReactShadowNode nodeToRemove) {
|
||||
removeShadowNodeRecursive(nodeToRemove);
|
||||
nodeToRemove.dispose();
|
||||
|
||||
-8
@@ -45,7 +45,6 @@ import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger;
|
||||
import com.facebook.react.common.build.ReactBuildConfig;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
import com.facebook.react.uimanager.common.ViewUtil;
|
||||
import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.react.uimanager.events.EventDispatcherImpl;
|
||||
import com.facebook.react.uimanager.events.RCTEventEmitter;
|
||||
@@ -699,13 +698,6 @@ public class UIManagerModule extends ReactContextBaseJavaModule
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: When converted to Kotlin this method should be `internal` due to
|
||||
// visibility restriction for `NotThreadSafeViewHierarchyUpdateDebugListener`
|
||||
public void setViewHierarchyUpdateDebugListener(
|
||||
@Nullable NotThreadSafeViewHierarchyUpdateDebugListener listener) {
|
||||
mUIImplementation.setViewHierarchyUpdateDebugListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventDispatcher getEventDispatcher() {
|
||||
return mEventDispatcher;
|
||||
|
||||
-16
@@ -29,7 +29,6 @@ import com.facebook.react.common.annotations.internal.LegacyArchitecture;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger;
|
||||
import com.facebook.react.modules.core.ReactChoreographer;
|
||||
import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener;
|
||||
import com.facebook.systrace.Systrace;
|
||||
import com.facebook.systrace.SystraceMessage;
|
||||
import com.facebook.yoga.YogaDirection;
|
||||
@@ -584,7 +583,6 @@ public class UIViewOperationQueue {
|
||||
@GuardedBy("mNonBatchedOperationsLock")
|
||||
private ArrayDeque<UIOperation> mNonBatchedOperations = new ArrayDeque<>();
|
||||
|
||||
private @Nullable NotThreadSafeViewHierarchyUpdateDebugListener mViewHierarchyUpdateDebugListener;
|
||||
private boolean mIsDispatchUIFrameCallbackEnqueued = false;
|
||||
private boolean mIsInIllegalUIState = false;
|
||||
private boolean mIsProfilingNextBatch = false;
|
||||
@@ -619,13 +617,6 @@ public class UIViewOperationQueue {
|
||||
return mNativeViewHierarchyManager;
|
||||
}
|
||||
|
||||
// NOTE: When converted to Kotlin this method should be `internal` due to
|
||||
// visibility restriction for `NotThreadSafeViewHierarchyUpdateDebugListener`
|
||||
public void setViewHierarchyUpdateDebugListener(
|
||||
@Nullable NotThreadSafeViewHierarchyUpdateDebugListener listener) {
|
||||
mViewHierarchyUpdateDebugListener = listener;
|
||||
}
|
||||
|
||||
public void profileNextBatch() {
|
||||
mIsProfilingNextBatch = true;
|
||||
mProfiledBatchCommitStartTime = 0;
|
||||
@@ -833,10 +824,6 @@ public class UIViewOperationQueue {
|
||||
}
|
||||
}
|
||||
|
||||
if (mViewHierarchyUpdateDebugListener != null) {
|
||||
mViewHierarchyUpdateDebugListener.onViewHierarchyUpdateEnqueued();
|
||||
}
|
||||
|
||||
Runnable runOperations =
|
||||
new Runnable() {
|
||||
@Override
|
||||
@@ -926,9 +913,6 @@ public class UIViewOperationQueue {
|
||||
// Clear layout animation, as animation only apply to current UI operations batch.
|
||||
mNativeViewHierarchyManager.clearLayoutAnimation();
|
||||
|
||||
if (mViewHierarchyUpdateDebugListener != null) {
|
||||
mViewHierarchyUpdateDebugListener.onViewHierarchyUpdateFinished();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
mIsInIllegalUIState = true;
|
||||
throw e;
|
||||
|
||||
-30
@@ -1,30 +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.debug
|
||||
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel
|
||||
|
||||
/**
|
||||
* A listener that is notified about view hierarchy update events. This listener should only be used
|
||||
* for debug purposes and should not affect application state.
|
||||
*
|
||||
* NB: while [onViewHierarchyUpdateFinished] will always be called from the UI thread, there are no
|
||||
* guarantees what thread onViewHierarchyUpdateEnqueued is called on.
|
||||
*/
|
||||
@Deprecated(
|
||||
"NotThreadSafeViewHierarchyUpdateDebugListener will be deleted in the new architecture."
|
||||
)
|
||||
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
|
||||
internal interface NotThreadSafeViewHierarchyUpdateDebugListener {
|
||||
/** Called when `UIManagerModule` enqueues a UI batch to be dispatched to the main thread. */
|
||||
fun onViewHierarchyUpdateEnqueued()
|
||||
|
||||
/** Called from the main thread after a UI batch has been applied to all root views. */
|
||||
fun onViewHierarchyUpdateFinished()
|
||||
}
|
||||
Reference in new issue
Block a user