add some RN Core markers
Reviewed By: achen1 Differential Revision: D5740438 fbshipit-source-id: eca6160e0ff9089e1f70ead0f2269ce152258c19
This commit is contained in:
parent
7fab093fc8
commit
6c2c2ecd8c
|
@ -1,7 +1,7 @@
|
|||
include_defs("//ReactAndroid/DEFS")
|
||||
|
||||
android_library(
|
||||
name = "debugoverlay",
|
||||
name = "model",
|
||||
srcs = glob(["*.java"]),
|
||||
visibility = [
|
||||
"PUBLIC",
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
package com.facebook.debug.debugoverlay;
|
||||
package com.facebook.debug.debugoverlay.model;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
include_defs("//ReactAndroid/DEFS")
|
||||
|
||||
android_library(
|
||||
name = "holder",
|
||||
srcs = glob(["*.java"]),
|
||||
exported_deps = [
|
||||
react_native_dep("java/com/facebook/debug/debugoverlay/model:model"),
|
||||
],
|
||||
visibility = [
|
||||
"PUBLIC",
|
||||
],
|
||||
deps = [
|
||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
],
|
||||
)
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
package com.facebook.debug.holder;
|
||||
|
||||
import com.facebook.debug.debugoverlay.model.DebugOverlayTag;
|
||||
|
||||
/** No-op implementation of {@link Printer}. */
|
||||
public class NoopPrinter implements Printer {
|
||||
|
||||
public static final NoopPrinter INSTANCE = new NoopPrinter();
|
||||
|
||||
private NoopPrinter() {}
|
||||
|
||||
@Override
|
||||
public void logMessage(DebugOverlayTag tag, String message, Object... args) {}
|
||||
|
||||
@Override
|
||||
public void logMessage(DebugOverlayTag tag, String message) {}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
package com.facebook.debug.holder;
|
||||
|
||||
import com.facebook.debug.debugoverlay.model.DebugOverlayTag;
|
||||
|
||||
/** Interface to pass data to debugging tools. */
|
||||
public interface Printer {
|
||||
|
||||
void logMessage(final DebugOverlayTag tag, final String message, Object... args);
|
||||
|
||||
void logMessage(final DebugOverlayTag tag, final String message);
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
package com.facebook.debug.holder;
|
||||
|
||||
/** Holder for debugging tool instance. */
|
||||
public class PrinterHolder {
|
||||
|
||||
private static Printer sPrinter = NoopPrinter.INSTANCE;
|
||||
|
||||
public static void setPrinter(Printer printer) {
|
||||
if (printer == null) {
|
||||
sPrinter = NoopPrinter.INSTANCE;
|
||||
} else {
|
||||
sPrinter = printer;
|
||||
}
|
||||
}
|
||||
|
||||
public static Printer getPrinter() {
|
||||
return sPrinter;
|
||||
}
|
||||
}
|
|
@ -3,11 +3,13 @@ include_defs("//ReactAndroid/DEFS")
|
|||
android_library(
|
||||
name = "tags",
|
||||
srcs = glob(["*.java"]),
|
||||
exported_deps = [
|
||||
react_native_dep("java/com/facebook/debug/debugoverlay/model:model"),
|
||||
],
|
||||
visibility = [
|
||||
"PUBLIC",
|
||||
],
|
||||
deps = [
|
||||
react_native_dep("java/com/facebook/debug/debugoverlay:debugoverlay"),
|
||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
],
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
package com.facebook.debug.tags;
|
||||
|
||||
import android.graphics.Color;
|
||||
import com.facebook.debug.debugoverlay.DebugOverlayTag;
|
||||
import com.facebook.debug.debugoverlay.model.DebugOverlayTag;
|
||||
|
||||
/** Category for debug overlays. */
|
||||
public class ReactDebugOverlayTags {
|
||||
|
@ -12,4 +12,6 @@ public class ReactDebugOverlayTags {
|
|||
new DebugOverlayTag("Performance", "Markers for Performance", Color.GREEN);
|
||||
public static final DebugOverlayTag NAVIGATION =
|
||||
new DebugOverlayTag("Navigation", "Tag for navigation", Color.rgb(0x9C, 0x27, 0xB0));
|
||||
public static final DebugOverlayTag RN_CORE =
|
||||
new DebugOverlayTag("RN Core", "Tag for React Native Core", Color.BLACK);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ android_library(
|
|||
react_native_dep("libraries/soloader/java/com/facebook/soloader:soloader"),
|
||||
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
|
||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
react_native_target("java/com/facebook/debug/holder:holder"),
|
||||
react_native_target("java/com/facebook/debug/tags:tags"),
|
||||
react_native_target("java/com/facebook/react/bridge:bridge"),
|
||||
react_native_target("java/com/facebook/react/common:common"),
|
||||
react_native_target("java/com/facebook/react/devsupport:devsupport"),
|
||||
|
|
|
@ -37,6 +37,8 @@ import android.os.Process;
|
|||
import android.util.Log;
|
||||
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.Assertions;
|
||||
import com.facebook.infer.annotation.ThreadConfined;
|
||||
import com.facebook.infer.annotation.ThreadSafe;
|
||||
|
@ -270,6 +272,8 @@ public class ReactInstanceManager {
|
|||
mMinTimeLeftInFrameForNonBatchedOperationMs);
|
||||
mPackages.add(coreModulesPackage);
|
||||
} else {
|
||||
PrinterHolder.getPrinter()
|
||||
.logMessage(ReactDebugOverlayTags.RN_CORE, "RNCore: Use Split Packages");
|
||||
mPackages.add(new BridgeCorePackage(this, mBackBtnHandler));
|
||||
if (mUseDeveloperSupport) {
|
||||
mPackages.add(new DebugCorePackage());
|
||||
|
@ -401,6 +405,8 @@ public class ReactInstanceManager {
|
|||
@ThreadConfined(UI)
|
||||
private void recreateReactContextInBackgroundInner() {
|
||||
Log.d(ReactConstants.TAG, "ReactInstanceManager.recreateReactContextInBackgroundInner()");
|
||||
PrinterHolder.getPrinter()
|
||||
.logMessage(ReactDebugOverlayTags.RN_CORE, "RNCore: recreateReactContextInBackground");
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
|
||||
if (mUseDeveloperSupport && mJSMainModulePath != null &&
|
||||
|
@ -447,6 +453,8 @@ public class ReactInstanceManager {
|
|||
Log.d(
|
||||
ReactConstants.TAG,
|
||||
"ReactInstanceManager.recreateReactContextInBackgroundFromBundleLoader()");
|
||||
PrinterHolder.getPrinter()
|
||||
.logMessage(ReactDebugOverlayTags.RN_CORE, "RNCore: load from BundleLoader");
|
||||
recreateReactContextInBackground(mJavaScriptExecutorFactory, mBundleLoader);
|
||||
}
|
||||
|
||||
|
@ -613,6 +621,7 @@ public class ReactInstanceManager {
|
|||
@ThreadConfined(UI)
|
||||
public void destroy() {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
PrinterHolder.getPrinter().logMessage(ReactDebugOverlayTags.RN_CORE, "RNCore: Destroy");
|
||||
|
||||
if (mUseDeveloperSupport) {
|
||||
mDevSupportManager.setDevSupportEnabled(false);
|
||||
|
|
|
@ -13,6 +13,8 @@ android_library(
|
|||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
react_native_dep("third-party/java/okhttp:okhttp3"),
|
||||
react_native_dep("third-party/java/okio:okio"),
|
||||
react_native_target("java/com/facebook/debug/holder:holder"),
|
||||
react_native_target("java/com/facebook/debug/tags:tags"),
|
||||
react_native_target("java/com/facebook/react/bridge:bridge"),
|
||||
react_native_target("java/com/facebook/react/common:common"),
|
||||
react_native_target("java/com/facebook/react/common/network:network"),
|
||||
|
|
|
@ -9,21 +9,6 @@
|
|||
|
||||
package com.facebook.react.devsupport;
|
||||
|
||||
import com.facebook.react.bridge.ReactMarker;
|
||||
import com.facebook.react.bridge.ReactMarkerConstants;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
|
@ -37,14 +22,17 @@ import android.hardware.SensorManager;
|
|||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.debug.holder.PrinterHolder;
|
||||
import com.facebook.debug.tags.ReactDebugOverlayTags;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.R;
|
||||
import com.facebook.react.bridge.CatalystInstance;
|
||||
import com.facebook.react.bridge.DefaultNativeModuleCallExceptionHandler;
|
||||
import com.facebook.react.bridge.JavaJSExecutor;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactMarker;
|
||||
import com.facebook.react.bridge.ReactMarkerConstants;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.common.DebugServerException;
|
||||
|
@ -60,7 +48,17 @@ import com.facebook.react.devsupport.interfaces.StackFrame;
|
|||
import com.facebook.react.modules.debug.interfaces.DeveloperSettings;
|
||||
import com.facebook.react.packagerconnection.RequestHandler;
|
||||
import com.facebook.react.packagerconnection.Responder;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import javax.annotation.Nullable;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
|
@ -624,6 +622,7 @@ public class DevSupportManagerImpl implements
|
|||
|
||||
@Override
|
||||
public void handleReloadJS() {
|
||||
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
|
||||
ReactMarker.logMarker(ReactMarkerConstants.RELOAD);
|
||||
|
@ -634,10 +633,14 @@ public class DevSupportManagerImpl implements
|
|||
}
|
||||
|
||||
if (mDevSettings.isRemoteJSDebugEnabled()) {
|
||||
PrinterHolder.getPrinter()
|
||||
.logMessage(ReactDebugOverlayTags.RN_CORE, "RNCore: load from Proxy");
|
||||
mDevLoadingViewController.showForRemoteJSEnabled();
|
||||
mDevLoadingViewVisible = true;
|
||||
reloadJSInProxyMode();
|
||||
} else {
|
||||
PrinterHolder.getPrinter()
|
||||
.logMessage(ReactDebugOverlayTags.RN_CORE, "RNCore: load from Server");
|
||||
String bundleURL =
|
||||
mDevServerHelper.getDevServerBundleURL(Assertions.assertNotNull(mJSAppBundleName));
|
||||
reloadJSFromServer(bundleURL);
|
||||
|
|
Loading…
Reference in New Issue