Skip to content

Commit 991dff2

Browse files
cortinicometa-codesync[bot]
authored andcommitted
Remove unused NotThreadSafeViewHierarchyUpdateDebugListener (facebook#54558)
Summary: Pull Request resolved: facebook#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
1 parent 67dda17 commit 991dff2

File tree

7 files changed

+5
-90
lines changed

7 files changed

+5
-90
lines changed

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4328,7 +4328,6 @@ public class com/facebook/react/uimanager/UIImplementation {
43284328
public fun setJSResponder (IZ)V
43294329
public fun setLayoutAnimationEnabledExperimental (Z)V
43304330
public fun setLayoutUpdateListener (Lcom/facebook/react/uimanager/UIImplementation$LayoutUpdateListener;)V
4331-
public fun setViewHierarchyUpdateDebugListener (Lcom/facebook/react/uimanager/debug/NotThreadSafeViewHierarchyUpdateDebugListener;)V
43324331
public fun setViewLocalData (ILjava/lang/Object;)V
43334332
public fun synchronouslyUpdateViewOnUIThread (ILcom/facebook/react/uimanager/ReactStylesDiffMap;)V
43344333
public fun updateInsetsPadding (IIIII)V
@@ -4412,7 +4411,6 @@ public class com/facebook/react/uimanager/UIManagerModule : com/facebook/react/b
44124411
public fun setChildren (ILcom/facebook/react/bridge/ReadableArray;)V
44134412
public fun setJSResponder (IZ)V
44144413
public fun setLayoutAnimationEnabledExperimental (Z)V
4415-
public fun setViewHierarchyUpdateDebugListener (Lcom/facebook/react/uimanager/debug/NotThreadSafeViewHierarchyUpdateDebugListener;)V
44164414
public fun setViewLocalData (ILjava/lang/Object;)V
44174415
public fun startSurface (Landroid/view/View;Ljava/lang/String;Lcom/facebook/react/bridge/WritableMap;II)I
44184416
public fun stopSurface (I)V
@@ -4460,7 +4458,6 @@ public class com/facebook/react/uimanager/UIViewOperationQueue {
44604458
public fun isEmpty ()Z
44614459
public fun prependUIBlock (Lcom/facebook/react/uimanager/UIBlock;)V
44624460
public fun profileNextBatch ()V
4463-
public fun setViewHierarchyUpdateDebugListener (Lcom/facebook/react/uimanager/debug/NotThreadSafeViewHierarchyUpdateDebugListener;)V
44644461
}
44654462

44664463
public abstract interface class com/facebook/react/uimanager/UIViewOperationQueue$UIOperation {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/debug/DidJSUpdateUiDuringFrameDetector.kt

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
package com.facebook.react.modules.debug
1313

1414
import com.facebook.react.bridge.NotThreadSafeBridgeIdleDebugListener
15-
import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener
1615

1716
/**
1817
* 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
2120
* [getDidJSHitFrameAndCleanup] should be called once per frame via a
2221
* [android.view.Choreographer.FrameCallback].
2322
*/
24-
internal class DidJSUpdateUiDuringFrameDetector :
25-
NotThreadSafeBridgeIdleDebugListener, NotThreadSafeViewHierarchyUpdateDebugListener {
23+
internal class DidJSUpdateUiDuringFrameDetector : NotThreadSafeBridgeIdleDebugListener {
2624
private val transitionToIdleEvents = ArrayList<Long>(20)
2725
private val transitionToBusyEvents = ArrayList<Long>(20)
2826
private val viewHierarchyUpdateEnqueuedEvents = ArrayList<Long>(20)
@@ -44,16 +42,6 @@ internal class DidJSUpdateUiDuringFrameDetector :
4442
// do nothing
4543
}
4644

47-
@Synchronized
48-
override fun onViewHierarchyUpdateEnqueued() {
49-
viewHierarchyUpdateEnqueuedEvents.add(System.nanoTime())
50-
}
51-
52-
@Synchronized
53-
override fun onViewHierarchyUpdateFinished() {
54-
viewHierarchyUpdateFinishedEvents.add(System.nanoTime())
55-
}
56-
5745
/**
5846
* Designed to be called from a [android.view.Choreographer.FrameCallback.doFrame] call.
5947
*

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/debug/FpsDebugFrameCallback.kt

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ internal class FpsDebugFrameCallback(private val reactContext: ReactContext) :
6161
// removeBridgeIdleDebugListener for Bridgeless
6262
@Suppress("DEPRECATION")
6363
if (!ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE) {
64-
val uiManagerModule =
65-
reactContext.getNativeModule(com.facebook.react.uimanager.UIManagerModule::class.java)
6664
if (!reactContext.isBridgeless) {
6765
reactContext.catalystInstance.addBridgeIdleDebugListener(didJSUpdateUiDuringFrameDetector)
6866
isRunningOnFabric = false
@@ -71,7 +69,6 @@ internal class FpsDebugFrameCallback(private val reactContext: ReactContext) :
7169
// for Fabric or point users to use RNDT.
7270
isRunningOnFabric = true
7371
}
74-
uiManagerModule?.setViewHierarchyUpdateDebugListener(didJSUpdateUiDuringFrameDetector)
7572
}
7673
this.targetFps = targetFps
7774
UiThreadUtil.runOnUiThread {
@@ -82,15 +79,10 @@ internal class FpsDebugFrameCallback(private val reactContext: ReactContext) :
8279

8380
fun stop() {
8481
@Suppress("DEPRECATION")
85-
if (!ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE) {
86-
val uiManagerModule =
87-
reactContext.getNativeModule(com.facebook.react.uimanager.UIManagerModule::class.java)
88-
if (!reactContext.isBridgeless) {
89-
reactContext.catalystInstance.removeBridgeIdleDebugListener(
90-
didJSUpdateUiDuringFrameDetector
91-
)
92-
}
93-
uiManagerModule?.setViewHierarchyUpdateDebugListener(null)
82+
if (
83+
!ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE && !reactContext.isBridgeless
84+
) {
85+
reactContext.catalystInstance.removeBridgeIdleDebugListener(didJSUpdateUiDuringFrameDetector)
9486
}
9587
UiThreadUtil.runOnUiThread {
9688
choreographer = Choreographer.getInstance()

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger;
2727
import com.facebook.react.common.build.ReactBuildConfig;
2828
import com.facebook.react.modules.i18nmanager.I18nUtil;
29-
import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener;
3029
import com.facebook.react.uimanager.events.EventDispatcher;
3130
import com.facebook.systrace.Systrace;
3231
import com.facebook.systrace.SystraceMessage;
@@ -782,13 +781,6 @@ public void onCatalystInstanceDestroyed() {
782781
mViewManagers.invalidate();
783782
}
784783

785-
// NOTE: When converted to Kotlin this method should be `internal` due to
786-
// visibility restriction for `NotThreadSafeViewHierarchyUpdateDebugListener`
787-
public void setViewHierarchyUpdateDebugListener(
788-
@Nullable NotThreadSafeViewHierarchyUpdateDebugListener listener) {
789-
mOperationsQueue.setViewHierarchyUpdateDebugListener(listener);
790-
}
791-
792784
protected final void removeShadowNode(ReactShadowNode nodeToRemove) {
793785
removeShadowNodeRecursive(nodeToRemove);
794786
nodeToRemove.dispose();

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
import com.facebook.react.common.build.ReactBuildConfig;
4646
import com.facebook.react.module.annotations.ReactModule;
4747
import com.facebook.react.uimanager.common.ViewUtil;
48-
import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener;
4948
import com.facebook.react.uimanager.events.EventDispatcher;
5049
import com.facebook.react.uimanager.events.EventDispatcherImpl;
5150
import com.facebook.react.uimanager.events.RCTEventEmitter;
@@ -699,13 +698,6 @@ public void onBatchComplete() {
699698
}
700699
}
701700

702-
// NOTE: When converted to Kotlin this method should be `internal` due to
703-
// visibility restriction for `NotThreadSafeViewHierarchyUpdateDebugListener`
704-
public void setViewHierarchyUpdateDebugListener(
705-
@Nullable NotThreadSafeViewHierarchyUpdateDebugListener listener) {
706-
mUIImplementation.setViewHierarchyUpdateDebugListener(listener);
707-
}
708-
709701
@Override
710702
public EventDispatcher getEventDispatcher() {
711703
return mEventDispatcher;

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel;
3030
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger;
3131
import com.facebook.react.modules.core.ReactChoreographer;
32-
import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener;
3332
import com.facebook.systrace.Systrace;
3433
import com.facebook.systrace.SystraceMessage;
3534
import com.facebook.yoga.YogaDirection;
@@ -584,7 +583,6 @@ public void execute() {
584583
@GuardedBy("mNonBatchedOperationsLock")
585584
private ArrayDeque<UIOperation> mNonBatchedOperations = new ArrayDeque<>();
586585

587-
private @Nullable NotThreadSafeViewHierarchyUpdateDebugListener mViewHierarchyUpdateDebugListener;
588586
private boolean mIsDispatchUIFrameCallbackEnqueued = false;
589587
private boolean mIsInIllegalUIState = false;
590588
private boolean mIsProfilingNextBatch = false;
@@ -619,13 +617,6 @@ public UIViewOperationQueue(
619617
return mNativeViewHierarchyManager;
620618
}
621619

622-
// NOTE: When converted to Kotlin this method should be `internal` due to
623-
// visibility restriction for `NotThreadSafeViewHierarchyUpdateDebugListener`
624-
public void setViewHierarchyUpdateDebugListener(
625-
@Nullable NotThreadSafeViewHierarchyUpdateDebugListener listener) {
626-
mViewHierarchyUpdateDebugListener = listener;
627-
}
628-
629620
public void profileNextBatch() {
630621
mIsProfilingNextBatch = true;
631622
mProfiledBatchCommitStartTime = 0;
@@ -833,10 +824,6 @@ public void dispatchViewUpdates(
833824
}
834825
}
835826

836-
if (mViewHierarchyUpdateDebugListener != null) {
837-
mViewHierarchyUpdateDebugListener.onViewHierarchyUpdateEnqueued();
838-
}
839-
840827
Runnable runOperations =
841828
new Runnable() {
842829
@Override
@@ -926,9 +913,6 @@ public void run() {
926913
// Clear layout animation, as animation only apply to current UI operations batch.
927914
mNativeViewHierarchyManager.clearLayoutAnimation();
928915

929-
if (mViewHierarchyUpdateDebugListener != null) {
930-
mViewHierarchyUpdateDebugListener.onViewHierarchyUpdateFinished();
931-
}
932916
} catch (Exception e) {
933917
mIsInIllegalUIState = true;
934918
throw e;

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/debug/NotThreadSafeViewHierarchyUpdateDebugListener.kt

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)