Skip to content

Commit a136d17

Browse files
authored
core(tracehouse): fixup parent tasks when fudging endTime (#16420)
1 parent a09a5a2 commit a136d17

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

core/lib/tracehouse/main-thread-tasks.js

+8
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,14 @@ class MainThreadTasks {
267267
// It's less than 1ms, we'll let it slide by increasing the duration of the parent.
268268
currentTask.endTime = nextTask.endTime;
269269
currentTask.duration += timeDelta;
270+
271+
// Recursively extend parent endTimes, as needed.
272+
let cur = currentTask.parent;
273+
while (cur && cur.endTime < nextTask.endTime) {
274+
cur.duration += nextTask.endTime - cur.endTime;
275+
cur.endTime = nextTask.endTime;
276+
cur = cur.parent;
277+
}
270278
} else if (nextTask.unbounded) {
271279
// It's ending at traceEndTs, it means we were missing the end event. We'll truncate it to the parent.
272280
nextTask.endTime = currentTask.endTime;

0 commit comments

Comments
 (0)