Add extra logs in FabricUIManager

Summary: This diff adds extra logging in FabricUIManager, this will be useful to debug production issues

Reviewed By: JoshuaGross

Differential Revision: D15907520

fbshipit-source-id: 94e16444af3c023b6c4837c4797404d3debe8e95
This commit is contained in:
David Vacca
2019-06-21 11:52:56 -07:00
committed by Facebook Github Bot
parent 4f4d3857ea
commit 42e35b3b56
@@ -131,11 +131,16 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
public <T extends View> int addRootView(
final T rootView, final WritableMap initialProps, final @Nullable String initialUITemplate) {
final int rootTag = ReactRootViewTagGenerator.getNextRootViewTag();
//TODO T31905686: Refactor both addRootView methods into one method
ThemedReactContext reactContext =
new ThemedReactContext(mReactApplicationContext, rootView.getContext());
mMountingManager.addRootView(rootTag, rootView);
mReactContextForRootTag.put(rootTag, reactContext);
mBinding.startSurface(rootTag, ((ReactRoot) rootView).getJSModuleName(), (NativeMap) initialProps);
String moduleName = ((ReactRoot) rootView).getJSModuleName();
if (DEBUG) {
FLog.d(TAG, "Starting surface for module: %s and reactTag: %d", moduleName, rootTag);
}
mBinding.startSurface(rootTag, moduleName, (NativeMap) initialProps);
if (initialUITemplate != null) {
mBinding.renderTemplateToSurface(rootTag, initialUITemplate);
}
@@ -147,6 +152,9 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
final int rootTag = ReactRootViewTagGenerator.getNextRootViewTag();
ThemedReactContext reactContext =
new ThemedReactContext(mReactApplicationContext, rootView.getContext());
if (DEBUG) {
FLog.d(TAG, "Starting surface for module: %s and reactTag: %d", moduleName, rootTag);
}
mMountingManager.addRootView(rootTag, rootView);
mReactContextForRootTag.put(rootTag, reactContext);
mBinding.startSurfaceWithConstraints(
@@ -172,6 +180,9 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
// TODO T31905686: integrate with the unmounting of Fabric React Renderer.
mMountingManager.removeRootView(reactRootTag);
mReactContextForRootTag.remove(reactRootTag);
if (DEBUG) {
FLog.d(TAG, "Removing surface for reactTag: ", reactRootTag);
}
}
@Override
@@ -182,6 +193,9 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
@Override
public void onCatalystInstanceDestroy() {
if (DEBUG) {
FLog.d(TAG, "Destroying Catalyst Instance" );
}
mEventDispatcher.removeBatchEventDispatchedListener(mEventBeatManager);
mEventDispatcher.unregisterEventEmitter(FABRIC);
mBinding.unregister();
@@ -421,6 +435,10 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
public void updateRootLayoutSpecs(
final int rootTag, final int widthMeasureSpec, final int heightMeasureSpec) {
if (DEBUG) {
FLog.d(TAG, "Updating Root Layout Specs");
}
mReactApplicationContext.runOnJSQueueThread(new Runnable() {
@Override
public void run() {