public class DidJSUpdateUiDuringFrameDetector extends java.lang.Object implements NotThreadSafeBridgeIdleDebugListener, NotThreadSafeViewHierarchyUpdateDebugListener
ReactBridge
and a UIManagerModule
, getDidJSHitFrameAndCleanup(long, long)
should
be called once per frame via a ChoreographerCompat.FrameCallback
.Constructor and Description |
---|
DidJSUpdateUiDuringFrameDetector() |
Modifier and Type | Method and Description |
---|---|
boolean |
getDidJSHitFrameAndCleanup(long frameStartTimeNanos,
long frameEndTimeNanos)
Designed to be called from a
ChoreographerCompat.FrameCallback#doFrame call. |
void |
onBridgeDestroyed()
Called when the bridge is destroyed
|
void |
onTransitionToBridgeBusy()
Called when the bridge was in an idle state and executes a JS call or callback.
|
void |
onTransitionToBridgeIdle()
Called once all pending JS calls have resolved via an onBatchComplete call in the bridge and
the requested native module calls have also run.
|
void |
onViewHierarchyUpdateEnqueued()
Called when
UIManagerModule enqueues a UI batch to be dispatched to the main thread. |
void |
onViewHierarchyUpdateFinished()
Called from the main thread after a UI batch has been applied to all root views.
|
public void onTransitionToBridgeIdle()
NotThreadSafeBridgeIdleDebugListener
onTransitionToBridgeIdle
in interface NotThreadSafeBridgeIdleDebugListener
public void onTransitionToBridgeBusy()
NotThreadSafeBridgeIdleDebugListener
onTransitionToBridgeBusy
in interface NotThreadSafeBridgeIdleDebugListener
public void onBridgeDestroyed()
NotThreadSafeBridgeIdleDebugListener
onBridgeDestroyed
in interface NotThreadSafeBridgeIdleDebugListener
public void onViewHierarchyUpdateEnqueued()
NotThreadSafeViewHierarchyUpdateDebugListener
UIManagerModule
enqueues a UI batch to be dispatched to the main thread.onViewHierarchyUpdateEnqueued
in interface NotThreadSafeViewHierarchyUpdateDebugListener
public void onViewHierarchyUpdateFinished()
NotThreadSafeViewHierarchyUpdateDebugListener
onViewHierarchyUpdateFinished
in interface NotThreadSafeViewHierarchyUpdateDebugListener
public boolean getDidJSHitFrameAndCleanup(long frameStartTimeNanos, long frameEndTimeNanos)
ChoreographerCompat.FrameCallback#doFrame
call.
There are two 'success' cases that will cause getDidJSHitFrameAndCleanup(long, long)
to return
true for a given frame:
NB: This call can only be called once for a given frame time range because it cleans up events it recorded for that frame.
NB2: This makes the assumption that onViewHierarchyUpdateEnqueued is called from the UIManagerModule.onBatchComplete()
, e.g. while the bridge is still considered busy, which means
there is no race condition where the bridge has gone idle but a hierarchy update is waiting to
be enqueued.
frameStartTimeNanos
- the time in nanos that the last frame startedframeEndTimeNanos
- the time in nanos that the last frame ended