Skip to content

Commit f71acdf

Browse files
authored
Merge pull request #17 from PerfLab-io/fix-animation-frames-entries-pairings
Fix animation frames entries pairings
2 parents 8094f4d + e11b329 commit f71acdf

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

front_end/models/trace/handlers/AnimationHandler.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ export function handleEvent(event: Types.Events.Event): void {
5252
// INFO: Hack to correctly pair AnimationFrame nestable groupings. Since the current
5353
// local id is not correctly set.
5454
const isStartEvent = event.ph === Types.Events.Phase.ASYNC_NESTABLE_START;
55+
const isEndEvent = event.ph === Types.Events.Phase.ASYNC_NESTABLE_END;
56+
const isInstant = event.ph === Types.Events.Phase.ASYNC_NESTABLE_INSTANT;
5557

5658
if (isStartEvent && event.name === Types.Events.Name.AnimationFrame) {
5759
currentGroupingEventSulfix = `${event.ts}`;
@@ -70,7 +72,8 @@ export function handleEvent(event: Types.Events.Event): void {
7072
// INFO: Hack to correctly pair AnimationFrame nestable groupings. Since the current
7173
// Has to be unique for each event but correclty match the begining and end events to form
7274
// the pairs.
73-
const currentBeginEventSulfix = !isStartEvent ? eventSulfixes.pop() : eventSulfixes.at(-1);
75+
let currentBeginEventSulfix = isEndEvent ? eventSulfixes.pop() : eventSulfixes.at(-1);
76+
currentBeginEventSulfix = isInstant ? `${event.ts}` : currentBeginEventSulfix;
7477
event.id2 = { local: `${event.id2?.local}-${currentGroupingEventSulfix}-${currentBeginEventSulfix}` };
7578
}
7679

front_end/models/trace/types/TraceEvents.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ export interface TraceEventAnimationFrameScriptGroupingEvent extends Event {
591591
['style_duration_ms']?: number,
592592
},
593593
};
594-
name: Name.AnimationFrameScriptExecute;
594+
name: Name.AnimationFrameScriptExecute | Name.AnimationFrameScriptCompile;
595595
id2?: {
596596
local?: string,
597597
};
@@ -1980,7 +1980,7 @@ export function isTraceEventAnimationFrame(traceEventData: Event): traceEventDat
19801980
}
19811981

19821982
export function isTraceEventAnimationFrameScript(traceEventData: Event): traceEventData is TraceEventAnimationFrameScriptGroupingEvent {
1983-
return traceEventData.name === Name.AnimationFrameScriptExecute;
1983+
return traceEventData.name === Name.AnimationFrameScriptCompile || traceEventData.name === Name.AnimationFrameScriptExecute;
19841984
}
19851985

19861986
export function isTraceEventAnimationFramePaint(traceEventData: Event): traceEventData is TraceEventAnimationFramePaintGroupingEvent {
@@ -2794,6 +2794,7 @@ export const enum Name {
27942794
AnimationFrameFirstUIEvent = 'AnimationFrame::FirstUIEvent',
27952795
AnimationFrameStyleAndLayout = 'AnimationFrame::StyleAndLayout',
27962796
AnimationFrameRender = 'AnimationFrame::Render',
2797+
AnimationFrameScriptCompile = 'AnimationFrame::Script::Compile',
27972798
AnimationFrameScriptExecute = 'AnimationFrame::Script::Execute',
27982799

27992800
/* Network request events */

0 commit comments

Comments
 (0)