add a bunch of debug log statements
Reviewed By: achen1 Differential Revision: D5216191 fbshipit-source-id: 8e8e05d4bcd8b2112fbd15b3809946f1caa0edbe
This commit is contained in:
parent
4990c5c5b3
commit
a1321aedd7
|
@ -22,6 +22,7 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Process;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.facebook.common.logging.FLog;
|
||||
|
@ -108,8 +109,6 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JSC_CALLS;
|
|||
@ThreadSafe
|
||||
public class ReactInstanceManager {
|
||||
|
||||
private static final String TAG = ReactInstanceManager.class.getSimpleName();
|
||||
|
||||
/**
|
||||
* Listener interface for react instance events.
|
||||
*/
|
||||
|
@ -225,7 +224,7 @@ public class ReactInstanceManager {
|
|||
boolean setupReactContextInBackgroundEnabled,
|
||||
boolean useSeparateUIBackgroundThread,
|
||||
int minNumShakes) {
|
||||
|
||||
Log.d(ReactConstants.TAG, "ReactInstanceManager.ctor()");
|
||||
initializeSoLoaderIfNecessary(applicationContext);
|
||||
|
||||
DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(applicationContext);
|
||||
|
@ -289,6 +288,7 @@ public class ReactInstanceManager {
|
|||
* Called from UI thread.
|
||||
*/
|
||||
public void createReactContextInBackground() {
|
||||
Log.d(ReactConstants.TAG, "ReactInstanceManager.createReactContextInBackground()");
|
||||
Assertions.assertCondition(
|
||||
!mHasStartedCreatingInitialContext,
|
||||
"createReactContextInBackground should only be called when creating the react " +
|
||||
|
@ -317,6 +317,7 @@ public class ReactInstanceManager {
|
|||
|
||||
@ThreadConfined(UI)
|
||||
private void recreateReactContextInBackgroundInner() {
|
||||
Log.d(ReactConstants.TAG, "ReactInstanceManager.recreateReactContextInBackgroundInner()");
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
|
||||
if (mUseDeveloperSupport && mJSMainModuleName != null &&
|
||||
|
@ -360,6 +361,9 @@ public class ReactInstanceManager {
|
|||
|
||||
@ThreadConfined(UI)
|
||||
private void recreateReactContextInBackgroundFromBundleLoader() {
|
||||
Log.d(
|
||||
ReactConstants.TAG,
|
||||
"ReactInstanceManager.recreateReactContextInBackgroundFromBundleLoader()");
|
||||
recreateReactContextInBackground(
|
||||
new JSCJavaScriptExecutor.Factory(mJSCConfig.getConfigMap()),
|
||||
mBundleLoader);
|
||||
|
@ -695,6 +699,7 @@ public class ReactInstanceManager {
|
|||
|
||||
@ThreadConfined(UI)
|
||||
private void onReloadWithJSDebugger(JavaJSExecutor.Factory jsExecutorFactory) {
|
||||
Log.d(ReactConstants.TAG, "ReactInstanceManager.onReloadWithJSDebugger()");
|
||||
recreateReactContextInBackground(
|
||||
new ProxyJavaScriptExecutor.Factory(jsExecutorFactory),
|
||||
JSBundleLoader.createRemoteDebuggerBundleLoader(
|
||||
|
@ -704,6 +709,7 @@ public class ReactInstanceManager {
|
|||
|
||||
@ThreadConfined(UI)
|
||||
private void onJSBundleLoadedFromServer() {
|
||||
Log.d(ReactConstants.TAG, "ReactInstanceManager.onJSBundleLoadedFromServer()");
|
||||
recreateReactContextInBackground(
|
||||
new JSCJavaScriptExecutor.Factory(mJSCConfig.getConfigMap()),
|
||||
JSBundleLoader.createCachedBundleFromNetworkLoader(
|
||||
|
@ -715,6 +721,7 @@ public class ReactInstanceManager {
|
|||
private void recreateReactContextInBackground(
|
||||
JavaScriptExecutor.Factory jsExecutorFactory,
|
||||
JSBundleLoader jsBundleLoader) {
|
||||
Log.d(ReactConstants.TAG, "ReactInstanceManager.recreateReactContextInBackground()");
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
|
||||
final ReactContextInitParams initParams = new ReactContextInitParams(
|
||||
|
@ -729,6 +736,7 @@ public class ReactInstanceManager {
|
|||
|
||||
@ThreadConfined(UI)
|
||||
private void runCreateReactContextOnNewThread(final ReactContextInitParams initParams) {
|
||||
Log.d(ReactConstants.TAG, "ReactInstanceManager.runCreateReactContextOnNewThread()");
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
if (mCurrentReactContext != null) {
|
||||
tearDownReactContext(mCurrentReactContext);
|
||||
|
@ -791,6 +799,7 @@ public class ReactInstanceManager {
|
|||
}
|
||||
|
||||
private void setupReactContext(ReactApplicationContext reactContext) {
|
||||
Log.d(ReactConstants.TAG, "ReactInstanceManager.setupReactContext()");
|
||||
ReactMarker.logMarker(PRE_SETUP_REACT_CONTEXT_END);
|
||||
ReactMarker.logMarker(SETUP_REACT_CONTEXT_START);
|
||||
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "setupReactContext");
|
||||
|
@ -849,6 +858,7 @@ public class ReactInstanceManager {
|
|||
private void attachRootViewToInstance(
|
||||
final ReactRootView rootView,
|
||||
CatalystInstance catalystInstance) {
|
||||
Log.d(ReactConstants.TAG, "ReactInstanceManager.attachRootViewToInstance()");
|
||||
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "attachRootViewToInstance");
|
||||
if (!mSetupReactContextInBackgroundEnabled) {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
|
@ -878,12 +888,14 @@ public class ReactInstanceManager {
|
|||
private void detachViewFromInstance(
|
||||
ReactRootView rootView,
|
||||
CatalystInstance catalystInstance) {
|
||||
Log.d(ReactConstants.TAG, "ReactInstanceManager.detachViewFromInstance()");
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
catalystInstance.getJSModule(AppRegistry.class)
|
||||
.unmountApplicationComponentAtRootTag(rootView.getId());
|
||||
}
|
||||
|
||||
private void tearDownReactContext(ReactContext reactContext) {
|
||||
Log.d(ReactConstants.TAG, "ReactInstanceManager.tearDownReactContext()");
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
if (mLifecycleState == LifecycleState.RESUMED) {
|
||||
reactContext.onHostPause();
|
||||
|
@ -907,7 +919,7 @@ public class ReactInstanceManager {
|
|||
private ReactApplicationContext createReactContext(
|
||||
JavaScriptExecutor jsExecutor,
|
||||
JSBundleLoader jsBundleLoader) {
|
||||
FLog.i(ReactConstants.TAG, "Creating react context.");
|
||||
Log.d(ReactConstants.TAG, "ReactInstanceManager.createReactContext()");
|
||||
ReactMarker.logMarker(CREATE_REACT_CONTEXT_START);
|
||||
final ReactApplicationContext reactContext = new ReactApplicationContext(mApplicationContext);
|
||||
NativeModuleRegistryBuilder nativeModuleRegistryBuilder = new NativeModuleRegistryBuilder(
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
|||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import android.content.res.AssetManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
|
@ -95,7 +96,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
|||
final JavaScriptModuleRegistry jsModuleRegistry,
|
||||
final JSBundleLoader jsBundleLoader,
|
||||
NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler) {
|
||||
FLog.d(ReactConstants.TAG, "Initializing React Xplat Bridge.");
|
||||
Log.d(ReactConstants.TAG, "Initializing React Xplat Bridge.");
|
||||
mHybridData = initHybrid();
|
||||
|
||||
mReactQueueConfiguration = ReactQueueConfigurationImpl.create(
|
||||
|
@ -110,7 +111,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
|||
mUIBackgroundQueueThread = mReactQueueConfiguration.getUIBackgroundQueueThread();
|
||||
mTraceListener = new JSProfilerTraceListener(this);
|
||||
|
||||
FLog.d(ReactConstants.TAG, "Initializing React Xplat Bridge before initializeBridge");
|
||||
Log.d(ReactConstants.TAG, "Initializing React Xplat Bridge before initializeBridge");
|
||||
initializeBridge(
|
||||
new BridgeCallback(this),
|
||||
jsExecutor,
|
||||
|
@ -119,7 +120,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
|||
mUIBackgroundQueueThread,
|
||||
mJavaRegistry.getJavaModules(this),
|
||||
mJavaRegistry.getCxxModules());
|
||||
FLog.d(ReactConstants.TAG, "Initializing React Xplat Bridge after initializeBridge");
|
||||
Log.d(ReactConstants.TAG, "Initializing React Xplat Bridge after initializeBridge");
|
||||
}
|
||||
|
||||
private static class BridgeCallback implements ReactCallback {
|
||||
|
@ -197,6 +198,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
|||
|
||||
@Override
|
||||
public void runJSBundle() {
|
||||
Log.d(ReactConstants.TAG, "CatalystInstanceImpl.runJSBundle()");
|
||||
Assertions.assertCondition(!mJSBundleHasLoaded, "JS bundle was already loaded!");
|
||||
|
||||
// incrementPendingJSCalls();
|
||||
|
@ -279,6 +281,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
|||
*/
|
||||
@Override
|
||||
public void destroy() {
|
||||
Log.d(ReactConstants.TAG, "CatalystInstanceImpl.destroy() start");
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
|
||||
if (mDestroyed) {
|
||||
|
@ -304,6 +307,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
|||
mHybridData.resetNative();
|
||||
// Kill non-UI threads from UI thread.
|
||||
getReactQueueConfiguration().destroy();
|
||||
Log.d(ReactConstants.TAG, "CatalystInstanceImpl.destroy() end");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -324,6 +328,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
|||
@VisibleForTesting
|
||||
@Override
|
||||
public void initialize() {
|
||||
Log.d(ReactConstants.TAG, "CatalystInstanceImpl.initialize()");
|
||||
Assertions.assertCondition(
|
||||
!mInitialized,
|
||||
"This catalyst instance has already been initialized");
|
||||
|
|
|
@ -11,5 +11,5 @@ package com.facebook.react.common;
|
|||
|
||||
public class ReactConstants {
|
||||
|
||||
public static final String TAG = "React";
|
||||
public static final String TAG = "ReactNative";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue