mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-06 22:37:14 +08:00
Add logs in mounting layer
Summary: Adds debug logging in FabricUIManager and the mounting layer of Fabric. Reviewed By: shergin Differential Revision: D14594521 fbshipit-source-id: a5c0ee39e1bac8a340849ca3e044694cbee5427e
This commit is contained in:
committed by
Facebook Github Bot
parent
58c16e63a4
commit
0c17992485
@@ -20,6 +20,8 @@ import androidx.annotation.Nullable;
|
||||
import androidx.annotation.UiThread;
|
||||
import android.view.View;
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.debug.holder.PrinterHolder;
|
||||
import com.facebook.debug.tags.ReactDebugOverlayTags;
|
||||
import com.facebook.infer.annotation.ThreadConfined;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.react.bridge.LifecycleEventListener;
|
||||
@@ -65,7 +67,9 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
@SuppressLint("MissingNativeLoadLibrary")
|
||||
public class FabricUIManager implements UIManager, LifecycleEventListener {
|
||||
|
||||
private static final String TAG = FabricUIManager.class.getSimpleName();
|
||||
public static final String TAG = FabricUIManager.class.getSimpleName();
|
||||
public static final boolean DEBUG =
|
||||
PrinterHolder.getPrinter().shouldDisplayLogMessage(ReactDebugOverlayTags.FABRIC_UI_MANAGER);
|
||||
|
||||
private static final Map<String, String> sComponentNames = new HashMap<>();
|
||||
private static final int FRAME_TIME_MS = 16;
|
||||
@@ -161,7 +165,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
|
||||
mMountingManager.removeRootView(reactRootTag);
|
||||
mReactContextForRootTag.remove(reactRootTag);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
mEventDispatcher.registerEventEmitter(FABRIC, new FabricEventEmitter(this));
|
||||
|
||||
@@ -6,10 +6,15 @@
|
||||
*/
|
||||
package com.facebook.react.fabric.mounting.mountitems;
|
||||
|
||||
import static com.facebook.react.fabric.FabricUIManager.DEBUG;
|
||||
import static com.facebook.react.fabric.FabricUIManager.TAG;
|
||||
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.react.fabric.mounting.MountingManager;
|
||||
import com.facebook.systrace.Systrace;
|
||||
|
||||
import com.facebook.common.logging.FLog;
|
||||
|
||||
/**
|
||||
* This class represents a batch of {@link MountItem}s
|
||||
*
|
||||
@@ -44,6 +49,9 @@ public class BatchMountItem implements MountItem {
|
||||
|
||||
for (int mountItemIndex = 0; mountItemIndex < mSize; mountItemIndex++) {
|
||||
MountItem mountItem = mMountItems[mountItemIndex];
|
||||
if (DEBUG) {
|
||||
FLog.d(TAG, "Executing mountItem: " + mountItem);
|
||||
}
|
||||
mountItem.execute(mountingManager);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
*/
|
||||
package com.facebook.react.fabric.mounting.mountitems;
|
||||
|
||||
import static com.facebook.react.fabric.FabricUIManager.DEBUG;
|
||||
import static com.facebook.react.fabric.FabricUIManager.TAG;
|
||||
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.fabric.mounting.MountingManager;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
@@ -21,7 +25,12 @@ public class PreAllocateViewMountItem implements MountItem {
|
||||
private final boolean mIsLayoutable;
|
||||
|
||||
public PreAllocateViewMountItem(
|
||||
ThemedReactContext context, int rootTag, int reactTag, String component, ReadableMap props, boolean isLayoutable) {
|
||||
ThemedReactContext context,
|
||||
int rootTag,
|
||||
int reactTag,
|
||||
String component,
|
||||
ReadableMap props,
|
||||
boolean isLayoutable) {
|
||||
mContext = context;
|
||||
mComponent = component;
|
||||
mRootTag = rootTag;
|
||||
@@ -32,11 +41,23 @@ public class PreAllocateViewMountItem implements MountItem {
|
||||
|
||||
@Override
|
||||
public void execute(MountingManager mountingManager) {
|
||||
if (DEBUG) {
|
||||
FLog.d(TAG, "Executing pre-allocation of: " + toString());
|
||||
}
|
||||
mountingManager.preallocateView(mContext, mComponent, mReactTag, mProps, mIsLayoutable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[" + mRootTag + "] - Preallocate " + mComponent;
|
||||
return "PreAllocateViewMountItem ["
|
||||
+ mReactTag
|
||||
+ "] - component: "
|
||||
+ mComponent
|
||||
+ " rootTag: "
|
||||
+ mRootTag
|
||||
+ " mIsLayoutable: "
|
||||
+ mIsLayoutable
|
||||
+ " props: "
|
||||
+ mProps;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user