mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Remove createMountItem code
Summary: Now that pre-allocation of views update props, we can just force the execution of "pre-allocation" instead of "create" mount item. This diff removes the methods that were used by view creation This way we reduce the amount of mountItems that are created during commit phase. This should improve TTI (I'm running a MobileLab) Reviewed By: shergin Differential Revision: D14297477 fbshipit-source-id: a100bab798467e9f0fa9773e0206ba1ded472298
This commit is contained in:
committed by
Facebook Github Bot
parent
7720613bda
commit
d451c03284
@@ -17,7 +17,6 @@ import com.facebook.react.fabric.mounting.LayoutMetricsConversions;
|
||||
import com.facebook.react.fabric.mounting.MountingManager;
|
||||
import com.facebook.react.fabric.mounting.ViewPool;
|
||||
import com.facebook.react.fabric.mounting.mountitems.BatchMountItem;
|
||||
import com.facebook.react.fabric.mounting.mountitems.CreateMountItem;
|
||||
import com.facebook.react.fabric.mounting.mountitems.DeleteMountItem;
|
||||
import com.facebook.react.fabric.mounting.mountitems.DispatchCommandMountItem;
|
||||
import com.facebook.react.fabric.mounting.mountitems.InsertMountItem;
|
||||
@@ -94,7 +93,6 @@ public class FabricJSIModuleProvider implements JSIModuleProvider<UIManager> {
|
||||
FabricUIManager.class.getClass();
|
||||
GuardedFrameCallback.class.getClass();
|
||||
BatchMountItem.class.getClass();
|
||||
CreateMountItem.class.getClass();
|
||||
DeleteMountItem.class.getClass();
|
||||
DispatchCommandMountItem.class.getClass();
|
||||
InsertMountItem.class.getClass();
|
||||
|
||||
@@ -38,7 +38,6 @@ import com.facebook.react.fabric.jsi.EventEmitterWrapper;
|
||||
import com.facebook.react.fabric.jsi.FabricSoLoader;
|
||||
import com.facebook.react.fabric.mounting.MountingManager;
|
||||
import com.facebook.react.fabric.mounting.mountitems.BatchMountItem;
|
||||
import com.facebook.react.fabric.mounting.mountitems.CreateMountItem;
|
||||
import com.facebook.react.fabric.mounting.mountitems.DeleteMountItem;
|
||||
import com.facebook.react.fabric.mounting.mountitems.DispatchCommandMountItem;
|
||||
import com.facebook.react.fabric.mounting.mountitems.InsertMountItem;
|
||||
@@ -162,22 +161,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
|
||||
mMountingManager.removeRootView(reactRootTag);
|
||||
mReactContextForRootTag.remove(reactRootTag);
|
||||
}
|
||||
|
||||
@DoNotStrip
|
||||
@SuppressWarnings("unused")
|
||||
private MountItem createMountItem(
|
||||
String componentName, int reactRootTag, int reactTag, boolean isVirtual, ReadableMap props) {
|
||||
String component = sComponentNames.get(componentName);
|
||||
if (component == null) {
|
||||
throw new IllegalArgumentException("Unable to find component with name " + componentName);
|
||||
}
|
||||
ThemedReactContext reactContext = mReactContextForRootTag.get(reactRootTag);
|
||||
if (reactContext == null) {
|
||||
throw new IllegalArgumentException("Unable to find ReactContext for root: " + reactRootTag);
|
||||
}
|
||||
return new CreateMountItem(reactContext, component, reactTag, isVirtual, props);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
mEventDispatcher.registerEventEmitter(FABRIC, new FabricEventEmitter(this));
|
||||
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
*
|
||||
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
|
||||
* directory of this source tree.
|
||||
*/
|
||||
package com.facebook.react.fabric.mounting.mountitems;
|
||||
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.fabric.mounting.MountingManager;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
|
||||
public class CreateMountItem implements MountItem {
|
||||
|
||||
private final String mComponentName;
|
||||
private final int mReactTag;
|
||||
private final ThemedReactContext mThemedReactContext;
|
||||
private final boolean mIsVirtual;
|
||||
private final ReadableMap mProps;
|
||||
|
||||
public CreateMountItem(
|
||||
ThemedReactContext themedReactContext,
|
||||
String componentName,
|
||||
int reactTag,
|
||||
boolean isVirtual,
|
||||
ReadableMap props) {
|
||||
mReactTag = reactTag;
|
||||
mThemedReactContext = themedReactContext;
|
||||
mComponentName = componentName;
|
||||
mIsVirtual = isVirtual;
|
||||
mProps = props;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(MountingManager mountingManager) {
|
||||
mountingManager.createView(mThemedReactContext, mComponentName, mReactTag, mIsVirtual);
|
||||
if (mProps != null && !mIsVirtual) {
|
||||
mountingManager.updateProps(mReactTag, mProps);
|
||||
}
|
||||
}
|
||||
|
||||
public String getComponentName() {
|
||||
return mComponentName;
|
||||
}
|
||||
|
||||
public ThemedReactContext getThemedReactContext() {
|
||||
return mThemedReactContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CreateMountItem [" + mReactTag + "] " + mComponentName;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user