Easy: Add Java module and method name to systrace in xplat bridge

Summary: We lost java module and method names in systrace when we moved to the xplat bridge.

Reviewed By: mhorowitz

Differential Revision: D3116042

fb-gh-sync-id: a61181f4d6be04c70122b7f79d426e364df1e988
fbshipit-source-id: a61181f4d6be04c70122b7f79d426e364df1e988
This commit is contained in:
Andy Street 2016-03-30 12:52:25 -07:00 committed by Facebook Github Bot 8
parent ac03c47895
commit d3b8846400
1 changed files with 6 additions and 1 deletions

View File

@ -11,6 +11,7 @@ package com.facebook.react.bridge;
import com.facebook.infer.annotation.Assertions;
import com.facebook.systrace.Systrace;
import com.facebook.systrace.SystraceMessage;
import javax.annotation.Nullable;
@ -160,6 +161,7 @@ public abstract class BaseJavaModule implements NativeModule {
private final Object[] mArguments;
private String mType = METHOD_TYPE_REMOTE;
private final int mJSArgumentsNeeded;
private final String mTraceName;
public JavaMethod(Method method) {
mMethod = method;
@ -169,6 +171,7 @@ public abstract class BaseJavaModule implements NativeModule {
// save to allocate only one arguments object per method that can be reused across calls
mArguments = new Object[parameterTypes.length];
mJSArgumentsNeeded = calculateJSArgumentsNeeded();
mTraceName = BaseJavaModule.this.getName() + "." + mMethod.getName();
}
private ArgumentExtractor[] buildArgumentExtractors(Class[] paramTypes) {
@ -231,7 +234,9 @@ public abstract class BaseJavaModule implements NativeModule {
@Override
public void invoke(CatalystInstance catalystInstance, ExecutorToken executorToken, ReadableNativeArray parameters) {
Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "callJavaModuleMethod");
SystraceMessage.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "callJavaModuleMethod")
.arg("method", mTraceName)
.flush();
try {
if (mJSArgumentsNeeded != parameters.size()) {
throw new NativeArgumentsParseException(