Permalink
Browse files

add perf marker that fires first time content is added to root view

Reviewed By: javache

Differential Revision: D5582838

fbshipit-source-id: f90376ab11b4d44c002759829e4b2bbb4bbeeb56
  • Loading branch information...
bnham authored and facebook-github-bot committed Aug 8, 2017
1 parent cc4de7a commit d013ba39154ccd2af0a08019405411f8b27dc022
@@ -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.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.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 @@
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 @@ protected void onDetachedFromWindow() {
}
}
@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 @@
PRE_RUN_JS_BUNDLE_START,
ATTACH_MEASURED_ROOT_VIEWS_START,
ATTACH_MEASURED_ROOT_VIEWS_END,
CONTENT_APPEARED,
}

0 comments on commit d013ba3

Please sign in to comment.