Use the c.f.react.bridge.ReactMarker
Reviewed By: andreicoman11 Differential Revision: D3834955 fbshipit-source-id: 027150d3829e8a15f28ea76877e4ab5a29ea50cf
This commit is contained in:
parent
29febb9b1e
commit
e70d1dba58
|
@ -21,4 +21,6 @@ public class ReactMarkerConstants {
|
|||
public static final String CREATE_CATALYST_INSTANCE_END = "CREATE_CATALYST_INSTANCE_END";
|
||||
public static final String RUN_JS_BUNDLE_START = "RUN_JS_BUNDLE_START";
|
||||
public static final String RUN_JS_BUNDLE_END = "RUN_JS_BUNDLE_END";
|
||||
public static final String NATIVE_MODULE_INITIALIZE_START = "NativeModule_start";
|
||||
public static final String NATIVE_MODULE_INITIALIZE_END = "NativeModule_end";
|
||||
}
|
||||
|
|
|
@ -9,25 +9,18 @@
|
|||
|
||||
package com.facebook.react.cxxbridge;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.BaseJavaModule;
|
||||
import com.facebook.react.bridge.CatalystInstance;
|
||||
import com.facebook.react.bridge.NativeModule;
|
||||
import com.facebook.react.bridge.OnBatchCompleteListener;
|
||||
import com.facebook.react.bridge.ReadableNativeArray;
|
||||
import com.facebook.react.bridge.ReactMarker;
|
||||
import com.facebook.react.bridge.ReactMarkerConstants;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.common.SetBuilder;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.systrace.Systrace;
|
||||
|
||||
/**
|
||||
|
@ -80,7 +73,7 @@ public class NativeModuleRegistry {
|
|||
/* package */ void notifyCatalystInstanceInitialized() {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
|
||||
ReactMarker.logMarker("NativeModule_start");
|
||||
ReactMarker.logMarker(ReactMarkerConstants.NATIVE_MODULE_INITIALIZE_START);
|
||||
Systrace.beginSection(
|
||||
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
|
||||
"NativeModuleRegistry_notifyCatalystInstanceInitialized");
|
||||
|
@ -90,7 +83,7 @@ public class NativeModuleRegistry {
|
|||
}
|
||||
} finally {
|
||||
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
ReactMarker.logMarker("NativeModule_end");
|
||||
ReactMarker.logMarker(ReactMarkerConstants.NATIVE_MODULE_INITIALIZE_END);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,7 +123,7 @@ public class NativeModuleRegistry {
|
|||
public NativeModuleRegistry build() {
|
||||
Map<Class<NativeModule>, NativeModule> moduleInstances = new HashMap<>();
|
||||
for (NativeModule module : mModules.values()) {
|
||||
moduleInstances.put((Class<NativeModule>)module.getClass(), module);
|
||||
moduleInstances.put((Class<NativeModule>) module.getClass(), module);
|
||||
}
|
||||
return new NativeModuleRegistry(moduleInstances);
|
||||
}
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
package com.facebook.react.cxxbridge;
|
||||
|
||||
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
|
||||
*/
|
||||
@DoNotStrip
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue