Package 

Class DidJSUpdateUiDuringFrameDetector

    • Method Summary

      Modifier and Type Method Description
      synchronized void onTransitionToBridgeIdle() Called once all pending JS calls have resolved via an onBatchComplete call in the bridge andthe requested native module calls have also run.
      synchronized void onTransitionToBridgeBusy() Called when the bridge was in an idle state and executes a JS call or callback.
      synchronized void onBridgeDestroyed() Called when the bridge is destroyed
      synchronized void onViewHierarchyUpdateEnqueued() Called when UIManagerModule enqueues a UI batch to be dispatched to the main thread.
      synchronized void onViewHierarchyUpdateFinished() Called from the main thread after a UI batch has been applied to all root views.
      synchronized boolean getDidJSHitFrameAndCleanup(long frameStartTimeNanos, long frameEndTimeNanos) Designed to be called from a doFrame call.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • onTransitionToBridgeIdle

         synchronized void onTransitionToBridgeIdle()

        Called once all pending JS calls have resolved via an onBatchComplete call in the bridge andthe requested native module calls have also run. The bridge will not become busy again until atimer, touch event, etc. causes a Java->JS call to be enqueued again.

      • onTransitionToBridgeBusy

         synchronized void onTransitionToBridgeBusy()

        Called when the bridge was in an idle state and executes a JS call or callback.

      • onBridgeDestroyed

         synchronized void onBridgeDestroyed()

        Called when the bridge is destroyed

      • onViewHierarchyUpdateFinished

         synchronized void onViewHierarchyUpdateFinished()

        Called from the main thread after a UI batch has been applied to all root views.

      • getDidJSHitFrameAndCleanup

         synchronized boolean getDidJSHitFrameAndCleanup(long frameStartTimeNanos, long frameEndTimeNanos)

        Designed to be called from a doFrame call.

        There are two 'success' cases that will cause getDidJSHitFrameAndCleanup to returntrue for a given frame:

        • UIManagerModule finished dispatching a batched UI update on the UI thread during theframe. This means that during the next hierarchy traversal, new UI will be drawn ifneeded (good).
        • The bridge ended the frame idle (meaning there were no JS nor native module calls stillin flight) AND there was no UiManagerModule update enqueued that didn't also finish. NB:if there was one enqueued that actually finished, we'd have case 1), so effectively wejust look for whether one was enqueued.

        NB: This call can only be called once for a given frame time range because it cleans upevents it recorded for that frame.

        NB2: This makes the assumption that onViewHierarchyUpdateEnqueued is called from the , e.g. while the bridge is still considered busy, which meansthere is no race condition where the bridge has gone idle but a hierarchy update is waiting tobe enqueued.

        Parameters:
        frameStartTimeNanos - the time in nanos that the last frame started
        frameEndTimeNanos - the time in nanos that the last frame ended