mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 09:45:04 +00:00
measure conversion of Java Map to WritableNativeMap for each NativeModule
Reviewed By: fkgozali Differential Revision: D4688690 fbshipit-source-id: 871b3f5ab141d7f63ec15b06e44a2c398603d757
This commit is contained in:
parent
02a6621e23
commit
70e4a58d5b
@ -1,12 +0,0 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
package com.facebook.react.bridge;
|
||||
|
||||
/**
|
||||
* Interface on native modules for the bridge to call for TTI start and end markers.
|
||||
*/
|
||||
public interface NativeModuleLogger {
|
||||
|
||||
void startConstantsMapConversion();
|
||||
void endConstantsMapConversion();
|
||||
}
|
@ -66,4 +66,6 @@ public class ReactMarkerConstants {
|
||||
public static final String ON_HOST_RESUME_END = "ON_HOST_RESUME_END";
|
||||
public static final String ON_HOST_PAUSE_START = "ON_HOST_PAUSE_START";
|
||||
public static final String ON_HOST_PAUSE_END = "ON_HOST_PAUSE_END";
|
||||
public static final String CONVERT_CONSTANTS_START = "CONVERT_CONSTANTS_START";
|
||||
public static final String CONVERT_CONSTANTS_END = "CONVERT_CONSTANTS_END";
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ import com.facebook.react.bridge.BaseJavaModule;
|
||||
import com.facebook.react.bridge.CatalystInstance;
|
||||
import com.facebook.react.bridge.ExecutorToken;
|
||||
import com.facebook.react.bridge.NativeArray;
|
||||
import com.facebook.react.bridge.NativeModuleLogger;
|
||||
import com.facebook.react.bridge.NativeModule;
|
||||
import com.facebook.react.bridge.ReactMarker;
|
||||
import com.facebook.react.bridge.ReadableNativeArray;
|
||||
@ -28,6 +27,8 @@ import com.facebook.react.bridge.WritableNativeMap;
|
||||
import com.facebook.systrace.Systrace;
|
||||
import com.facebook.systrace.SystraceMessage;
|
||||
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.CONVERT_CONSTANTS_END;
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.CONVERT_CONSTANTS_START;
|
||||
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;
|
||||
@ -109,9 +110,7 @@ public class JavaModuleWrapper {
|
||||
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "WritableNativeMap constants")
|
||||
.arg("moduleName", getName())
|
||||
.flush();
|
||||
if (baseJavaModule instanceof NativeModuleLogger) {
|
||||
((NativeModuleLogger) baseJavaModule).startConstantsMapConversion();
|
||||
}
|
||||
ReactMarker.logMarker(CONVERT_CONSTANTS_START, getName());
|
||||
WritableNativeMap writableNativeMap;
|
||||
try {
|
||||
writableNativeMap = Arguments.makeNativeMap(map);
|
||||
@ -120,9 +119,7 @@ public class JavaModuleWrapper {
|
||||
}
|
||||
WritableNativeArray array = new WritableNativeArray();
|
||||
array.pushMap(writableNativeMap);
|
||||
if (baseJavaModule instanceof NativeModuleLogger) {
|
||||
((NativeModuleLogger) baseJavaModule).endConstantsMapConversion();
|
||||
}
|
||||
ReactMarker.logMarker(CONVERT_CONSTANTS_END);
|
||||
ReactMarker.logMarker(GET_CONSTANTS_END);
|
||||
return array;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -23,7 +23,6 @@ import com.facebook.react.animation.Animation;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import com.facebook.react.bridge.GuardedRunnable;
|
||||
import com.facebook.react.bridge.LifecycleEventListener;
|
||||
import com.facebook.react.bridge.NativeModuleLogger;
|
||||
import com.facebook.react.bridge.OnBatchCompleteListener;
|
||||
import com.facebook.react.bridge.PerformanceCounter;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
@ -43,8 +42,6 @@ import com.facebook.systrace.SystraceMessage;
|
||||
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_CONSTANTS_END;
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_CONSTANTS_START;
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.UI_MANAGER_MODULE_CONSTANTS_CONVERT_END;
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.UI_MANAGER_MODULE_CONSTANTS_CONVERT_START;
|
||||
|
||||
/**
|
||||
* <p>Native module to allow JS to create and update native Views.</p>
|
||||
@ -77,7 +74,7 @@ import static com.facebook.react.bridge.ReactMarkerConstants.UI_MANAGER_MODULE_C
|
||||
*/
|
||||
@ReactModule(name = UIManagerModule.NAME)
|
||||
public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
OnBatchCompleteListener, LifecycleEventListener, PerformanceCounter, NativeModuleLogger {
|
||||
OnBatchCompleteListener, LifecycleEventListener, PerformanceCounter {
|
||||
|
||||
protected static final String NAME = "UIManager";
|
||||
|
||||
@ -596,16 +593,6 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
return mUIImplementation.resolveRootTagFromReactTag(reactTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startConstantsMapConversion() {
|
||||
ReactMarker.logMarker(UI_MANAGER_MODULE_CONSTANTS_CONVERT_START);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endConstantsMapConversion() {
|
||||
ReactMarker.logMarker(UI_MANAGER_MODULE_CONSTANTS_CONVERT_END);
|
||||
}
|
||||
|
||||
/**
|
||||
* Listener that drops the CSSNode pool on low memory when the app is backgrounded.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user