From f6ba52bf1e7118e3cc7e9c274a78c7db19cb3658 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Sun, 3 Mar 2019 08:55:25 -0800 Subject: [PATCH] Enable update of props during preallocation for all views Summary: Before only the props of Images components were being applied during the pre-allocation phase. Now that we have a limit of time that pre-allocations will be executed we can update props for any component Reviewed By: shergin Differential Revision: D14252171 fbshipit-source-id: afea4b71a32b7ae2c184b0cdce97f778bc3a47d2 --- .../com/facebook/react/fabric/jsi/jni/Binding.cpp | 4 +--- .../mounting/mountitems/DispatchCommandMountItem.java | 1 - .../mounting/mountitems/PreAllocateViewMountItem.java | 11 +++++------ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/jni/Binding.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/jni/Binding.cpp index 5e29c0cd4..70e5e9fd9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/jni/Binding.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/jni/Binding.cpp @@ -468,9 +468,7 @@ void Binding::schedulerDidRequestPreliminaryViewAllocation( jni::findClassStatic(UIManagerJavaDescriptor) ->getMethod("preallocateView"); - // TODO: T31905686 Experiment to check what is the impact on TTI of pre loading of Images during - // pre-allocation of views - if (shadowView.componentName == "Image") { + if (shadowView.props->rawProps.isNull()) { local_ref readableMap = castReadableMap(ReadableNativeMap::newObjectCxxArgs(shadowView.props->rawProps)); preallocateView( diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchCommandMountItem.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchCommandMountItem.java index e07ceab98..8ab888396 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchCommandMountItem.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchCommandMountItem.java @@ -26,7 +26,6 @@ public class DispatchCommandMountItem implements MountItem { @Override public void execute(MountingManager mountingManager) { - UiThreadUtil.assertOnUiThread(); mountingManager.receiveCommand(mReactTag, mCommandId, mCommandArgs); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/PreAllocateViewMountItem.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/PreAllocateViewMountItem.java index 6ca1d21db..237b95eff 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/PreAllocateViewMountItem.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/PreAllocateViewMountItem.java @@ -1,8 +1,8 @@ /** * 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. + *

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; @@ -10,9 +10,7 @@ import com.facebook.react.bridge.ReadableMap; import com.facebook.react.fabric.mounting.MountingManager; import com.facebook.react.uimanager.ThemedReactContext; -/** - * {@link MountItem} that is used to pre-allocate views for JS components. - */ +/** {@link MountItem} that is used to pre-allocate views for JS components. */ public class PreAllocateViewMountItem implements MountItem { private final String mComponent; @@ -21,7 +19,8 @@ public class PreAllocateViewMountItem implements MountItem { private final ReadableMap mProps; private final ThemedReactContext mContext; - public PreAllocateViewMountItem(ThemedReactContext context, int rootTag, int reactTag, String component, ReadableMap props){ + public PreAllocateViewMountItem( + ThemedReactContext context, int rootTag, int reactTag, String component, ReadableMap props) { mContext = context; mComponent = component; mRootTag = rootTag;