enable Systracing is JS before JSBundle finishes loading

Reviewed By: alexeylang

Differential Revision: D4671771

fbshipit-source-id: 5cd12bf84f25d4c3b188cf32907415b5a695b360
This commit is contained in:
Aaron Chiu 2017-03-08 03:18:50 -08:00 committed by Facebook Github Bot
parent a8474c25fd
commit 7978f7a27b
2 changed files with 13 additions and 6 deletions

View File

@ -53,15 +53,15 @@ import com.facebook.react.cxxbridge.JavaScriptExecutor;
import com.facebook.react.cxxbridge.NativeModuleRegistry;
import com.facebook.react.cxxbridge.ProxyJavaScriptExecutor;
import com.facebook.react.cxxbridge.UiThreadUtil;
import com.facebook.react.devsupport.interfaces.DevSupportManager;
import com.facebook.react.devsupport.interfaces.PackagerStatusCallback;
import com.facebook.react.devsupport.DevSupportManagerFactory;
import com.facebook.react.devsupport.ReactInstanceDevCommandsHandler;
import com.facebook.react.devsupport.RedBoxHandler;
import com.facebook.react.devsupport.interfaces.DevSupportManager;
import com.facebook.react.devsupport.interfaces.PackagerStatusCallback;
import com.facebook.react.modules.appregistry.AppRegistry;
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.facebook.react.modules.debug.interfaces.DeveloperSettings;
import com.facebook.react.modules.appregistry.AppRegistry;
import com.facebook.react.uimanager.DisplayMetricsHolder;
import com.facebook.react.uimanager.UIImplementationProvider;
import com.facebook.react.uimanager.UIManagerModule;
@ -82,7 +82,9 @@ import static com.facebook.react.bridge.ReactMarkerConstants.PROCESS_PACKAGES_EN
import static com.facebook.react.bridge.ReactMarkerConstants.PROCESS_PACKAGES_START;
import static com.facebook.react.bridge.ReactMarkerConstants.SETUP_REACT_CONTEXT_END;
import static com.facebook.react.bridge.ReactMarkerConstants.SETUP_REACT_CONTEXT_START;
import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_APPS;
import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JSC_CALLS;
/**
* This class is managing instances of {@link CatalystInstance}. It exposes a way to configure
@ -931,6 +933,9 @@ public class ReactInstanceManager {
if (mBridgeIdleDebugListener != null) {
catalystInstance.addBridgeIdleDebugListener(mBridgeIdleDebugListener);
}
if (Systrace.isTracing(TRACE_TAG_REACT_APPS | TRACE_TAG_REACT_JSC_CALLS)) {
catalystInstance.setGlobalVariable("__RCTProfileIsProfiling", "true");
}
reactContext.initializeWithInstance(catalystInstance);
catalystInstance.runJSBundle();

View File

@ -19,9 +19,11 @@ import android.os.Trace;
public class Systrace {
public static final long TRACE_TAG_REACT_JAVA_BRIDGE = 0L;
public static final long TRACE_TAG_REACT_APPS = 0L;
public static final long TRACE_TAG_REACT_FRESCO = 0L;
public static final long TRACE_TAG_REACT_APPS = 0L;
public static final long TRACE_TAG_REACT_VIEW = 0L;
public static final long TRACE_TAG_REACT_JSC_CALLS = 0L;
public enum EventScope {
THREAD('t'),
@ -88,18 +90,18 @@ public class Systrace {
public static void startAsyncFlow(
long tag,
final String sectionName,
final int cookie){
final int cookie) {
}
public static void stepAsyncFlow(
long tag,
final String sectionName,
final int cookie){
final int cookie) {
}
public static void endAsyncFlow(
long tag,
final String sectionName,
final int cookie){
final int cookie) {
}
}