Permalink
Browse files

add a bunch of debug log statements

Reviewed By: achen1

Differential Revision: D5216191

fbshipit-source-id: 8e8e05d4bcd8b2112fbd15b3809946f1caa0edbe
  • Loading branch information...
AaaChiuuu authored and facebook-github-bot committed Jun 9, 2017
1 parent 4990c5c commit a1321aedd7f139cefa2d05bdd09866e0969120d4
@@ -22,6 +22,7 @@
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 @@
@ThreadSafe
public class ReactInstanceManager {
private static final String TAG = ReactInstanceManager.class.getSimpleName();
/**
* Listener interface for react instance events.
*/
@@ -225,7 +224,7 @@ public static ReactInstanceManagerBuilder builder() {
boolean setupReactContextInBackgroundEnabled,
boolean useSeparateUIBackgroundThread,
int minNumShakes) {
Log.d(ReactConstants.TAG, "ReactInstanceManager.ctor()");
initializeSoLoaderIfNecessary(applicationContext);
DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(applicationContext);
@@ -289,6 +288,7 @@ private static void initializeSoLoaderIfNecessary(Context applicationContext) {
* 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 void recreateReactContextInBackground() {
@ThreadConfined(UI)
private void recreateReactContextInBackgroundInner() {
Log.d(ReactConstants.TAG, "ReactInstanceManager.recreateReactContextInBackgroundInner()");
UiThreadUtil.assertOnUiThread();
if (mUseDeveloperSupport && mJSMainModuleName != null &&
@@ -360,6 +361,9 @@ public void run() {
@ThreadConfined(UI)
private void recreateReactContextInBackgroundFromBundleLoader() {
Log.d(
ReactConstants.TAG,
"ReactInstanceManager.recreateReactContextInBackgroundFromBundleLoader()");
recreateReactContextInBackground(
new JSCJavaScriptExecutor.Factory(mJSCConfig.getConfigMap()),
mBundleLoader);
@@ -695,6 +699,7 @@ public int getMinNumShakes() {
@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 @@ private void onReloadWithJSDebugger(JavaJSExecutor.Factory jsExecutorFactory) {
@ThreadConfined(UI)
private void onJSBundleLoadedFromServer() {
Log.d(ReactConstants.TAG, "ReactInstanceManager.onJSBundleLoadedFromServer()");
recreateReactContextInBackground(
new JSCJavaScriptExecutor.Factory(mJSCConfig.getConfigMap()),
JSBundleLoader.createCachedBundleFromNetworkLoader(
@@ -715,6 +721,7 @@ private void onJSBundleLoadedFromServer() {
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 @@ private void recreateReactContextInBackground(
@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 void run() {
}
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 void run() {
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 void run() {
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 @@ private void tearDownReactContext(ReactContext reactContext) {
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.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 @@ private CatalystInstanceImpl(
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 @@ private CatalystInstanceImpl(
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 @@ private CatalystInstanceImpl(
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 @@ private native void initializeBridge(
@Override
public void runJSBundle() {
Log.d(ReactConstants.TAG, "CatalystInstanceImpl.runJSBundle()");
Assertions.assertCondition(!mJSBundleHasLoaded, "JS bundle was already loaded!");
// incrementPendingJSCalls();
@@ -279,6 +281,7 @@ public void invokeCallback(final int callbackID, final NativeArray arguments) {
*/
@Override
public void destroy() {
Log.d(ReactConstants.TAG, "CatalystInstanceImpl.destroy() start");
UiThreadUtil.assertOnUiThread();
if (mDestroyed) {
@@ -304,6 +307,7 @@ public void run() {
mHybridData.resetNative();
// Kill non-UI threads from UI thread.
getReactQueueConfiguration().destroy();
Log.d(ReactConstants.TAG, "CatalystInstanceImpl.destroy() end");
}
});
}
@@ -324,6 +328,7 @@ public boolean isDestroyed() {
@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 @@
public class ReactConstants {
public static final String TAG = "React";
public static final String TAG = "ReactNative";
}

0 comments on commit a1321ae

Please sign in to comment.