From 04b8c9c925f7443ec24a0b70643942fd315e2a26 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Mon, 18 May 2020 17:53:50 -0700 Subject: [PATCH] Delete local data from Fabric android Summary: LocalData was fully replaced by State, this diff removes dead code thas was previously used to update local Data changelog: [Internal] Internal cleanup on Fabric Android code Reviewed By: shergin Differential Revision: D21621481 fbshipit-source-id: a3e38300a54a85adff9145cdeea1e89dad09103f --- .../react/fabric/FabricJSIModuleProvider.java | 2 - .../react/fabric/FabricUIManager.java | 9 ---- .../fabric/mounting/MountingManager.java | 31 ------------- .../mountitems/UpdateLocalDataMountItem.java | 46 ------------------- .../facebook/react/uimanager/ViewManager.java | 5 -- 5 files changed, 93 deletions(-) delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/UpdateLocalDataMountItem.java diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java index 0caf99934dd..62e020c7118 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java @@ -33,7 +33,6 @@ import com.facebook.react.fabric.mounting.mountitems.RemoveMountItem; import com.facebook.react.fabric.mounting.mountitems.SendAccessibilityEvent; import com.facebook.react.fabric.mounting.mountitems.UpdateEventEmitterMountItem; import com.facebook.react.fabric.mounting.mountitems.UpdateLayoutMountItem; -import com.facebook.react.fabric.mounting.mountitems.UpdateLocalDataMountItem; import com.facebook.react.fabric.mounting.mountitems.UpdatePaddingMountItem; import com.facebook.react.fabric.mounting.mountitems.UpdatePropsMountItem; import com.facebook.react.fabric.mounting.mountitems.UpdateStateMountItem; @@ -123,7 +122,6 @@ public class FabricJSIModuleProvider implements JSIModuleProvider { SendAccessibilityEvent.class.getClass(); UpdateEventEmitterMountItem.class.getClass(); UpdateLayoutMountItem.class.getClass(); - UpdateLocalDataMountItem.class.getClass(); UpdatePaddingMountItem.class.getClass(); UpdatePropsMountItem.class.getClass(); UpdateStateMountItem.class.getClass(); diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java index 13b1d78329b..d628acaa839 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java @@ -63,7 +63,6 @@ import com.facebook.react.fabric.mounting.mountitems.RemoveMountItem; import com.facebook.react.fabric.mounting.mountitems.SendAccessibilityEvent; import com.facebook.react.fabric.mounting.mountitems.UpdateEventEmitterMountItem; import com.facebook.react.fabric.mounting.mountitems.UpdateLayoutMountItem; -import com.facebook.react.fabric.mounting.mountitems.UpdateLocalDataMountItem; import com.facebook.react.fabric.mounting.mountitems.UpdatePaddingMountItem; import com.facebook.react.fabric.mounting.mountitems.UpdatePropsMountItem; import com.facebook.react.fabric.mounting.mountitems.UpdateStateMountItem; @@ -395,14 +394,6 @@ public class FabricUIManager implements UIManager, LifecycleEventListener { return new UpdatePropsMountItem(reactTag, map); } - @DoNotStrip - @SuppressWarnings("unused") - @AnyThread - @ThreadConfined(ANY) - private MountItem updateLocalDataMountItem(int reactTag, ReadableMap newLocalData) { - return new UpdateLocalDataMountItem(reactTag, newLocalData); - } - @DoNotStrip @SuppressWarnings("unused") @AnyThread diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java index 3cedf09033c..9388ae6e777 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java @@ -373,37 +373,6 @@ public class MountingManager { } } - @UiThread - public void updateLocalData(int reactTag, @NonNull ReadableMap newLocalData) { - UiThreadUtil.assertOnUiThread(); - ViewState viewState = getViewState(reactTag); - if (viewState.mCurrentProps == null) { - throw new IllegalStateException( - "Can not update local data to view without props: " + reactTag); - } - if (viewState.mCurrentLocalData != null - && newLocalData.hasKey("hash") - && viewState.mCurrentLocalData.getDouble("hash") == newLocalData.getDouble("hash") - && viewState.mCurrentLocalData.equals(newLocalData)) { - return; - } - viewState.mCurrentLocalData = newLocalData; - - ViewManager viewManager = viewState.mViewManager; - - if (viewManager == null) { - throw new IllegalStateException("Unable to find ViewManager for view: " + viewState); - } - Object extraData = - viewManager.updateLocalData( - viewState.mView, - viewState.mCurrentProps, - new ReactStylesDiffMap(viewState.mCurrentLocalData)); - if (extraData != null) { - viewManager.updateExtraData(viewState.mView, extraData); - } - } - @UiThread public void updateState(final int reactTag, @Nullable StateWrapper stateWrapper) { UiThreadUtil.assertOnUiThread(); diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/UpdateLocalDataMountItem.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/UpdateLocalDataMountItem.java deleted file mode 100644 index 07104a3f529..00000000000 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/UpdateLocalDataMountItem.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * 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 static com.facebook.react.fabric.FabricUIManager.IS_DEVELOPMENT_ENVIRONMENT; - -import androidx.annotation.NonNull; -import com.facebook.react.bridge.ReadableMap; -import com.facebook.react.fabric.mounting.MountingManager; - -public class UpdateLocalDataMountItem implements MountItem { - - private final int mReactTag; - @NonNull private final ReadableMap mNewLocalData; - - public UpdateLocalDataMountItem(int reactTag, @NonNull ReadableMap newLocalData) { - mReactTag = reactTag; - mNewLocalData = newLocalData; - } - - @Override - public void execute(@NonNull MountingManager mountingManager) { - mountingManager.updateLocalData(mReactTag, mNewLocalData); - } - - public @NonNull ReadableMap getNewLocalData() { - return mNewLocalData; - } - - @Override - public String toString() { - StringBuilder result = - new StringBuilder("UpdateLocalDataMountItem [").append(mReactTag).append("]"); - - if (IS_DEVELOPMENT_ENVIRONMENT) { - result.append(" localData: ").append(mNewLocalData); - } - - return result.toString(); - } -} diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java index e912d83f3f1..cabed90229c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java @@ -273,11 +273,6 @@ public abstract class ViewManager return ViewManagerPropertyUpdater.getNativeProps(getClass(), getShadowNodeClass()); } - public @Nullable Object updateLocalData( - @NonNull T view, ReactStylesDiffMap props, ReactStylesDiffMap localData) { - return null; - } - /** * Subclasses can implement this method to receive state updates shared between all instances of * this component type.