Log when item execution is delayed during mounting

Summary:
Adds logs to indicate that MountItem was queued instead of executed.
Also moves logging of preMount items to dispatcher for consistent logging with other items.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D28690203

fbshipit-source-id: 14d24f0bebb97a810127f5187b4d46f66b6c836f
This commit is contained in:
Andrei Shikov
2021-05-27 04:42:31 -07:00
committed by Facebook GitHub Bot
parent 44717152ca
commit 712bc6769b
2 changed files with 12 additions and 5 deletions
@@ -282,12 +282,17 @@ public class MountItemDispatcher {
}
PreAllocateViewMountItem preMountItemToDispatch = mPreMountItems.poll();
// If list is empty, `poll` will return null, or var will never be set
if (preMountItemToDispatch == null) {
break;
}
if (ENABLE_FABRIC_LOGS) {
printMountItem(
preMountItemToDispatch,
"dispatchPreMountItems: Dispatching PreAllocateViewMountItem");
}
executeOrEnqueue(preMountItemToDispatch);
}
} finally {
@@ -299,6 +304,12 @@ public class MountItemDispatcher {
private void executeOrEnqueue(MountItem item) {
if (mMountingManager.isWaitingForViewAttach(item.getSurfaceId())) {
if (ENABLE_FABRIC_LOGS) {
FLog.e(
TAG,
"executeOrEnqueue: Item execution delayed, surface %s is not ready yet",
item.getSurfaceId());
}
SurfaceMountingManager surfaceMountingManager =
mMountingManager.getSurfaceManager(item.getSurfaceId());
surfaceMountingManager.executeOnViewAttach(item);
@@ -7,7 +7,6 @@
package com.facebook.react.fabric.mounting.mountitems;
import static com.facebook.react.fabric.FabricUIManager.ENABLE_FABRIC_LOGS;
import static com.facebook.react.fabric.FabricUIManager.IS_DEVELOPMENT_ENVIRONMENT;
import static com.facebook.react.fabric.FabricUIManager.TAG;
@@ -51,9 +50,6 @@ public class PreAllocateViewMountItem implements MountItem {
@Override
public void execute(@NonNull MountingManager mountingManager) {
if (ENABLE_FABRIC_LOGS) {
FLog.d(TAG, "Executing pre-allocation of: " + toString());
}
SurfaceMountingManager surfaceMountingManager = mountingManager.getSurfaceManager(mSurfaceId);
if (surfaceMountingManager == null) {
FLog.e(