add JS->Java Bridge traffic

Reviewed By: achen1

Differential Revision: D5740501

fbshipit-source-id: 3a88cd95d3a58aac24968e577f4eb3096d47d4ec
This commit is contained in:
Aaron Chiu 2017-09-19 11:57:08 -07:00 committed by Facebook Github Bot
parent 4fc9e20fce
commit 12f123d3e4
3 changed files with 20 additions and 8 deletions

View File

@ -14,4 +14,7 @@ public class ReactDebugOverlayTags {
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);
public static final DebugOverlayTag BRIDGE_CALLS =
new DebugOverlayTag(
"Bridge Calls", "JS to Java calls (warning: this is spammy)", Color.MAGENTA);
}

View File

@ -16,11 +16,14 @@ android_library(
"PUBLIC",
],
deps = [
react_native_dep("java/com/facebook/debug/debugoverlay/model:model"),
react_native_dep("java/com/facebook/systrace:systrace"),
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
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/tags:tags"),
react_native_target("java/com/facebook/debug/holder:holder"),
react_native_target("java/com/facebook/react/common:common"),
react_native_target("java/com/facebook/react/module/model:model"),
] + ([react_native_target("jni/react/jni:jni")] if not IS_OSS_BUILD else []),

View File

@ -9,17 +9,17 @@
package com.facebook.react.bridge;
import javax.annotation.Nullable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import com.facebook.infer.annotation.Assertions;
import com.facebook.systrace.SystraceMessage;
import static com.facebook.infer.annotation.Assertions.assertNotNull;
import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
import com.facebook.debug.holder.PrinterHolder;
import com.facebook.debug.tags.ReactDebugOverlayTags;
import com.facebook.infer.annotation.Assertions;
import com.facebook.systrace.SystraceMessage;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import javax.annotation.Nullable;
public class JavaMethodWrapper implements NativeModule.NativeMethod {
private static abstract class ArgumentExtractor<T> {
@ -332,6 +332,12 @@ public class JavaMethodWrapper implements NativeModule.NativeMethod {
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "callJavaModuleMethod")
.arg("method", traceName)
.flush();
PrinterHolder.getPrinter()
.logMessage(
ReactDebugOverlayTags.BRIDGE_CALLS,
"JS->Java: %s.%s()",
mModuleWrapper.getName(),
mMethod.getName());
try {
if (!mArgumentsProcessed) {
processArguments();