Add systrace to UIManagerModule.createConstants
Summary: - Differentiate when the constants are coming from lazy view managers or not - Add systrace sections to each reactpackage iteration for lazy view managers Differential Revision: D9664719 fbshipit-source-id: 3b8c6b3b40667a833471fcb957367501781b0f5d
This commit is contained in:
parent
1edeaef6ca
commit
cb6196073a
|
@ -792,6 +792,7 @@ public class ReactInstanceManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public @Nullable List<String> getViewManagerNames() {
|
public @Nullable List<String> getViewManagerNames() {
|
||||||
|
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "ReactInstanceManager.getViewManagerNames");
|
||||||
ReactApplicationContext context;
|
ReactApplicationContext context;
|
||||||
synchronized(mReactContextLock) {
|
synchronized(mReactContextLock) {
|
||||||
context = (ReactApplicationContext) getCurrentReactContext();
|
context = (ReactApplicationContext) getCurrentReactContext();
|
||||||
|
@ -803,15 +804,20 @@ public class ReactInstanceManager {
|
||||||
synchronized (mPackages) {
|
synchronized (mPackages) {
|
||||||
Set<String> uniqueNames = new HashSet<>();
|
Set<String> uniqueNames = new HashSet<>();
|
||||||
for (ReactPackage reactPackage : mPackages) {
|
for (ReactPackage reactPackage : mPackages) {
|
||||||
|
SystraceMessage.beginSection(
|
||||||
|
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "ReactInstanceManager.getViewManagerName")
|
||||||
|
.arg("Package", reactPackage.getClass().getSimpleName())
|
||||||
|
.flush();
|
||||||
if (reactPackage instanceof ViewManagerOnDemandReactPackage) {
|
if (reactPackage instanceof ViewManagerOnDemandReactPackage) {
|
||||||
List<String> names =
|
List<String> names =
|
||||||
((ViewManagerOnDemandReactPackage) reactPackage)
|
((ViewManagerOnDemandReactPackage) reactPackage).getViewManagerNames(context);
|
||||||
.getViewManagerNames(context);
|
|
||||||
if (names != null) {
|
if (names != null) {
|
||||||
uniqueNames.addAll(names);
|
uniqueNames.addAll(names);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||||
}
|
}
|
||||||
|
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||||
return new ArrayList<>(uniqueNames);
|
return new ArrayList<>(uniqueNames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,11 +212,14 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||||
|
|
||||||
private static Map<String, Object> createConstants(ViewManagerResolver viewManagerResolver) {
|
private static Map<String, Object> createConstants(ViewManagerResolver viewManagerResolver) {
|
||||||
ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_CONSTANTS_START);
|
ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_CONSTANTS_START);
|
||||||
Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "CreateUIManagerConstants");
|
SystraceMessage.beginSection(
|
||||||
|
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "CreateUIManagerConstants")
|
||||||
|
.arg("Lazy", true)
|
||||||
|
.flush();
|
||||||
try {
|
try {
|
||||||
return UIManagerModuleConstantsHelper.createConstants(viewManagerResolver);
|
return UIManagerModuleConstantsHelper.createConstants(viewManagerResolver);
|
||||||
} finally {
|
} finally {
|
||||||
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
SystraceMessage.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||||
ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_CONSTANTS_END);
|
ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_CONSTANTS_END);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,12 +229,15 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||||
@Nullable Map<String, Object> customBubblingEvents,
|
@Nullable Map<String, Object> customBubblingEvents,
|
||||||
@Nullable Map<String, Object> customDirectEvents) {
|
@Nullable Map<String, Object> customDirectEvents) {
|
||||||
ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_CONSTANTS_START);
|
ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_CONSTANTS_START);
|
||||||
Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "CreateUIManagerConstants");
|
SystraceMessage.beginSection(
|
||||||
|
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "CreateUIManagerConstants")
|
||||||
|
.arg("Lazy", false)
|
||||||
|
.flush();
|
||||||
try {
|
try {
|
||||||
return UIManagerModuleConstantsHelper.createConstants(
|
return UIManagerModuleConstantsHelper.createConstants(
|
||||||
viewManagers, customBubblingEvents, customDirectEvents);
|
viewManagers, customBubblingEvents, customDirectEvents);
|
||||||
} finally {
|
} finally {
|
||||||
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
SystraceMessage.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||||
ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_CONSTANTS_END);
|
ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_CONSTANTS_END);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ import javax.annotation.Nullable;
|
||||||
constants.put(viewManagerName, viewManagerConstants);
|
constants.put(viewManagerName, viewManagerConstants);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
|
SystraceMessage.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue