deleteRootView: use concurrent pattern with mTagToViewState

Summary:
Instead of doing a "containsKey then get", just get the rootViewTag and see if it's non-null. Theoretically, since it's a
concurrent data-structure, it could be removed from the ConcurrentHashMap between "containsKey" returning true and the "get".

This does not fix any known, existing problems.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25378703

fbshipit-source-id: 62a44e68e4443dac5a557263cc4bb33de9eea993
This commit is contained in:
Joshua Gross
2020-12-07 17:57:05 -08:00
committed by Facebook GitHub Bot
parent 3cdef265ae
commit 99f2f5ffdd
@@ -124,11 +124,12 @@ public class MountingManager {
});
}
/** Delete rootView and all children/ */
/** Delete rootView and all children recursively. */
@UiThread
public void deleteRootView(int reactRootTag) {
if (mTagToViewState.containsKey(reactRootTag)) {
dropView(mTagToViewState.get(reactRootTag).mView, true);
ViewState rootViewState = mTagToViewState.get(reactRootTag);
if (rootViewState != null && rootViewState.mView != null) {
dropView(rootViewState.mView, true);
}
}