Stop SystraceMessage markers with SystraceMessage.endSection

Reviewed By: javache

Differential Revision: D5182628

fbshipit-source-id: f5112a434cb7564410b0e2e69840e45a0777a184
This commit is contained in:
Michał Gregorczyk
2017-06-06 11:01:20 -07:00
committed by Facebook Github Bot
parent 964c3a1b7a
commit 46b3a89a70
5 changed files with 20 additions and 16 deletions
@@ -230,14 +230,20 @@ public class JavaMethodWrapper implements NativeModule.NativeMethod {
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "processArguments")
.arg("method", mModuleWrapper.getName() + "." + mMethod.getName())
.flush();
mArgumentsProcessed = true;
mArgumentExtractors = buildArgumentExtractors(mParameterTypes);
mSignature = buildSignature(mMethod, mParameterTypes, (mType.equals(BaseJavaModule.METHOD_TYPE_SYNC)));
// Since native methods are invoked from a message queue executed on a single thread, it is
// safe to allocate only one arguments object per method that can be reused across calls
mArguments = new Object[mParameterTypes.length];
mJSArgumentsNeeded = calculateJSArgumentsNeeded();
com.facebook.systrace.Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
try {
mArgumentsProcessed = true;
mArgumentExtractors = buildArgumentExtractors(mParameterTypes);
mSignature = buildSignature(
mMethod,
mParameterTypes,
(mType.equals(BaseJavaModule.METHOD_TYPE_SYNC)));
// Since native methods are invoked from a message queue executed on a single thread, it is
// safe to allocate only one arguments object per method that can be reused across calls
mArguments = new Object[mParameterTypes.length];
mJSArgumentsNeeded = calculateJSArgumentsNeeded();
} finally {
SystraceMessage.endSection(TRACE_TAG_REACT_JAVA_BRIDGE).flush();
}
}
public Method getMethod() {
@@ -368,7 +374,7 @@ public class JavaMethodWrapper implements NativeModule.NativeMethod {
throw new RuntimeException("Could not invoke " + traceName, ite);
}
} finally {
com.facebook.systrace.Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
SystraceMessage.endSection(TRACE_TAG_REACT_JAVA_BRIDGE).flush();
}
}