Move assertion about invalidated ReactInstanceManager to UI thread (#45328)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45328

This assertion is currently not actionable since the stack trace will always be just `mCreateReactContextThread`. Moving this assert is safe, as the only other place we write it is also the UI thread.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D59467576

fbshipit-source-id: c4606672255149a202f99a8f787230e2a23a868a
This commit is contained in:
Pieter De Baets
2024-07-08 09:49:28 -07:00
committed by Facebook GitHub Bot
parent ef9b2baa9a
commit 6b7076e923
@@ -1163,6 +1163,9 @@ public class ReactInstanceManager {
private void runCreateReactContextOnNewThread(final ReactContextInitParams initParams) {
FLog.d(ReactConstants.TAG, "ReactInstanceManager.runCreateReactContextOnNewThread()");
UiThreadUtil.assertOnUiThread();
Assertions.assertCondition(
!mInstanceManagerInvalidated,
"Cannot create a new React context on an invalidated ReactInstanceManager");
// Mark start of bridge loading
ReactMarker.logMarker(ReactMarkerConstants.REACT_BRIDGE_LOADING_START);
@@ -1422,9 +1425,6 @@ public class ReactInstanceManager {
private ReactApplicationContext createReactContext(
JavaScriptExecutor jsExecutor, JSBundleLoader jsBundleLoader) {
FLog.d(ReactConstants.TAG, "ReactInstanceManager.createReactContext()");
Assertions.assertCondition(
!mInstanceManagerInvalidated,
"Cannot create a new React context on an invalidated ReactInstanceManager");
ReactMarker.logMarker(CREATE_REACT_CONTEXT_START, jsExecutor.getName());
final BridgeReactContext reactContext = new BridgeReactContext(mApplicationContext);