add perf marker that fires first time content is added to root view
Reviewed By: javache Differential Revision: D5582838 fbshipit-source-id: f90376ab11b4d44c002759829e4b2bbb4bbeeb56
This commit is contained in:
parent
cc4de7abc4
commit
d013ba3915
|
@ -9,7 +9,7 @@
|
|||
|
||||
package com.facebook.react;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
|
@ -23,12 +23,13 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.CatalystInstance;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactMarker;
|
||||
import com.facebook.react.bridge.ReactMarkerConstants;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.WritableNativeMap;
|
||||
|
@ -45,8 +46,7 @@ import com.facebook.react.uimanager.SizeMonitoringFrameLayout;
|
|||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.systrace.Systrace;
|
||||
|
||||
import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Default root view for catalyst apps. Provides the ability to listen for size changes so that a UI
|
||||
|
@ -81,6 +81,7 @@ public class ReactRootView extends SizeMonitoringFrameLayout implements RootView
|
|||
private @Nullable ReactRootViewEventListener mRootViewEventListener;
|
||||
private int mRootViewTag;
|
||||
private boolean mIsAttachedToInstance;
|
||||
private boolean mContentAppeared;
|
||||
private final JSTouchDispatcher mJSTouchDispatcher = new JSTouchDispatcher(this);
|
||||
|
||||
public ReactRootView(Context context) {
|
||||
|
@ -190,6 +191,24 @@ public class ReactRootView extends SizeMonitoringFrameLayout implements RootView
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAdded(View child) {
|
||||
super.onViewAdded(child);
|
||||
|
||||
if (!mContentAppeared) {
|
||||
mContentAppeared = true;
|
||||
ReactMarker.logMarker(
|
||||
ReactMarkerConstants.CONTENT_APPEARED, getJSModuleName(), getRootViewTag());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAllViewsInLayout() {
|
||||
super.removeAllViewsInLayout();
|
||||
|
||||
mContentAppeared = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@see #startReactApplication(ReactInstanceManager, String, android.os.Bundle)}
|
||||
*/
|
||||
|
|
|
@ -66,4 +66,5 @@ public enum ReactMarkerConstants {
|
|||
PRE_RUN_JS_BUNDLE_START,
|
||||
ATTACH_MEASURED_ROOT_VIEWS_START,
|
||||
ATTACH_MEASURED_ROOT_VIEWS_END,
|
||||
CONTENT_APPEARED,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue