Skip to content

Commit

Permalink
add JS->Java Bridge traffic
Browse files Browse the repository at this point in the history
Reviewed By: achen1

Differential Revision: D5740501

fbshipit-source-id: 3a88cd95d3a58aac24968e577f4eb3096d47d4ec
  • Loading branch information
aaronechiu authored and facebook-github-bot committed Sep 19, 2017
1 parent 4fc9e20 commit 12f123d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
Expand Up @@ -14,4 +14,7 @@ public class ReactDebugOverlayTags {
new DebugOverlayTag("Navigation", "Tag for navigation", Color.rgb(0x9C, 0x27, 0xB0)); new DebugOverlayTag("Navigation", "Tag for navigation", Color.rgb(0x9C, 0x27, 0xB0));
public static final DebugOverlayTag RN_CORE = public static final DebugOverlayTag RN_CORE =
new DebugOverlayTag("RN Core", "Tag for React Native Core", Color.BLACK); 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);
} }
3 changes: 3 additions & 0 deletions ReactAndroid/src/main/java/com/facebook/react/bridge/BUCK
Expand Up @@ -16,11 +16,14 @@ android_library(
"PUBLIC", "PUBLIC",
], ],
deps = [ deps = [
react_native_dep("java/com/facebook/debug/debugoverlay/model:model"),
react_native_dep("java/com/facebook/systrace:systrace"), 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/fbcore/src/main/java/com/facebook/common/logging:logging"),
react_native_dep("libraries/soloader/java/com/facebook/soloader:soloader"), 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/infer-annotations:infer-annotations"),
react_native_dep("third-party/java/jsr-305:jsr-305"), 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/common:common"),
react_native_target("java/com/facebook/react/module/model:model"), react_native_target("java/com/facebook/react/module/model:model"),
] + ([react_native_target("jni/react/jni:jni")] if not IS_OSS_BUILD else []), ] + ([react_native_target("jni/react/jni:jni")] if not IS_OSS_BUILD else []),
Expand Down
Expand Up @@ -9,16 +9,16 @@


package com.facebook.react.bridge; package com.facebook.react.bridge;


import javax.annotation.Nullable; import static com.facebook.infer.annotation.Assertions.assertNotNull;

import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;


import com.facebook.debug.holder.PrinterHolder;
import com.facebook.debug.tags.ReactDebugOverlayTags;
import com.facebook.infer.annotation.Assertions; import com.facebook.infer.annotation.Assertions;
import com.facebook.systrace.SystraceMessage; import com.facebook.systrace.SystraceMessage;

import java.lang.reflect.InvocationTargetException;
import static com.facebook.infer.annotation.Assertions.assertNotNull; import java.lang.reflect.Method;
import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE; import javax.annotation.Nullable;


public class JavaMethodWrapper implements NativeModule.NativeMethod { public class JavaMethodWrapper implements NativeModule.NativeMethod {


Expand Down Expand Up @@ -332,6 +332,12 @@ public void invoke(JSInstance jsInstance, ReadableNativeArray parameters) {
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "callJavaModuleMethod") SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "callJavaModuleMethod")
.arg("method", traceName) .arg("method", traceName)
.flush(); .flush();
PrinterHolder.getPrinter()
.logMessage(
ReactDebugOverlayTags.BRIDGE_CALLS,
"JS->Java: %s.%s()",
mModuleWrapper.getName(),
mMethod.getName());
try { try {
if (!mArgumentsProcessed) { if (!mArgumentsProcessed) {
processArguments(); processArguments();
Expand Down

0 comments on commit 12f123d

Please sign in to comment.