Java Code Examples for com.facebook.systrace.Systrace#startAsyncFlow()

The following examples show how to use com.facebook.systrace.Systrace#startAsyncFlow() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EventDispatcher.java    From react-native-GPay with MIT License 6 votes vote down vote up
/**
 * Sends the given Event to JS, coalescing eligible events if JS is backed up.
 */
public void dispatchEvent(Event event) {
  Assertions.assertCondition(event.isInitialized(), "Dispatched event hasn't been initialized");

  for (EventDispatcherListener listener : mListeners) {
    listener.onEventDispatch(event);
  }

  synchronized (mEventsStagingLock) {
    mEventStaging.add(event);
    Systrace.startAsyncFlow(
        Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
        event.getEventName(),
        event.getUniqueID());
  }
  if (mReactEventEmitter != null) {
    // If the host activity is paused, the frame callback may not be currently
    // posted. Ensure that it is so that this event gets delivered promptly.
    mCurrentFrameCallback.maybePostFromNonUI();
  } else {
    // No JS application has started yet, or resumed. This can happen when a ReactRootView is
    // added to view hierarchy, but ReactContext creation has not completed yet. In this case, any
    // touch event dispatch will hit this codepath, and we simply queue them so that they
    // are dispatched once ReactContext creation completes and JS app is running.
  }
}
 
Example 2
Source File: EventDispatcher.java    From react-native-GPay with MIT License 6 votes vote down vote up
@Override
public void doFrame(long frameTimeNanos) {
  UiThreadUtil.assertOnUiThread();

  if (mShouldStop) {
    mIsPosted = false;
  } else {
    post();
  }

  Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "ScheduleDispatchFrameCallback");
  try {
    moveStagedEventsToDispatchQueue();

    if (!mHasDispatchScheduled) {
      mHasDispatchScheduled = true;
      Systrace.startAsyncFlow(
          Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
          "ScheduleDispatchFrameCallback",
          mHasDispatchScheduledCount.get());
      mReactContext.runOnJSQueueThread(mDispatchEventsRunnable);
    }
  } finally {
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
  }
}
 
Example 3
Source File: UIViewOperationQueue.java    From react-native-GPay with MIT License 5 votes vote down vote up
public UpdateLayoutOperation(
    int parentTag,
    int tag,
    int x,
    int y,
    int width,
    int height) {
  super(tag);
  mParentTag = parentTag;
  mX = x;
  mY = y;
  mWidth = width;
  mHeight = height;
  Systrace.startAsyncFlow(Systrace.TRACE_TAG_REACT_VIEW, "updateLayout", mTag);
}
 
Example 4
Source File: UIViewOperationQueue.java    From react-native-GPay with MIT License 5 votes vote down vote up
public CreateViewOperation(
    ThemedReactContext themedContext,
    int tag,
    String className,
    @Nullable ReactStylesDiffMap initialProps) {
  super(tag);
  mThemedContext = themedContext;
  mClassName = className;
  mInitialProps = initialProps;
  Systrace.startAsyncFlow(Systrace.TRACE_TAG_REACT_VIEW, "createView", mTag);
}