Improve Fabric debug logging (#39778)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39778

Used with `IS_DEVELOPMENT_ENVIRONMENT` and `ReactFeatureFlags.enableFabricLogs`.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D49864983

fbshipit-source-id: bf912abd765ff74e9ed8b94571293f79458feca2
This commit is contained in:
Pieter De Baets authored and Facebook GitHub Bot committed 2023-10-03 16:04:51 -07:00
1 parent 72d0fed272
commit c604f10d4a
3 files changed
+19 -7

No files matched your search

@@ -83,4 +83,18 @@ public class StateWrapperImpl implements StateWrapper {
mHybridData.resetNative();
}
}
@Override
public String toString() {
if (mDestroyed) {
return "<destroyed>";
}
ReadableNativeMap map = getStateDataImpl();
if (map == null) {
return "<unexpected null>";
}
return map.toString();
}
}
@@ -247,12 +247,13 @@ public class MountItemDispatcher {
// If there are MountItems to dispatch, we make sure all the "pre mount items" are executed
// first
Collection<MountItem> preMountItemsToDispatch = getAndResetPreMountItems();
if (preMountItemsToDispatch != null) {
Systrace.beginSection(
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "FabricUIManager::mountViews preMountItems");
for (MountItem preMountItem : preMountItemsToDispatch) {
if (ENABLE_FABRIC_LOGS) {
printMountItem(preMountItem, "dispatchMountItems: Executing preMountItem");
}
executeOrEnqueue(preMountItem);
}
@@ -330,11 +331,8 @@ public class MountItemDispatcher {
}
if (ENABLE_FABRIC_LOGS) {
printMountItem(
preMountItemToDispatch,
"dispatchPreMountItems: Dispatching PreAllocateViewMountItem");
printMountItem(preMountItemToDispatch, "dispatchPreMountItems");
}
executeOrEnqueue(preMountItemToDispatch);
}
} finally {
@@ -242,7 +242,7 @@ final class IntBufferBatchMountItem implements BatchMountItem {
StateWrapper state = castToState(mObjBuffer[j++]);
String stateString =
IS_DEVELOPMENT_ENVIRONMENT
? (state != null ? state.getStateData().toString() : "<null>")
? (state != null ? state.toString() : "<null>")
: "<hidden>";
s.append(String.format("UPDATE STATE [%d]: %s\n", mIntBuffer[i++], stateString));
} else if (type == INSTRUCTION_UPDATE_LAYOUT) {