mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-30 14:02:44 +08:00
add more Systrace to native module / view manager constants
Reviewed By: lexs Differential Revision: D3739966 fbshipit-source-id: 4ba31aade00852132e528f96252197b823bb58a3
This commit is contained in:
committed by
Facebook Github Bot 9
parent
14188289fc
commit
924187eb9a
@@ -13,6 +13,10 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.systrace.Systrace;
|
||||
import com.facebook.systrace.SystraceMessage;
|
||||
|
||||
import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
|
||||
|
||||
/**
|
||||
* Helps generate constants map for {@link UIManagerModule} by collecting and merging constants from
|
||||
@@ -42,29 +46,36 @@ import com.facebook.react.common.MapBuilder;
|
||||
Map directEventTypesConstants = UIManagerModuleConstants.getDirectEventTypeConstants();
|
||||
|
||||
for (ViewManager viewManager : viewManagers) {
|
||||
Map viewManagerBubblingEvents = viewManager.getExportedCustomBubblingEventTypeConstants();
|
||||
if (viewManagerBubblingEvents != null) {
|
||||
recursiveMerge(bubblingEventTypesConstants, viewManagerBubblingEvents);
|
||||
}
|
||||
Map viewManagerDirectEvents = viewManager.getExportedCustomDirectEventTypeConstants();
|
||||
if (viewManagerDirectEvents != null) {
|
||||
recursiveMerge(directEventTypesConstants, viewManagerDirectEvents);
|
||||
}
|
||||
Map viewManagerConstants = MapBuilder.newHashMap();
|
||||
Map customViewConstants = viewManager.getExportedViewConstants();
|
||||
if (customViewConstants != null) {
|
||||
viewManagerConstants.put("Constants", customViewConstants);
|
||||
}
|
||||
Map viewManagerCommands = viewManager.getCommandsMap();
|
||||
if (viewManagerCommands != null) {
|
||||
viewManagerConstants.put("Commands", viewManagerCommands);
|
||||
}
|
||||
Map<String, String> viewManagerNativeProps = viewManager.getNativeProps();
|
||||
if (!viewManagerNativeProps.isEmpty()) {
|
||||
viewManagerConstants.put("NativeProps", viewManagerNativeProps);
|
||||
}
|
||||
if (!viewManagerConstants.isEmpty()) {
|
||||
constants.put(viewManager.getName(), viewManagerConstants);
|
||||
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "constants for ViewManager")
|
||||
.arg("ViewManager", viewManager.getName())
|
||||
.flush();
|
||||
try {
|
||||
Map viewManagerBubblingEvents = viewManager.getExportedCustomBubblingEventTypeConstants();
|
||||
if (viewManagerBubblingEvents != null) {
|
||||
recursiveMerge(bubblingEventTypesConstants, viewManagerBubblingEvents);
|
||||
}
|
||||
Map viewManagerDirectEvents = viewManager.getExportedCustomDirectEventTypeConstants();
|
||||
if (viewManagerDirectEvents != null) {
|
||||
recursiveMerge(directEventTypesConstants, viewManagerDirectEvents);
|
||||
}
|
||||
Map viewManagerConstants = MapBuilder.newHashMap();
|
||||
Map customViewConstants = viewManager.getExportedViewConstants();
|
||||
if (customViewConstants != null) {
|
||||
viewManagerConstants.put("Constants", customViewConstants);
|
||||
}
|
||||
Map viewManagerCommands = viewManager.getCommandsMap();
|
||||
if (viewManagerCommands != null) {
|
||||
viewManagerConstants.put("Commands", viewManagerCommands);
|
||||
}
|
||||
Map<String, String> viewManagerNativeProps = viewManager.getNativeProps();
|
||||
if (!viewManagerNativeProps.isEmpty()) {
|
||||
viewManagerConstants.put("NativeProps", viewManagerNativeProps);
|
||||
}
|
||||
if (!viewManagerConstants.isEmpty()) {
|
||||
constants.put(viewManager.getName(), viewManagerConstants);
|
||||
}
|
||||
} finally {
|
||||
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user