Cleanup markers in getConstants
Summary: * Only add the moduleName to the outer marker * Include module init in the marker time * Include the WritableNativeArray time in CONVERT_CONSTANTS * Stop all markers from finally block in case of exception Reviewed By: kathryngray Differential Revision: D5031411 fbshipit-source-id: bf86ee3d59f2cb38866afd52e84af5699db1a003
This commit is contained in:
parent
2de2133014
commit
e9fc7311c4
|
@ -129,29 +129,32 @@ public class JavaModuleWrapper {
|
|||
if (!mModuleHolder.getHasConstants()) {
|
||||
return null;
|
||||
}
|
||||
BaseJavaModule baseJavaModule = getModule();
|
||||
ReactMarker.logMarker(GET_CONSTANTS_START, getName());
|
||||
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "Map constants")
|
||||
.arg("moduleName", getName())
|
||||
|
||||
final String moduleName = getName();
|
||||
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "JavaModuleWrapper.getConstants")
|
||||
.arg("moduleName", moduleName)
|
||||
.flush();
|
||||
ReactMarker.logMarker(GET_CONSTANTS_START, moduleName);
|
||||
|
||||
BaseJavaModule baseJavaModule = getModule();
|
||||
|
||||
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "module.getConstants");
|
||||
Map<String, Object> map = baseJavaModule.getConstants();
|
||||
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
|
||||
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "WritableNativeMap constants")
|
||||
.arg("moduleName", getName())
|
||||
.flush();
|
||||
ReactMarker.logMarker(CONVERT_CONSTANTS_START, getName());
|
||||
WritableNativeMap writableNativeMap;
|
||||
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "create WritableNativeMap");
|
||||
ReactMarker.logMarker(CONVERT_CONSTANTS_START, moduleName);
|
||||
try {
|
||||
writableNativeMap = Arguments.makeNativeMap(map);
|
||||
WritableNativeArray array = new WritableNativeArray();
|
||||
array.pushMap(Arguments.makeNativeMap(map));
|
||||
return array;
|
||||
} finally {
|
||||
ReactMarker.logMarker(CONVERT_CONSTANTS_END);
|
||||
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
|
||||
ReactMarker.logMarker(GET_CONSTANTS_END);
|
||||
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
}
|
||||
WritableNativeArray array = new WritableNativeArray();
|
||||
array.pushMap(writableNativeMap);
|
||||
ReactMarker.logMarker(CONVERT_CONSTANTS_END);
|
||||
ReactMarker.logMarker(GET_CONSTANTS_END);
|
||||
return array;
|
||||
}
|
||||
|
||||
@DoNotStrip
|
||||
|
|
|
@ -99,7 +99,7 @@ public class ModuleHolder {
|
|||
SoftAssertions.assertCondition(mModule == null, "Creating an already created module.");
|
||||
int instanceKey = sInstanceKeyCounter.getAndIncrement();
|
||||
ReactMarker.logMarker(CREATE_MODULE_START, mName, instanceKey);
|
||||
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "createModule")
|
||||
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "ModuleHolder.createModule")
|
||||
.arg("name", mName)
|
||||
.flush();
|
||||
NativeModule module;
|
||||
|
@ -118,14 +118,9 @@ public class ModuleHolder {
|
|||
}
|
||||
|
||||
private void doInitialize(NativeModule module) {
|
||||
SystraceMessage.Builder section =
|
||||
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "initialize");
|
||||
if (module instanceof CxxModuleWrapper) {
|
||||
section.arg("className", module.getClass().getSimpleName());
|
||||
} else {
|
||||
section.arg("name", mName);
|
||||
}
|
||||
section.flush();
|
||||
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "ModuleHolder.initialize")
|
||||
.arg("name", mName)
|
||||
.flush();
|
||||
ReactMarker.logMarker(ReactMarkerConstants.INITIALIZE_MODULE_START, mName);
|
||||
try {
|
||||
module.initialize();
|
||||
|
|
Loading…
Reference in New Issue