You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 08bb95f
Browse filesBrowse the repository at this point in the historyBrowse files
Summary:
Implement Idle frame spans in Chrome DevTools, by emitting synthetic `NeedsBeginFrameChanged` + `BeginFrame` events.
**Definition**
An idle frame is emitted whenever the gap between two consecutive frames exceeds one vsync interval, derived from the display's refresh rate (`CADisplayLink.duration` on iOS, `Display.refreshRate` on Android, falling back to 60 Hz).
```
frame N gap > 1 vsync frame N+1
+------------+ +--------------------------------+ +------------+
| BeginFrame | | NeedsBeginFrameChanged | | BeginFrame |
| DrawFrame | | BeginFrame (no DrawFrame) | | DrawFrame |
+------------+ +--------------------------------+ +------------+
rendered as an "Idle frame"
```
**Implementation notes**
- Drop frames that begin before the recording start — Android `FrameMetrics` can deliver frames from app startup, and the first iOS `CADisplayLink` callback reports the previous vsync.
- Sort frames by begin timestamp before serializing, since async screenshot encoding can deliver them out of order and break gap detection.
- iOS: skip the frame event when the screenshot is unchanged, letting the gap render as an idle frame.
Changelog: [Internal]
Differential Revision: D97502569
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/inspector/FrameTimingSequence.kt
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -13,4 +13,5 @@ internal data class FrameTimingSequence(
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/inspector/FrameTimingsObserver.kt
+49-17Lines changed: 49 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -54,6 +54,7 @@ internal class FrameTimingsObserver(
54
54
valthreadId:Int,
55
55
valbeginTimestamp:Long,
56
56
valendTimestamp:Long,
57
+
valvsyncIntervalNanos:Long,
57
58
)
58
59
59
60
funstart() {
@@ -66,9 +67,11 @@ internal class FrameTimingsObserver(
66
67
lastFrameBuffer.set(null)
67
68
isTracing =true
68
69
69
-
// Emit initial frame event
70
+
// Emit an initial render frame. Keep it zero-duration: the frontend derives
71
+
// each frame's rendered length from the gap to the next frame, so a synthetic
72
+
// end time here can overlap the first real frame and corrupt the frames track.
0 commit comments