mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-08 09:12:05 +08:00
timer markings from JS JNI
Differential Revision: D2545138 fb-gh-sync-id: f93670ad929dbe37d641968e506108c6aac0cac2
This commit is contained in:
committed by
facebook-github-bot-7
parent
8ddd3e864e
commit
4ec5161685
@@ -84,6 +84,8 @@ public class NativeModuleRegistry {
|
||||
|
||||
/* package */ void notifyCatalystInstanceInitialized() {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
|
||||
ReactMarker.logMarker("NativeModule_start");
|
||||
Systrace.beginSection(
|
||||
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
|
||||
"NativeModuleRegistry_notifyCatalystInstanceInitialized");
|
||||
@@ -93,6 +95,7 @@ public class NativeModuleRegistry {
|
||||
}
|
||||
} finally {
|
||||
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
ReactMarker.logMarker("NativeModule_end");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
package com.facebook.react.bridge;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
/**
|
||||
* Static class that allows markers to be placed in React code and responded to in a
|
||||
* configurable way
|
||||
*/
|
||||
public class ReactMarker {
|
||||
|
||||
public interface MarkerListener {
|
||||
void logMarker(String name);
|
||||
};
|
||||
|
||||
@Nullable static private MarkerListener sMarkerListener = null;
|
||||
|
||||
static public void setMarkerListener(MarkerListener listener) {
|
||||
sMarkerListener = listener;
|
||||
}
|
||||
|
||||
@DoNotStrip
|
||||
static public void logMarker(String name) {
|
||||
if (sMarkerListener != null) {
|
||||
sMarkerListener.logMarker(name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user