log getConstants for Java modules

Reviewed By: fkgozali

Differential Revision: D4548706

fbshipit-source-id: ffcb6acd15e517ee13da88ef9a901f15e96a87c8
This commit is contained in:
Aaron Chiu 2017-02-13 14:42:35 -08:00 committed by Facebook Github Bot
parent 8b63fd7bb2
commit 50de41d5d6
2 changed files with 7 additions and 0 deletions

View File

@ -58,4 +58,6 @@ public class ReactMarkerConstants {
"CREATE_I18N_ASSETS_MODULE_START"; "CREATE_I18N_ASSETS_MODULE_START";
public static final String CREATE_I18N_ASSETS_MODULE_END = public static final String CREATE_I18N_ASSETS_MODULE_END =
"CREATE_I18N_ASSETS_MODULE_END"; "CREATE_I18N_ASSETS_MODULE_END";
public static final String GET_CONSTANTS_START = "GET_CONSTANTS_START";
public static final String GET_CONSTANTS_END = "GET_CONSTANTS_END";
} }

View File

@ -21,12 +21,15 @@ import com.facebook.react.bridge.ExecutorToken;
import com.facebook.react.bridge.NativeArray; import com.facebook.react.bridge.NativeArray;
import com.facebook.react.bridge.NativeModuleLogger; import com.facebook.react.bridge.NativeModuleLogger;
import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactMarker;
import com.facebook.react.bridge.ReadableNativeArray; import com.facebook.react.bridge.ReadableNativeArray;
import com.facebook.react.bridge.WritableNativeArray; import com.facebook.react.bridge.WritableNativeArray;
import com.facebook.react.bridge.WritableNativeMap; import com.facebook.react.bridge.WritableNativeMap;
import com.facebook.systrace.Systrace; import com.facebook.systrace.Systrace;
import com.facebook.systrace.SystraceMessage; import com.facebook.systrace.SystraceMessage;
import static com.facebook.react.bridge.ReactMarkerConstants.GET_CONSTANTS_END;
import static com.facebook.react.bridge.ReactMarkerConstants.GET_CONSTANTS_START;
import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE; import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
/** /**
@ -95,6 +98,7 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
// NativeMap out of OnLoad. // NativeMap out of OnLoad.
@DoNotStrip @DoNotStrip
public NativeArray getConstants() { public NativeArray getConstants() {
ReactMarker.logMarker(GET_CONSTANTS_START, getName());
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "Map constants") SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "Map constants")
.arg("moduleName", getName()) .arg("moduleName", getName())
.flush(); .flush();
@ -119,6 +123,7 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
if (baseJavaModule instanceof NativeModuleLogger) { if (baseJavaModule instanceof NativeModuleLogger) {
((NativeModuleLogger) baseJavaModule).endConstantsMapConversion(); ((NativeModuleLogger) baseJavaModule).endConstantsMapConversion();
} }
ReactMarker.logMarker(GET_CONSTANTS_END);
return array; return array;
} }