Skip to content

Commit

Permalink
Align creation of FabricUIManager with bridge
Browse files Browse the repository at this point in the history
Summary:
- Bridgeless is using a deprecated FabricUIManager constructor which bridge doesn't use, and is the only one using it, this diff migrated bridgeless to use the same FabricUIManager constructor as bridge
- Remove static view config check (mShouldDeallocateEventDispatcher), instead use Bridgeless check since SVC is enabled in Bridgeless but not in Bridge.

Changelog:
[Android][Changed] - Align creation of FabricUIManager with bridge

Reviewed By: javache

Differential Revision: D42681489

fbshipit-source-id: b9c7c4a81a98db52e881138cc85be0e85df636d9
  • Loading branch information
Lulu Wu authored and facebook-github-bot committed Feb 2, 2023
1 parent 1e53f88 commit 6d45e49
Showing 1 changed file with 4 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,6 @@ public void onFabricCommitEnd(DevToolsReactPerfLogger.FabricCommitPoint commitPo
*/
private volatile boolean mDestroyed = false;

// TODO T83943316: Delete this variable once StaticViewConfigs are enabled by default
private volatile boolean mShouldDeallocateEventDispatcher = false;

private boolean mDriveCxxAnimations = false;

private long mDispatchViewUpdatesTime = 0l;
Expand All @@ -209,28 +206,6 @@ public void executeItems(Queue<MountItem> items) {
}
};

// TODO T83943316: Deprecate and delete this constructor once StaticViewConfigs are enabled by
// default
@Deprecated
public FabricUIManager(
ReactApplicationContext reactContext,
ViewManagerRegistry viewManagerRegistry,
EventDispatcher eventDispatcher,
EventBeatManager eventBeatManager) {
mDispatchUIFrameCallback = new DispatchUIFrameCallback(reactContext);
mReactApplicationContext = reactContext;
mMountingManager = new MountingManager(viewManagerRegistry, mMountItemExecutor);
mMountItemDispatcher =
new MountItemDispatcher(mMountingManager, new MountItemDispatchListener());
mEventDispatcher = eventDispatcher;
mShouldDeallocateEventDispatcher = false;
mEventBeatManager = eventBeatManager;
mReactApplicationContext.addLifecycleEventListener(this);

mViewManagerRegistry = viewManagerRegistry;
mReactApplicationContext.registerComponentCallbacks(viewManagerRegistry);
}

public FabricUIManager(
ReactApplicationContext reactContext,
ViewManagerRegistry viewManagerRegistry,
Expand All @@ -241,7 +216,6 @@ public FabricUIManager(
mMountItemDispatcher =
new MountItemDispatcher(mMountingManager, new MountItemDispatchListener());
mEventDispatcher = new EventDispatcherImpl(reactContext);
mShouldDeallocateEventDispatcher = true;
mEventBeatManager = eventBeatManager;
mReactApplicationContext.addLifecycleEventListener(this);

Expand Down Expand Up @@ -467,10 +441,11 @@ public void onCatalystInstanceDestroy() {

ViewManagerPropertyUpdater.clear();

// When using StaticViewConfigs is enabled, FabriUIManager is
// responsible for initializing and deallocating EventDispatcher.
// When StaticViewConfigs is enabled, FabriUIManager is
// responsible for initializing and deallocating EventDispatcher. StaticViewConfigs is enabled
// only in Bridgeless for now.
// TODO T83943316: Remove this IF once StaticViewConfigs are enabled by default
if (mShouldDeallocateEventDispatcher) {
if (!ReactFeatureFlags.enableBridgelessArchitecture) {
mEventDispatcher.onCatalystInstanceDestroyed();
}
}
Expand Down

0 comments on commit 6d45e49

Please sign in to comment.