Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -1972,7 +1972,6 @@ public class com/facebook/react/config/ReactFeatureFlags {
public static field enableFabricLogs Z
public static field enableFabricRenderer Z
public static field enableFabricRendererExclusively Z
public static field enableRemoveDeleteTreeInstruction Z
public static field enableViewRecycling Z
public static field excludeYogaFromRawProps Z
public static field rejectTurboModulePromiseOnNativeError Z
Expand Down Expand Up @@ -2804,7 +2803,6 @@ public class com/facebook/react/fabric/mounting/SurfaceMountingManager {
public fun printSurfaceState ()V
public fun receiveCommand (IILcom/facebook/react/bridge/ReadableArray;)V
public fun receiveCommand (ILjava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V
public fun removeDeleteTreeAt (III)V
public fun removeViewAt (III)V
public fun scheduleMountItemOnViewAttach (Lcom/facebook/react/fabric/mounting/mountitems/MountItem;)V
public fun sendAccessibilityEvent (II)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ public class ReactFeatureFlags {
*/
public static boolean enableCppPropsIteratorSetter = false;

/**
* Allow Differentiator.cpp and FabricMountingManager.cpp to generate a RemoveDeleteTree mega-op.
*/
public static boolean enableRemoveDeleteTreeInstruction = false;

/** When enabled, rawProps in Props will not include Yoga specific props. */
public static boolean excludeYogaFromRawProps = false;

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ final class IntBufferBatchMountItem implements BatchMountItem {
static final int INSTRUCTION_UPDATE_EVENT_EMITTER = 256;
static final int INSTRUCTION_UPDATE_PADDING = 512;
static final int INSTRUCTION_UPDATE_OVERFLOW_INSET = 1024;
static final int INSTRUCTION_REMOVE_DELETE_TREE = 2048;

private final int mSurfaceId;
private final int mCommitNumber;
Expand Down Expand Up @@ -117,9 +116,6 @@ public void execute(MountingManager mountingManager) {
surfaceMountingManager.addViewAt(parentTag, tag, mIntBuffer[i++]);
} else if (type == INSTRUCTION_REMOVE) {
surfaceMountingManager.removeViewAt(mIntBuffer[i++], mIntBuffer[i++], mIntBuffer[i++]);
} else if (type == INSTRUCTION_REMOVE_DELETE_TREE) {
surfaceMountingManager.removeDeleteTreeAt(
mIntBuffer[i++], mIntBuffer[i++], mIntBuffer[i++]);
} else if (type == INSTRUCTION_UPDATE_PROPS) {
surfaceMountingManager.updateProps(mIntBuffer[i++], (ReadableMap) mObjBuffer[j++]);
} else if (type == INSTRUCTION_UPDATE_STATE) {
Expand Down Expand Up @@ -207,11 +203,6 @@ public String toString() {
s.append(
String.format(
"REMOVE [%d]->[%d] @%d\n", mIntBuffer[i++], mIntBuffer[i++], mIntBuffer[i++]));
} else if (type == INSTRUCTION_REMOVE_DELETE_TREE) {
s.append(
String.format(
"REMOVE+DELETE TREE [%d]->[%d] @%d\n",
mIntBuffer[i++], mIntBuffer[i++], mIntBuffer[i++]));
} else if (type == INSTRUCTION_UPDATE_PROPS) {
Object props = mObjBuffer[j++];
String propsString =
Expand Down Expand Up @@ -298,8 +289,6 @@ private static String nameForInstructionString(int type) {
return "INSERT";
} else if (type == INSTRUCTION_REMOVE) {
return "REMOVE";
} else if (type == INSTRUCTION_REMOVE_DELETE_TREE) {
return "REMOVE_DELETE_TREE";
} else if (type == INSTRUCTION_UPDATE_PROPS) {
return "UPDATE_PROPS";
} else if (type == INSTRUCTION_UPDATE_STATE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<61e7f1b2647d1e9c9583079b5e7fb166>>
* @generated SignedSource<<9f31fa21b0dd908ec53d1586c0bd271d>>
*/

/**
Expand Down Expand Up @@ -118,12 +118,6 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun fixMissedFabricStateUpdatesOnAndroid(): Boolean = accessor.fixMissedFabricStateUpdatesOnAndroid()

/**
* Fixes a leak in SurfaceMountingManager.mRemoveDeleteTreeUIFrameCallback
*/
@JvmStatic
public fun fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeak(): Boolean = accessor.fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeak()

/**
* Forces the mounting layer on Android to always batch mount items instead of dispatching them immediately. This might fix some crashes related to synchronous state updates, where some views dispatch state updates during mount.
*/
Expand All @@ -142,6 +136,12 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun fuseboxEnabledRelease(): Boolean = accessor.fuseboxEnabledRelease()

/**
* Construct modules that requires eager init on the dedicate native modules thread
*/
@JvmStatic
public fun initEagerTurboModulesOnNativeModulesQueueAndroid(): Boolean = accessor.initEagerTurboModulesOnNativeModulesQueueAndroid()

/**
* Only enqueue Choreographer calls if there is an ongoing animation, instead of enqueueing every frame.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<d43732e02660cb00e0f0acfc2b8ca29f>>
* @generated SignedSource<<718c08632274058c4ece4c15ed06fbfe>>
*/

/**
Expand Down Expand Up @@ -35,10 +35,10 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
private var fixIncorrectScrollViewStateUpdateOnAndroidCache: Boolean? = null
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
private var fixMissedFabricStateUpdatesOnAndroidCache: Boolean? = null
private var fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeakCache: Boolean? = null
private var forceBatchingMountItemsOnAndroidCache: Boolean? = null
private var fuseboxEnabledDebugCache: Boolean? = null
private var fuseboxEnabledReleaseCache: Boolean? = null
private var initEagerTurboModulesOnNativeModulesQueueAndroidCache: Boolean? = null
private var lazyAnimationCallbacksCache: Boolean? = null
private var setAndroidLayoutDirectionCache: Boolean? = null
private var useImmediateExecutorInAndroidBridgelessCache: Boolean? = null
Expand Down Expand Up @@ -184,15 +184,6 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}

override fun fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeak(): Boolean {
var cached = fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeakCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeak()
fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeakCache = cached
}
return cached
}

override fun forceBatchingMountItemsOnAndroid(): Boolean {
var cached = forceBatchingMountItemsOnAndroidCache
if (cached == null) {
Expand Down Expand Up @@ -220,6 +211,15 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}

override fun initEagerTurboModulesOnNativeModulesQueueAndroid(): Boolean {
var cached = initEagerTurboModulesOnNativeModulesQueueAndroidCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.initEagerTurboModulesOnNativeModulesQueueAndroid()
initEagerTurboModulesOnNativeModulesQueueAndroidCache = cached
}
return cached
}

override fun lazyAnimationCallbacks(): Boolean {
var cached = lazyAnimationCallbacksCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<97e3090e29645738028f11945d4b759e>>
* @generated SignedSource<<9af9576364f2ec8e978604eaa1c15ee8>>
*/

/**
Expand Down Expand Up @@ -58,14 +58,14 @@ public object ReactNativeFeatureFlagsCxxInterop {

@DoNotStrip @JvmStatic public external fun fixMissedFabricStateUpdatesOnAndroid(): Boolean

@DoNotStrip @JvmStatic public external fun fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeak(): Boolean

@DoNotStrip @JvmStatic public external fun forceBatchingMountItemsOnAndroid(): Boolean

@DoNotStrip @JvmStatic public external fun fuseboxEnabledDebug(): Boolean

@DoNotStrip @JvmStatic public external fun fuseboxEnabledRelease(): Boolean

@DoNotStrip @JvmStatic public external fun initEagerTurboModulesOnNativeModulesQueueAndroid(): Boolean

@DoNotStrip @JvmStatic public external fun lazyAnimationCallbacks(): Boolean

@DoNotStrip @JvmStatic public external fun setAndroidLayoutDirection(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<556729c01ca69ca38b51b96e6b559667>>
* @generated SignedSource<<ea19295997ce3b9bdebcc37989d53096>>
*/

/**
Expand Down Expand Up @@ -53,14 +53,14 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi

override fun fixMissedFabricStateUpdatesOnAndroid(): Boolean = false

override fun fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeak(): Boolean = false

override fun forceBatchingMountItemsOnAndroid(): Boolean = false

override fun fuseboxEnabledDebug(): Boolean = false

override fun fuseboxEnabledRelease(): Boolean = false

override fun initEagerTurboModulesOnNativeModulesQueueAndroid(): Boolean = false

override fun lazyAnimationCallbacks(): Boolean = false

override fun setAndroidLayoutDirection(): Boolean = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<0a5ce89c1476d6693eaf18adc020ebf4>>
* @generated SignedSource<<63cb1200d25489b5cc9fcfa0061eccd0>>
*/

/**
Expand Down Expand Up @@ -39,10 +39,10 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
private var fixIncorrectScrollViewStateUpdateOnAndroidCache: Boolean? = null
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
private var fixMissedFabricStateUpdatesOnAndroidCache: Boolean? = null
private var fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeakCache: Boolean? = null
private var forceBatchingMountItemsOnAndroidCache: Boolean? = null
private var fuseboxEnabledDebugCache: Boolean? = null
private var fuseboxEnabledReleaseCache: Boolean? = null
private var initEagerTurboModulesOnNativeModulesQueueAndroidCache: Boolean? = null
private var lazyAnimationCallbacksCache: Boolean? = null
private var setAndroidLayoutDirectionCache: Boolean? = null
private var useImmediateExecutorInAndroidBridgelessCache: Boolean? = null
Expand Down Expand Up @@ -203,16 +203,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
return cached
}

override fun fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeak(): Boolean {
var cached = fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeakCache
if (cached == null) {
cached = currentProvider.fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeak()
accessedFeatureFlags.add("fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeak")
fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeakCache = cached
}
return cached
}

override fun forceBatchingMountItemsOnAndroid(): Boolean {
var cached = forceBatchingMountItemsOnAndroidCache
if (cached == null) {
Expand Down Expand Up @@ -243,6 +233,16 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
return cached
}

override fun initEagerTurboModulesOnNativeModulesQueueAndroid(): Boolean {
var cached = initEagerTurboModulesOnNativeModulesQueueAndroidCache
if (cached == null) {
cached = currentProvider.initEagerTurboModulesOnNativeModulesQueueAndroid()
accessedFeatureFlags.add("initEagerTurboModulesOnNativeModulesQueueAndroid")
initEagerTurboModulesOnNativeModulesQueueAndroidCache = cached
}
return cached
}

override fun lazyAnimationCallbacks(): Boolean {
var cached = lazyAnimationCallbacksCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<16ba68de9b22ddc66208f9ef60f017d9>>
* @generated SignedSource<<588266c6ec144651b7fdc84b77b490e7>>
*/

/**
Expand Down Expand Up @@ -53,14 +53,14 @@ public interface ReactNativeFeatureFlagsProvider {

@DoNotStrip public fun fixMissedFabricStateUpdatesOnAndroid(): Boolean

@DoNotStrip public fun fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeak(): Boolean

@DoNotStrip public fun forceBatchingMountItemsOnAndroid(): Boolean

@DoNotStrip public fun fuseboxEnabledDebug(): Boolean

@DoNotStrip public fun fuseboxEnabledRelease(): Boolean

@DoNotStrip public fun initEagerTurboModulesOnNativeModulesQueueAndroid(): Boolean

@DoNotStrip public fun lazyAnimationCallbacks(): Boolean

@DoNotStrip public fun setAndroidLayoutDirection(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1090,14 +1090,15 @@ private Task<ReactInstance> getOrCreateReactInstanceTask() {
getOrCreateReactHostInspectorTarget());
mReactInstance = instance;

// eagerly initailize turbo modules
instance.initializeEagerTurboModules();

MemoryPressureListener memoryPressureListener =
createMemoryPressureListener(instance);
mMemoryPressureListener = memoryPressureListener;
mMemoryPressureRouter.addMemoryPressureListener(memoryPressureListener);

// Eagerly initialize turbo modules in parallel with JS bundle execution
// as TurboModuleManager will handle any concurrent access
instance.initializeEagerTurboModules();

log(method, "Loading JS Bundle");
instance.loadJSBundle(bundleLoader);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,21 @@ final class ReactInstance {
}

void initializeEagerTurboModules() {
Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "initializeEagerTurboModules");
// Eagerly initialize TurboModules
for (String moduleName : mTurboModuleManager.getEagerInitModuleNames()) {
mTurboModuleManager.getModule(moduleName);
Runnable task =
() -> {
Systrace.beginSection(
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "initializeEagerTurboModules");
// Eagerly initialize TurboModules
for (String moduleName : mTurboModuleManager.getEagerInitModuleNames()) {
mTurboModuleManager.getModule(moduleName);
}
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
};
if (ReactNativeFeatureFlags.initEagerTurboModulesOnNativeModulesQueueAndroid()) {
mQueueConfiguration.getNativeModulesQueueThread().runOnQueue(task);
} else {
task.run();
}
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
}

private static synchronized void loadLibraryIfNeeded() {
Expand All @@ -309,18 +318,18 @@ public ReactQueueConfiguration getReactQueueConfiguration() {
}

private class ReactJsExceptionHandlerImpl implements ReactJsExceptionHandler {
private final MessageQueueThread mNativemodulesmessagequeuethread;
private final MessageQueueThread mMessageQueueThread;

ReactJsExceptionHandlerImpl(MessageQueueThread nativeModulesMessageQueueThread) {
this.mNativemodulesmessagequeuethread = nativeModulesMessageQueueThread;
mMessageQueueThread = nativeModulesMessageQueueThread;
}

@Override
public void reportJsException(ParsedError error) {
JavaOnlyMap data = StackTraceHelper.convertParsedError(error);

// Simulate async native module method call
mNativemodulesmessagequeuethread.runOnQueue(
mMessageQueueThread.runOnQueue(
() -> {
NativeExceptionsManagerSpec exceptionsManager =
(NativeExceptionsManagerSpec)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,6 @@ void Binding::installFabricUIManager(
CoreFeatures::excludeYogaFromRawProps =
getFeatureFlagValue("excludeYogaFromRawProps");

// RemoveDelete mega-op
ShadowViewMutation::PlatformSupportsRemoveDeleteTreeInstruction =
getFeatureFlagValue("enableRemoveDeleteTreeInstruction");

auto toolbox = SchedulerToolbox{};
toolbox.contextContainer = contextContainer;
toolbox.componentRegistryFactory = componentsRegistry->buildRegistryFunction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ void FabricMountingManager::executeMount(
break;
}
case ShadowViewMutation::Remove: {
if (!isVirtual && !mutation.isRedundantOperation) {
if (!isVirtual) {
cppCommonMountItems.push_back(CppMountItem::RemoveMountItem(
parentShadowView, oldChildShadowView, index));
}
Expand All @@ -302,10 +302,8 @@ void FabricMountingManager::executeMount(
break;
}
case ShadowViewMutation::Delete: {
if (!mutation.isRedundantOperation) {
cppDeleteMountItems.push_back(
CppMountItem::DeleteMountItem(oldChildShadowView));
}
cppDeleteMountItems.push_back(
CppMountItem::DeleteMountItem(oldChildShadowView));
break;
}
case ShadowViewMutation::Update: {
Expand Down
Loading