fix overriding RN Perf markers

Reviewed By: fkgozali

Differential Revision: D4513000

fbshipit-source-id: c7c24d3c4851f5719d998b4f08c338a73f47875f
This commit is contained in:
Aaron Chiu 2017-02-09 20:23:51 -08:00 committed by Facebook Github Bot
parent 5a0012efd3
commit 9d7f2498f6
1 changed files with 6 additions and 3 deletions

View File

@ -3,6 +3,7 @@
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
@ -17,15 +18,17 @@ public class ReactMarker {
@Nullable static private MarkerListener sMarkerListener = null;
static public void setMarkerListener(MarkerListener listener) {
public static void setMarkerListener(MarkerListener listener) {
SoftAssertions.assertCondition(
sMarkerListener == null,
"MarkerListener is being overwritten.");
sMarkerListener = listener;
}
@DoNotStrip
static public void logMarker(String name) {
public static void logMarker(String name) {
if (sMarkerListener != null) {
sMarkerListener.logMarker(name);
}
}
}