change(android): make FabricUIManager#resolveView not thread specific
#54259
+0
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
FabricUIManager#resolveViewis not using any thread specific annotation, but has aUiThreadUtil.assertOnUiThread()check:react-native/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java
Lines 1034 to 1037 in d9262c6
However, after checking all data structures used, it appears that all of them are
ConcurrentHashMapsand thusFabricUIManager#resolveViewis actually thread safe:react-native/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java
Line 1038 in d93d325
react-native/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java
Line 81 in d93d325
react-native/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.kt
Line 43 in d93d325
I am proposing to remove the
UiThreadUtil.assertOnUiThread()check here.Motivation:
From another thread we want to check if a certain react tag is already mounted in the native view hierarchy. It should be the callers responsibility to make sure to only operate on that view from the UI thread.
Changelog:
[ANDROID] [CHANGED] Make
FabricUIManager#resolveViewnot thread specificTest Plan: