@paulirish/trace_engine 0.0.46 → 0.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.tmp/tsbuildinfo/models/trace/extras/polyfills.d.ts +4 -0
- package/.tmp/tsbuildinfo/models/trace/extras/polyfills.d.ts.map +1 -0
- package/.tmp/tsbuildinfo/tsconfig.tsbuildinfo +1 -1
- package/core/platform/Constructor.d.ts +3 -0
- package/core/platform/Constructor.js +5 -0
- package/core/platform/Constructor.js.map +1 -0
- package/core/platform/MapUtilities.js +1 -0
- package/core/platform/MapUtilities.js.map +1 -1
- package/core/platform/MimeType.js +3 -0
- package/core/platform/MimeType.js.map +1 -1
- package/core/platform/TypescriptUtilities.d.ts +7 -0
- package/core/platform/TypescriptUtilities.js.map +1 -1
- package/core/platform/platform-tsconfig.json +1 -0
- package/core/platform/platform.d.ts +2 -1
- package/core/platform/platform.js +2 -1
- package/core/platform/platform.js.map +1 -1
- package/generated/protocol.d.ts +220 -4
- package/locales/en-US.json +10 -10
- package/locales/en-XL.json +10 -10
- package/models/trace/Processor.d.ts +4 -1
- package/models/trace/Processor.js +45 -24
- package/models/trace/Processor.js.map +1 -1
- package/models/trace/extras/ScriptDuplication.d.ts +1 -1
- package/models/trace/extras/ScriptDuplication.js +2 -2
- package/models/trace/extras/ScriptDuplication.js.map +1 -1
- package/models/trace/extras/extras.d.ts +3798 -0
- package/models/trace/extras/extras.js +3798 -0
- package/models/trace/handlers/LargestImagePaintHandler.d.ts +1 -1
- package/models/trace/handlers/LargestImagePaintHandler.js +3 -3
- package/models/trace/handlers/LargestImagePaintHandler.js.map +1 -1
- package/models/trace/handlers/LayoutShiftsHandler.d.ts +7 -1
- package/models/trace/handlers/LayoutShiftsHandler.js +16 -5
- package/models/trace/handlers/LayoutShiftsHandler.js.map +1 -1
- package/models/trace/handlers/MetaHandler.js +7 -1
- package/models/trace/handlers/MetaHandler.js.map +1 -1
- package/models/trace/handlers/PageLoadMetricsHandler.d.ts +5 -0
- package/models/trace/handlers/PageLoadMetricsHandler.js +3 -0
- package/models/trace/handlers/PageLoadMetricsHandler.js.map +1 -1
- package/models/trace/handlers/ScriptsHandler.d.ts +5 -1
- package/models/trace/handlers/ScriptsHandler.js +24 -11
- package/models/trace/handlers/ScriptsHandler.js.map +1 -1
- package/models/trace/handlers/types.d.ts +1 -1
- package/models/trace/handlers/types.js.map +1 -1
- package/models/trace/insights/CLSCulprits.d.ts +5 -5
- package/models/trace/insights/CLSCulprits.js +0 -3
- package/models/trace/insights/CLSCulprits.js.map +1 -1
- package/models/trace/insights/DOMSize.d.ts +3 -3
- package/models/trace/insights/DOMSize.js +1 -4
- package/models/trace/insights/DOMSize.js.map +1 -1
- package/models/trace/insights/DocumentLatency.d.ts +3 -3
- package/models/trace/insights/DocumentLatency.js +1 -4
- package/models/trace/insights/DocumentLatency.js.map +1 -1
- package/models/trace/insights/DuplicateJavaScript.d.ts +3 -3
- package/models/trace/insights/DuplicateJavaScript.js +5 -8
- package/models/trace/insights/DuplicateJavaScript.js.map +1 -1
- package/models/trace/insights/FontDisplay.d.ts +12 -9
- package/models/trace/insights/FontDisplay.js +15 -15
- package/models/trace/insights/FontDisplay.js.map +1 -1
- package/models/trace/insights/ForcedReflow.d.ts +3 -3
- package/models/trace/insights/ForcedReflow.js +1 -4
- package/models/trace/insights/ForcedReflow.js.map +1 -1
- package/models/trace/insights/ImageDelivery.d.ts +7 -6
- package/models/trace/insights/ImageDelivery.js +26 -20
- package/models/trace/insights/ImageDelivery.js.map +1 -1
- package/models/trace/insights/InteractionToNextPaint.d.ts +3 -3
- package/models/trace/insights/InteractionToNextPaint.js +0 -3
- package/models/trace/insights/InteractionToNextPaint.js.map +1 -1
- package/models/trace/insights/LCPDiscovery.d.ts +4 -3
- package/models/trace/insights/LCPDiscovery.js +4 -4
- package/models/trace/insights/LCPDiscovery.js.map +1 -1
- package/models/trace/insights/LCPPhases.d.ts +4 -4
- package/models/trace/insights/LCPPhases.js +1 -4
- package/models/trace/insights/LCPPhases.js.map +1 -1
- package/models/trace/insights/NetworkDependencyTree.d.ts +9 -3
- package/models/trace/insights/NetworkDependencyTree.js +39 -10
- package/models/trace/insights/NetworkDependencyTree.js.map +1 -1
- package/models/trace/insights/RenderBlocking.d.ts +4 -3
- package/models/trace/insights/RenderBlocking.js +4 -4
- package/models/trace/insights/RenderBlocking.js.map +1 -1
- package/models/trace/insights/SlowCSSSelector.d.ts +3 -3
- package/models/trace/insights/SlowCSSSelector.js +0 -3
- package/models/trace/insights/SlowCSSSelector.js.map +1 -1
- package/models/trace/insights/ThirdParties.d.ts +3 -3
- package/models/trace/insights/ThirdParties.js +1 -4
- package/models/trace/insights/ThirdParties.js.map +1 -1
- package/models/trace/insights/Viewport.d.ts +3 -3
- package/models/trace/insights/Viewport.js +11 -9
- package/models/trace/insights/Viewport.js.map +1 -1
- package/models/trace/insights/types.d.ts +6 -10
- package/models/trace/insights/types.js.map +1 -1
- package/models/trace/lantern/types/types-tsconfig.json +1 -1
- package/models/trace/types/Configuration.d.ts +6 -0
- package/models/trace/types/Configuration.js.map +1 -1
- package/models/trace/types/File.d.ts +8 -0
- package/models/trace/types/File.js.map +1 -1
- package/models/trace/types/TraceEvents.d.ts +16 -1
- package/models/trace/types/TraceEvents.js +3 -0
- package/models/trace/types/TraceEvents.js.map +1 -1
- package/models/trace/types/types-tsconfig.json +3 -0
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ export declare function reset(): void;
|
|
|
4
4
|
export declare function handleEvent(event: Types.Events.Event): void;
|
|
5
5
|
export declare function finalize(): Promise<void>;
|
|
6
6
|
export interface LargestImagePaintData {
|
|
7
|
-
|
|
7
|
+
lcpRequestByNavigationId: Map<string, Types.Events.SyntheticNetworkRequest>;
|
|
8
8
|
}
|
|
9
9
|
export declare function data(): LargestImagePaintData;
|
|
10
10
|
export declare function deps(): HandlerName[];
|
|
@@ -26,7 +26,7 @@ import { data as pageLoadMetricsData } from './PageLoadMetricsHandler.js';
|
|
|
26
26
|
* also keyed on `ProcessId`.
|
|
27
27
|
**/
|
|
28
28
|
const imagePaintsByNodeIdAndProcess = new Map();
|
|
29
|
-
const
|
|
29
|
+
const lcpRequestByNavigationId = new Map();
|
|
30
30
|
export function reset() {
|
|
31
31
|
imagePaintsByNodeIdAndProcess.clear();
|
|
32
32
|
}
|
|
@@ -72,12 +72,12 @@ export async function finalize() {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
if (lcpRequest) {
|
|
75
|
-
|
|
75
|
+
lcpRequestByNavigationId.set(navigationId, lcpRequest);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
export function data() {
|
|
80
|
-
return {
|
|
80
|
+
return { lcpRequestByNavigationId };
|
|
81
81
|
}
|
|
82
82
|
export function deps() {
|
|
83
83
|
return ['Meta', 'NetworkRequests', 'PageLoadMetrics'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LargestImagePaintHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/LargestImagePaintHandler.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAE/D,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,IAAI,IAAI,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAC,IAAI,IAAI,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAC,IAAI,IAAI,mBAAmB,EAAa,MAAM,6BAA6B,CAAC;AAGpF;;;;;;;;;;;;;;;;;;IAkBI;AACJ,MAAM,6BAA6B,GAC/B,IAAI,GAAG,EAAoG,CAAC;AAChH,MAAM,
|
|
1
|
+
{"version":3,"file":"LargestImagePaintHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/LargestImagePaintHandler.ts"],"names":[],"m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S,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,MAAM,CAAC,EAAE,CAAC;gBAChG,UAAU,GAAG,OAAO,CAAC;gBACrB,MAAM;YACR,CAAC;QACH,CAAC;QAED,IAAI,UAAU,EAAE,CAAC;YACf,wBAAwB,CAAC,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;AACH,CAAC;AAMD,MAAM,UAAU,IAAI;IAClB,OAAO,EAAC,wBAAwB,EAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;AACxD,CAAC","sourcesContent":["// Copyright 2022 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Platform from '../../../core/platform/platform.js';\nimport type * as Protocol from '../../../generated/protocol.js';\nimport * as Types from '../types/types.js';\n\nimport {data as metaData} from './MetaHandler.js';\nimport {data as networkRequestsData} from './NetworkRequestsHandler.js';\nimport {data as pageLoadMetricsData, MetricName} from './PageLoadMetricsHandler.js';\nimport type {HandlerName} from './types.js';\n\n/**\n * If the LCP resource was an image, and that image was fetched over the\n * network, we want to be able to find the network request in order to construct\n * the critical path for an LCP image.\n * Within the trace file there are `LargestImagePaint::Candidate` events.\n * Within their data object, they contain a `DOMNodeId` property, which maps to\n * the DOM Node ID for that image.\n *\n * This id maps exactly to the `data.nodeId` property that a\n * `LargestContentfulPaint::Candidate` will have. So, when we find an image\n * paint candidate, we can store it, keying it on the node ID.\n * Then, when it comes to finding the network request for an LCP image, we can\n * use the nodeId from the LCP candidate to find the image candidate. That image\n * candidate also contains a `imageUrl` property, which will have the full URL\n * to the image.\n *\n * `BackendNodeId`s are only unique within a given renderer process, so this is\n * also keyed on `ProcessId`.\n **/\nconst imagePaintsByNodeIdAndProcess =\n new Map<Types.Events.ProcessID, Map<Protocol.DOM.BackendNodeId, Types.Events.LargestImagePaintCandidate>>();\nconst lcpRequestByNavigationId = new Map<string, Types.Events.SyntheticNetworkRequest>();\n\nexport function reset(): void {\n imagePaintsByNodeIdAndProcess.clear();\n}\n\nexport function handleEvent(event: Types.Events.Event): void {\n if (!Types.Events.isLargestImagePaintCandidate(event) || !event.args.data) {\n return;\n }\n\n const imagePaintsByNodeId =\n Platform.MapUtilities.getWithDefault(imagePaintsByNodeIdAndProcess, event.pid, () => new Map());\n imagePaintsByNodeId.set(event.args.data.DOMNodeId, event);\n}\n\nexport async function finalize(): Promise<void> {\n const requests = networkRequestsData().byTime;\n const {traceBounds, navigationsByNavigationId} = metaData();\n const metricScoresByFrameId = pageLoadMetricsData().metricScoresByFrameId;\n\n for (const [navigationId, navigation] of navigationsByNavigationId) {\n const lcpMetric = metricScoresByFrameId.get(navigation.args.frame)?.get(navigationId)?.get(MetricName.LCP);\n const lcpEvent = lcpMetric?.event;\n if (!lcpEvent || !Types.Events.isLargestContentfulPaintCandidate(lcpEvent)) {\n continue;\n }\n\n const nodeId = lcpEvent.args.data?.nodeId;\n if (!nodeId) {\n continue;\n }\n\n const lcpImagePaintEvent = imagePaintsByNodeIdAndProcess.get(lcpEvent.pid)?.get(nodeId);\n const lcpUrl = lcpImagePaintEvent?.args.data?.imageUrl;\n if (!lcpUrl) {\n continue;\n }\n\n const startTime = navigation?.ts ?? traceBounds.min;\n const endTime = lcpImagePaintEvent.ts;\n\n let lcpRequest;\n for (const request of requests) {\n if (request.ts < startTime) {\n continue;\n }\n if (request.ts >= endTime) {\n break;\n }\n\n if (request.args.data.url === lcpUrl || request.args.data.redirects.some(r => r.url === lcpUrl)) {\n lcpRequest = request;\n break;\n }\n }\n\n if (lcpRequest) {\n lcpRequestByNavigationId.set(navigationId, lcpRequest);\n }\n }\n}\n\nexport interface LargestImagePaintData {\n lcpRequestByNavigationId: Map<string, Types.Events.SyntheticNetworkRequest>;\n}\n\nexport function data(): LargestImagePaintData {\n return {lcpRequestByNavigationId};\n}\n\nexport function deps(): HandlerName[] {\n return ['Meta', 'NetworkRequests', 'PageLoadMetrics'];\n}\n"]}
|
|
@@ -15,10 +15,16 @@ interface LayoutShifts {
|
|
|
15
15
|
renderFrameImplCreateChildFrameEvents: readonly Types.Events.RenderFrameImplCreateChildFrame[];
|
|
16
16
|
domLoadingEvents: readonly Types.Events.DomLoading[];
|
|
17
17
|
layoutImageUnsizedEvents: readonly Types.Events.LayoutImageUnsized[];
|
|
18
|
-
|
|
18
|
+
remoteFonts: readonly RemoteFont[];
|
|
19
19
|
scoreRecords: readonly ScoreRecord[];
|
|
20
20
|
backendNodeIds: Protocol.DOM.BackendNodeId[];
|
|
21
21
|
}
|
|
22
|
+
interface RemoteFont {
|
|
23
|
+
display: string;
|
|
24
|
+
url?: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
beginRemoteFontLoadEvent: Types.Events.BeginRemoteFontLoad;
|
|
27
|
+
}
|
|
22
28
|
export declare const MAX_CLUSTER_DURATION: Types.Timing.Micro;
|
|
23
29
|
export declare const MAX_SHIFT_TIME_DELTA: Types.Timing.Micro;
|
|
24
30
|
interface ScoreRecord {
|
|
@@ -28,7 +28,7 @@ const styleRecalcInvalidationEvents = [];
|
|
|
28
28
|
const renderFrameImplCreateChildFrameEvents = [];
|
|
29
29
|
const domLoadingEvents = [];
|
|
30
30
|
const layoutImageUnsizedEvents = [];
|
|
31
|
-
const
|
|
31
|
+
const remoteFonts = [];
|
|
32
32
|
const backendNodeIds = new Set();
|
|
33
33
|
// Layout shifts happen during PrePaint as part of the rendering lifecycle.
|
|
34
34
|
// We determine if a LayoutInvalidation event is a potential root cause of a layout
|
|
@@ -53,7 +53,7 @@ export function reset() {
|
|
|
53
53
|
renderFrameImplCreateChildFrameEvents.length = 0;
|
|
54
54
|
layoutImageUnsizedEvents.length = 0;
|
|
55
55
|
domLoadingEvents.length = 0;
|
|
56
|
-
|
|
56
|
+
remoteFonts.length = 0;
|
|
57
57
|
backendNodeIds.clear();
|
|
58
58
|
clusters.length = 0;
|
|
59
59
|
sessionMaxScore = 0;
|
|
@@ -90,7 +90,18 @@ export function handleEvent(event) {
|
|
|
90
90
|
layoutImageUnsizedEvents.push(event);
|
|
91
91
|
}
|
|
92
92
|
if (Types.Events.isBeginRemoteFontLoad(event)) {
|
|
93
|
-
|
|
93
|
+
remoteFonts.push({
|
|
94
|
+
display: event.args.display,
|
|
95
|
+
url: event.args.url,
|
|
96
|
+
beginRemoteFontLoadEvent: event,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (Types.Events.isRemoteFontLoaded(event)) {
|
|
100
|
+
for (const remoteFont of remoteFonts) {
|
|
101
|
+
if (remoteFont.url === event.args.url) {
|
|
102
|
+
remoteFont.name = event.args.name;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
94
105
|
}
|
|
95
106
|
if (Types.Events.isPaintImage(event)) {
|
|
96
107
|
paintImageEvents.push(event);
|
|
@@ -178,7 +189,7 @@ export async function finalize() {
|
|
|
178
189
|
renderFrameImplCreateChildFrameEvents.sort((a, b) => a.ts - b.ts);
|
|
179
190
|
domLoadingEvents.sort((a, b) => a.ts - b.ts);
|
|
180
191
|
layoutImageUnsizedEvents.sort((a, b) => a.ts - b.ts);
|
|
181
|
-
|
|
192
|
+
remoteFonts.sort((a, b) => a.beginRemoteFontLoadEvent.ts - b.beginRemoteFontLoadEvent.ts);
|
|
182
193
|
paintImageEvents.sort((a, b) => a.ts - b.ts);
|
|
183
194
|
// Each function transforms the data used by the next, as such the invoke order
|
|
184
195
|
// is important.
|
|
@@ -408,7 +419,7 @@ export function data() {
|
|
|
408
419
|
renderFrameImplCreateChildFrameEvents,
|
|
409
420
|
domLoadingEvents,
|
|
410
421
|
layoutImageUnsizedEvents,
|
|
411
|
-
|
|
422
|
+
remoteFonts,
|
|
412
423
|
scoreRecords,
|
|
413
424
|
// TODO(crbug/41484172): change the type so no need to clone
|
|
414
425
|
backendNodeIds: [...backendNodeIds],
|
|
@@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YACZ,CAAC,CAAC,CAAC;YACH,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,IAAI;IAClB,OAAO;QACL,QAAQ;QACR,eAAe;QACf,WAAW;QACX,cAAc;QACd,wBAAwB;QACxB,+BAA+B;QAC/B,6BAA6B,EAAE,EAAE;QACjC,qCAAqC;QACrC,gBAAgB;QAChB,wBAAwB;QACxB,yBAAyB;QACzB,YAAY;QACZ,4DAA4D;QAC5D,cAAc,EAAE,CAAC,GAAG,cAAc,CAAC;QACnC,sBAAsB,EAAE,IAAI,GAAG,CAAC,sBAAsB,CAAC;QACvD,gBAAgB;KACjB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,iCAAiC,CAAC,KAAa;IAC7D,IAAI,KAAK,wCAA2B,CAAC;IACrC,IAAI,KAAK,qDAA2C,EAAE,CAAC;QACrD,KAAK,oCAAyB,CAAC;IACjC,CAAC;IAED,IAAI,KAAK,wCAA6B,EAAE,CAAC;QACvC,KAAK,sCAA0B,CAAC;IAClC,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright 2022 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Platform from '../../../core/platform/platform.js';\nimport type * as Protocol from '../../../generated/protocol.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport {data as metaHandlerData} from './MetaHandler.js';\nimport {ScoreClassification} from './PageLoadMetricsHandler.js';\nimport {data as screenshotsHandlerData} from './ScreenshotsHandler.js';\nimport type {HandlerName} from './types.js';\n\n// We start with a score of zero and step through all Layout Shift records from\n// all renderers. Each record not only tells us which renderer it is, but also\n// the unweighted and weighted scores. The unweighted score is the score we would\n// get if the renderer were the only one in the viewport. The weighted score, on\n// the other hand, accounts for how much of the viewport that particular render\n// takes up when the shift happened. An ad frame in the corner of the viewport\n// that shifts is considered less disruptive, therefore, than if it were taking\n// up the whole viewport.\n//\n// Next, we step through all the records from all renderers and add the weighted\n// score to a running total across all of the renderers. We create a new \"cluster\"\n// and reset the running total when:\n//\n// 1. We observe a outermost frame navigation, or\n// 2. When there's a gap between records of > 1s, or\n// 3. When there's more than 5 seconds of continuous layout shifting.\n//\n// Note that for it to be Cumulative Layout Shift in the sense described in the\n// documentation we would need to guarantee that we are tracking from navigation\n// to unload. However, we don't make any such guarantees here (since a developer\n// can record and stop when they please), so we support the cluster approach,\n// and we can give them a score, but it is effectively a \"session\" score, a\n// score for the given recording, and almost certainly not the\n// navigation-to-unload CLS score.\n\ninterface LayoutShifts {\n clusters: readonly Types.Events.SyntheticLayoutShiftCluster[];\n clustersByNavigationId: Map<Types.Events.NavigationId, Types.Events.SyntheticLayoutShiftCluster[]>;\n sessionMaxScore: number;\n // The session window which contains the SessionMaxScore\n clsWindowID: number;\n // We use these to calculate root causes for a given LayoutShift\n // TODO(crbug/41484172): should be readonly\n prePaintEvents: Types.Events.PrePaint[];\n paintImageEvents: Types.Events.PaintImage[];\n layoutInvalidationEvents: readonly Types.Events.LayoutInvalidationTracking[];\n scheduleStyleInvalidationEvents: readonly Types.Events.ScheduleStyleInvalidationTracking[];\n styleRecalcInvalidationEvents: readonly Types.Events.StyleRecalcInvalidationTracking[];\n renderFrameImplCreateChildFrameEvents: readonly Types.Events.RenderFrameImplCreateChildFrame[];\n domLoadingEvents: readonly Types.Events.DomLoading[];\n layoutImageUnsizedEvents: readonly Types.Events.LayoutImageUnsized[];\n beginRemoteFontLoadEvents: readonly Types.Events.BeginRemoteFontLoad[];\n scoreRecords: readonly ScoreRecord[];\n // TODO(crbug/41484172): should be readonly\n backendNodeIds: Protocol.DOM.BackendNodeId[];\n}\n\n// This represents the maximum #time we will allow a cluster to go before we\n// reset it.\nexport const MAX_CLUSTER_DURATION = Helpers.Timing.milliToMicro(Types.Timing.Milli(5000));\n\n// This represents the maximum #time we will allow between layout shift events\n// before considering it to be the start of a new cluster.\nexport const MAX_SHIFT_TIME_DELTA = Helpers.Timing.milliToMicro(Types.Timing.Milli(1000));\n\n// Layout shifts are reported globally to the developer, irrespective of which\n// frame they originated in. However, each process does have its own individual\n// CLS score, so we need to segment by process. This means Layout Shifts from\n// sites with one process (no subframes, or subframes from the same origin)\n// will be reported together. In the case of multiple renderers (frames across\n// different origins), we offer the developer the ability to switch renderer in\n// the UI.\nconst layoutShiftEvents: Types.Events.LayoutShift[] = [];\n\n// These events denote potential node resizings. We store them to link captured\n// layout shifts to the resizing of unsized elements.\nconst layoutInvalidationEvents: Types.Events.LayoutInvalidationTracking[] = [];\nconst scheduleStyleInvalidationEvents: Types.Events.ScheduleStyleInvalidationTracking[] = [];\nconst styleRecalcInvalidationEvents: Types.Events.StyleRecalcInvalidationTracking[] = [];\nconst renderFrameImplCreateChildFrameEvents: Types.Events.RenderFrameImplCreateChildFrame[] = [];\nconst domLoadingEvents: Types.Events.DomLoading[] = [];\nconst layoutImageUnsizedEvents: Types.Events.LayoutImageUnsized[] = [];\nconst beginRemoteFontLoadEvents: Types.Events.BeginRemoteFontLoad[] = [];\n\nconst backendNodeIds = new Set<Protocol.DOM.BackendNodeId>();\n\n// Layout shifts happen during PrePaint as part of the rendering lifecycle.\n// We determine if a LayoutInvalidation event is a potential root cause of a layout\n// shift if the next PrePaint after the LayoutInvalidation is the parent\n// node of such shift.\nconst prePaintEvents: Types.Events.PrePaint[] = [];\n\nconst paintImageEvents: Types.Events.PaintImage[] = [];\n\nlet sessionMaxScore = 0;\n\nlet clsWindowID = -1;\n\nconst clusters: Types.Events.SyntheticLayoutShiftCluster[] = [];\nconst clustersByNavigationId = new Map<Types.Events.NavigationId, Types.Events.SyntheticLayoutShiftCluster[]>();\n\n// Represents a point in time in which a LS score change\n// was recorded.\ninterface ScoreRecord {\n ts: number;\n score: number;\n}\n\n// The complete timeline of LS score changes in a trace.\n// Includes drops to 0 when session windows end.\nconst scoreRecords: ScoreRecord[] = [];\n\nexport function reset(): void {\n layoutShiftEvents.length = 0;\n layoutInvalidationEvents.length = 0;\n scheduleStyleInvalidationEvents.length = 0;\n styleRecalcInvalidationEvents.length = 0;\n prePaintEvents.length = 0;\n paintImageEvents.length = 0;\n renderFrameImplCreateChildFrameEvents.length = 0;\n layoutImageUnsizedEvents.length = 0;\n domLoadingEvents.length = 0;\n beginRemoteFontLoadEvents.length = 0;\n backendNodeIds.clear();\n clusters.length = 0;\n sessionMaxScore = 0;\n scoreRecords.length = 0;\n clsWindowID = -1;\n clustersByNavigationId.clear();\n}\n\nexport function handleEvent(event: Types.Events.Event): void {\n if (Types.Events.isLayoutShift(event) && !event.args.data?.had_recent_input) {\n layoutShiftEvents.push(event);\n return;\n }\n if (Types.Events.isLayoutInvalidationTracking(event)) {\n layoutInvalidationEvents.push(event);\n return;\n }\n if (Types.Events.isScheduleStyleInvalidationTracking(event)) {\n scheduleStyleInvalidationEvents.push(event);\n }\n if (Types.Events.isStyleRecalcInvalidationTracking(event)) {\n styleRecalcInvalidationEvents.push(event);\n }\n if (Types.Events.isPrePaint(event)) {\n prePaintEvents.push(event);\n return;\n }\n if (Types.Events.isRenderFrameImplCreateChildFrame(event)) {\n renderFrameImplCreateChildFrameEvents.push(event);\n }\n if (Types.Events.isDomLoading(event)) {\n domLoadingEvents.push(event);\n }\n if (Types.Events.isLayoutImageUnsized(event)) {\n layoutImageUnsizedEvents.push(event);\n }\n if (Types.Events.isBeginRemoteFontLoad(event)) {\n beginRemoteFontLoadEvents.push(event);\n }\n if (Types.Events.isPaintImage(event)) {\n paintImageEvents.push(event);\n }\n}\n\nfunction traceWindowFromTime(time: Types.Timing.Micro): Types.Timing.TraceWindowMicro {\n return {\n min: time,\n max: time,\n range: Types.Timing.Micro(0),\n };\n}\n\nfunction updateTraceWindowMax(traceWindow: Types.Timing.TraceWindowMicro, newMax: Types.Timing.Micro): void {\n traceWindow.max = newMax;\n traceWindow.range = Types.Timing.Micro(traceWindow.max - traceWindow.min);\n}\n\nfunction findScreenshots(timestamp: Types.Timing.Micro): Types.Events.LayoutShiftParsedData['screenshots'] {\n const data = screenshotsHandlerData();\n if (data.screenshots) {\n const before = Helpers.Trace.findPreviousEventBeforeTimestamp(data.screenshots, timestamp);\n const after = before ? data.screenshots[data.screenshots.indexOf(before) + 1] : null;\n return {before, after};\n }\n if (data.legacySyntheticScreenshots) {\n const before = Helpers.Trace.findPreviousEventBeforeTimestamp(data.legacySyntheticScreenshots, timestamp);\n const after = before ? data.legacySyntheticScreenshots[data.legacySyntheticScreenshots.indexOf(before) + 1] : null;\n return {before, after};\n }\n // No screenshots\n return {before: null, after: null};\n}\n\nfunction buildScoreRecords(): void {\n const {traceBounds} = metaHandlerData();\n scoreRecords.push({ts: traceBounds.min, score: 0});\n\n for (const cluster of clusters) {\n let clusterScore = 0;\n if (cluster.events[0].args.data) {\n scoreRecords.push({ts: cluster.clusterWindow.min, score: cluster.events[0].args.data.weighted_score_delta});\n }\n for (let i = 0; i < cluster.events.length; i++) {\n const event = cluster.events[i];\n if (!event.args.data) {\n continue;\n }\n clusterScore += event.args.data.weighted_score_delta;\n scoreRecords.push({ts: event.ts, score: clusterScore});\n }\n scoreRecords.push({ts: cluster.clusterWindow.max, score: 0});\n }\n}\n\n/**\n * Collects backend node ids coming from LayoutShift and LayoutInvalidation\n * events.\n */\nfunction collectNodes(): void {\n backendNodeIds.clear();\n\n // Collect the node ids present in the shifts.\n for (const layoutShift of layoutShiftEvents) {\n if (!layoutShift.args.data?.impacted_nodes) {\n continue;\n }\n for (const node of layoutShift.args.data.impacted_nodes) {\n backendNodeIds.add(node.node_id);\n }\n }\n\n // Collect the node ids present in LayoutInvalidation & scheduleStyleInvalidation events.\n for (const layoutInvalidation of layoutInvalidationEvents) {\n if (!layoutInvalidation.args.data?.nodeId) {\n continue;\n }\n backendNodeIds.add(layoutInvalidation.args.data.nodeId);\n }\n for (const scheduleStyleInvalidation of scheduleStyleInvalidationEvents) {\n if (!scheduleStyleInvalidation.args.data?.nodeId) {\n continue;\n }\n backendNodeIds.add(scheduleStyleInvalidation.args.data.nodeId);\n }\n}\n\nexport async function finalize(): Promise<void> {\n // Ensure the events are sorted by #time ascending.\n layoutShiftEvents.sort((a, b) => a.ts - b.ts);\n prePaintEvents.sort((a, b) => a.ts - b.ts);\n layoutInvalidationEvents.sort((a, b) => a.ts - b.ts);\n renderFrameImplCreateChildFrameEvents.sort((a, b) => a.ts - b.ts);\n domLoadingEvents.sort((a, b) => a.ts - b.ts);\n layoutImageUnsizedEvents.sort((a, b) => a.ts - b.ts);\n beginRemoteFontLoadEvents.sort((a, b) => a.ts - b.ts);\n paintImageEvents.sort((a, b) => a.ts - b.ts);\n\n // Each function transforms the data used by the next, as such the invoke order\n // is important.\n await buildLayoutShiftsClusters();\n buildScoreRecords();\n collectNodes();\n}\n\nasync function buildLayoutShiftsClusters(): Promise<void> {\n const {navigationsByFrameId, mainFrameId, traceBounds} = metaHandlerData();\n const navigations = navigationsByFrameId.get(mainFrameId) || [];\n if (layoutShiftEvents.length === 0) {\n return;\n }\n let firstShiftTime = layoutShiftEvents[0].ts;\n let lastShiftTime = layoutShiftEvents[0].ts;\n let lastShiftNavigation = null;\n // Now step through each and create clusters.\n // A cluster is equivalent to a session window (see https://web.dev/cls/#what-is-cls).\n // To make the line chart clear, we explicitly demark the limits of each session window\n // by starting the cumulative score of the window at the time of the first layout shift\n // and ending it (dropping the line back to 0) when the window ends according to the\n // thresholds (MAX_CLUSTER_DURATION, MAX_SHIFT_TIME_DELTA).\n for (const event of layoutShiftEvents) {\n // First detect if either the cluster duration or the #time between this and\n // the last shift has been exceeded.\n const clusterDurationExceeded = event.ts - firstShiftTime > MAX_CLUSTER_DURATION;\n const maxTimeDeltaSinceLastShiftExceeded = event.ts - lastShiftTime > MAX_SHIFT_TIME_DELTA;\n\n // Next take a look at navigations. If between this and the last shift we have navigated,\n // note it.\n const currentShiftNavigation = Platform.ArrayUtilities.nearestIndexFromEnd(navigations, nav => nav.ts < event.ts);\n const hasNavigated = lastShiftNavigation !== currentShiftNavigation && currentShiftNavigation !== null;\n\n // If any of the above criteria are met or if we don't have any cluster yet we should\n // start a new one.\n if (clusterDurationExceeded || maxTimeDeltaSinceLastShiftExceeded || hasNavigated || !clusters.length) {\n // The cluster starts #time should be the timestamp of the first layout shift in it.\n const clusterStartTime = event.ts;\n\n // If the last session window ended because the max delta time between shifts\n // was exceeded set the endtime to MAX_SHIFT_TIME_DELTA microseconds after the\n // last shift in the session.\n const endTimeByMaxSessionDuration = clusterDurationExceeded ? firstShiftTime + MAX_CLUSTER_DURATION : Infinity;\n\n // If the last session window ended because the max session duration was\n // surpassed, set the endtime so that the window length = MAX_CLUSTER_DURATION;\n const endTimeByMaxShiftGap = maxTimeDeltaSinceLastShiftExceeded ? lastShiftTime + MAX_SHIFT_TIME_DELTA : Infinity;\n\n // If there was a navigation during the last window, close it at the time\n // of the navigation.\n const endTimeByNavigation = hasNavigated ? navigations[currentShiftNavigation].ts : Infinity;\n\n // End the previous cluster at the time of the first of the criteria above that was met.\n const previousClusterEndTime = Math.min(endTimeByMaxSessionDuration, endTimeByMaxShiftGap, endTimeByNavigation);\n\n // If there is an existing cluster update its closing time.\n if (clusters.length > 0) {\n const currentCluster = clusters[clusters.length - 1];\n updateTraceWindowMax(currentCluster.clusterWindow, Types.Timing.Micro(previousClusterEndTime));\n }\n\n // If this cluster happened after a navigation, set the navigationId to\n // the current navigation. This lets us easily group clusters by\n // navigation.\n const navigationId = currentShiftNavigation === null ?\n Types.Events.NO_NAVIGATION :\n navigations[currentShiftNavigation].args.data?.navigationId;\n // TODO: `navigationId` is `string | undefined`, but the undefined portion\n // comes from `data.navigationId`. I don't think that is possible for this\n // event type. Can we make this typing stronger? In the meantime, we allow\n // `navigationId` to include undefined values.\n\n clusters.push({\n name: 'SyntheticLayoutShiftCluster',\n events: [],\n clusterWindow: traceWindowFromTime(clusterStartTime),\n clusterCumulativeScore: 0,\n scoreWindows: {\n good: traceWindowFromTime(clusterStartTime),\n },\n navigationId,\n // Set default Event so that this event is treated accordingly for the track appender.\n ts: event.ts,\n pid: event.pid,\n tid: event.tid,\n ph: Types.Events.Phase.COMPLETE,\n cat: '',\n dur: Types.Timing.Micro(-1), // This `cluster.dur` is updated below.\n });\n\n firstShiftTime = clusterStartTime;\n }\n\n // Given the above we should have a cluster available, so pick the most\n // recent one and append the shift, bump its score and window values accordingly.\n const currentCluster = clusters[clusters.length - 1];\n const timeFromNavigation = currentShiftNavigation !== null ?\n Types.Timing.Micro(event.ts - navigations[currentShiftNavigation].ts) :\n undefined;\n\n currentCluster.clusterCumulativeScore += event.args.data ? event.args.data.weighted_score_delta : 0;\n if (!event.args.data) {\n continue;\n }\n const shift =\n Helpers.SyntheticEvents.SyntheticEventsManager.registerSyntheticEvent<Types.Events.SyntheticLayoutShift>({\n rawSourceEvent: event,\n ...event,\n name: Types.Events.Name.SYNTHETIC_LAYOUT_SHIFT,\n args: {\n frame: event.args.frame,\n data: {\n ...event.args.data,\n rawEvent: event,\n navigationId: currentCluster.navigationId ?? undefined,\n },\n },\n parsedData: {\n timeFromNavigation,\n screenshots: findScreenshots(event.ts),\n cumulativeWeightedScoreInWindow: currentCluster.clusterCumulativeScore,\n // The score of the session window is temporarily set to 0 just\n // to initialize it. Since we need to get the score of all shifts\n // in the session window to determine its value, its definite\n // value is set when stepping through the built clusters.\n sessionWindowData: {cumulativeWindowScore: 0, id: clusters.length},\n },\n });\n currentCluster.events.push(shift);\n updateTraceWindowMax(currentCluster.clusterWindow, event.ts);\n\n lastShiftTime = event.ts;\n lastShiftNavigation = currentShiftNavigation;\n }\n\n // Now step through each cluster and set up the times at which the value\n // goes from Good, to needs improvement, to Bad. Note that if there is a\n // large jump we may go from Good to Bad without ever creating a Needs\n // Improvement window at all.\n for (const cluster of clusters) {\n let weightedScore = 0;\n let windowID = -1;\n // If this is the last cluster update its window. The cluster duration is determined\n // by the minimum between: time to next navigation, trace end time, time to maximum\n // cluster duration and time to maximum gap between layout shifts.\n if (cluster === clusters[clusters.length - 1]) {\n const clusterEndByMaxDuration = MAX_CLUSTER_DURATION + cluster.clusterWindow.min;\n const clusterEndByMaxGap = cluster.clusterWindow.max + MAX_SHIFT_TIME_DELTA;\n const nextNavigationIndex =\n Platform.ArrayUtilities.nearestIndexFromBeginning(navigations, nav => nav.ts > cluster.clusterWindow.max);\n const nextNavigationTime = nextNavigationIndex ? navigations[nextNavigationIndex].ts : Infinity;\n const clusterEnd = Math.min(clusterEndByMaxDuration, clusterEndByMaxGap, traceBounds.max, nextNavigationTime);\n updateTraceWindowMax(cluster.clusterWindow, Types.Timing.Micro(clusterEnd));\n }\n\n let largestScore = 0;\n let worstShiftEvent: Types.Events.Event|null = null;\n\n for (const shift of cluster.events) {\n weightedScore += shift.args.data ? shift.args.data.weighted_score_delta : 0;\n windowID = shift.parsedData.sessionWindowData.id;\n const ts = shift.ts;\n // Update the the CLS score of this shift's session window now that\n // we have it.\n shift.parsedData.sessionWindowData.cumulativeWindowScore = cluster.clusterCumulativeScore;\n if (weightedScore < LayoutShiftsThreshold.NEEDS_IMPROVEMENT) {\n // Expand the Good window.\n updateTraceWindowMax(cluster.scoreWindows.good, ts);\n } else if (\n weightedScore >= LayoutShiftsThreshold.NEEDS_IMPROVEMENT && weightedScore < LayoutShiftsThreshold.BAD) {\n if (!cluster.scoreWindows.needsImprovement) {\n // Close the Good window, and open the needs improvement window.\n updateTraceWindowMax(cluster.scoreWindows.good, Types.Timing.Micro(ts - 1));\n cluster.scoreWindows.needsImprovement = traceWindowFromTime(ts);\n }\n\n // Expand the needs improvement window.\n updateTraceWindowMax(cluster.scoreWindows.needsImprovement, ts);\n } else if (weightedScore >= LayoutShiftsThreshold.BAD) {\n if (!cluster.scoreWindows.bad) {\n // We may jump from Good to Bad here, so update whichever window is open.\n if (cluster.scoreWindows.needsImprovement) {\n updateTraceWindowMax(cluster.scoreWindows.needsImprovement, Types.Timing.Micro(ts - 1));\n } else {\n updateTraceWindowMax(cluster.scoreWindows.good, Types.Timing.Micro(ts - 1));\n }\n\n cluster.scoreWindows.bad = traceWindowFromTime(shift.ts);\n }\n\n // Expand the Bad window.\n updateTraceWindowMax(cluster.scoreWindows.bad, ts);\n }\n\n // At this point the windows are set by the timestamps of the events, but the\n // next cluster begins at the timestamp of its first event. As such we now\n // need to expand the score window to the end of the cluster, and we do so\n // by using the Bad widow if it's there, or the NI window, or finally the\n // Good window.\n if (cluster.scoreWindows.bad) {\n updateTraceWindowMax(cluster.scoreWindows.bad, cluster.clusterWindow.max);\n } else if (cluster.scoreWindows.needsImprovement) {\n updateTraceWindowMax(cluster.scoreWindows.needsImprovement, cluster.clusterWindow.max);\n } else {\n updateTraceWindowMax(cluster.scoreWindows.good, cluster.clusterWindow.max);\n }\n\n // Find the worst layout shift of the cluster.\n const score = shift.args.data?.weighted_score_delta;\n if (score !== undefined && score > largestScore) {\n largestScore = score;\n worstShiftEvent = shift;\n }\n }\n // Update the cluster's worst layout shift.\n if (worstShiftEvent) {\n cluster.worstShiftEvent = worstShiftEvent;\n }\n\n // layout shifts are already sorted by time ascending.\n // Capture the time range of the cluster.\n cluster.ts = cluster.events[0].ts;\n const lastShiftTimings = Helpers.Timing.eventTimingsMicroSeconds(cluster.events[cluster.events.length - 1]);\n // Add MAX_SHIFT_TIME_DELTA, the section gap after the last layout shift. This marks the end of the cluster.\n cluster.dur = Types.Timing.Micro((lastShiftTimings.endTime - cluster.events[0].ts) + MAX_SHIFT_TIME_DELTA);\n\n if (weightedScore > sessionMaxScore) {\n clsWindowID = windowID;\n sessionMaxScore = weightedScore;\n }\n\n if (cluster.navigationId) {\n const clustersForId = Platform.MapUtilities.getWithDefault(clustersByNavigationId, cluster.navigationId, () => {\n return [];\n });\n clustersForId.push(cluster);\n }\n }\n}\n\nexport function data(): LayoutShifts {\n return {\n clusters,\n sessionMaxScore,\n clsWindowID,\n prePaintEvents,\n layoutInvalidationEvents,\n scheduleStyleInvalidationEvents,\n styleRecalcInvalidationEvents: [],\n renderFrameImplCreateChildFrameEvents,\n domLoadingEvents,\n layoutImageUnsizedEvents,\n beginRemoteFontLoadEvents,\n scoreRecords,\n // TODO(crbug/41484172): change the type so no need to clone\n backendNodeIds: [...backendNodeIds],\n clustersByNavigationId: new Map(clustersByNavigationId),\n paintImageEvents,\n };\n}\n\nexport function deps(): HandlerName[] {\n return ['Screenshots', 'Meta'];\n}\n\nexport function scoreClassificationForLayoutShift(score: number): ScoreClassification {\n let state = ScoreClassification.GOOD;\n if (score >= LayoutShiftsThreshold.NEEDS_IMPROVEMENT) {\n state = ScoreClassification.OK;\n }\n\n if (score >= LayoutShiftsThreshold.BAD) {\n state = ScoreClassification.BAD;\n }\n\n return state;\n}\n\n// Based on https://web.dev/cls/\nexport const enum LayoutShiftsThreshold {\n GOOD = 0,\n NEEDS_IMPROVEMENT = 0.1,\n BAD = 0.25,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"LayoutShiftsHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/LayoutShiftsHandler.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAE/D,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,IAAI,IAAI,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAC,IAAI,IAAI,sBAAsB,EAAC,MAAM,yBAAyB,CAAC;AAyDvE,4EAA4E;AAC5E,YAAY;AACZ,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAE1F,8EAA8E;AAC9E,0DAA0D;AAC1D,MAAM,CAAC,M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;QAC/B,6BAA6B,EAAE,EAAE;QACjC,qCAAqC;QACrC,gBAAgB;QAChB,wBAAwB;QACxB,WAAW;QACX,YAAY;QACZ,4DAA4D;QAC5D,cAAc,EAAE,CAAC,GAAG,cAAc,CAAC;QACnC,sBAAsB,EAAE,IAAI,GAAG,CAAC,sBAAsB,CAAC;QACvD,gBAAgB;KACjB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,iCAAiC,CAAC,KAAa;IAC7D,IAAI,KAAK,wCAA2B,CAAC;IACrC,IAAI,KAAK,qDAA2C,EAAE,CAAC;QACrD,KAAK,oCAAyB,CAAC;IACjC,CAAC;IAED,IAAI,KAAK,wCAA6B,EAAE,CAAC;QACvC,KAAK,sCAA0B,CAAC;IAClC,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright 2022 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Platform from '../../../core/platform/platform.js';\nimport type * as Protocol from '../../../generated/protocol.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport {data as metaHandlerData} from './MetaHandler.js';\nimport {ScoreClassification} from './PageLoadMetricsHandler.js';\nimport {data as screenshotsHandlerData} from './ScreenshotsHandler.js';\nimport type {HandlerName} from './types.js';\n\n// We start with a score of zero and step through all Layout Shift records from\n// all renderers. Each record not only tells us which renderer it is, but also\n// the unweighted and weighted scores. The unweighted score is the score we would\n// get if the renderer were the only one in the viewport. The weighted score, on\n// the other hand, accounts for how much of the viewport that particular render\n// takes up when the shift happened. An ad frame in the corner of the viewport\n// that shifts is considered less disruptive, therefore, than if it were taking\n// up the whole viewport.\n//\n// Next, we step through all the records from all renderers and add the weighted\n// score to a running total across all of the renderers. We create a new \"cluster\"\n// and reset the running total when:\n//\n// 1. We observe a outermost frame navigation, or\n// 2. When there's a gap between records of > 1s, or\n// 3. When there's more than 5 seconds of continuous layout shifting.\n//\n// Note that for it to be Cumulative Layout Shift in the sense described in the\n// documentation we would need to guarantee that we are tracking from navigation\n// to unload. However, we don't make any such guarantees here (since a developer\n// can record and stop when they please), so we support the cluster approach,\n// and we can give them a score, but it is effectively a \"session\" score, a\n// score for the given recording, and almost certainly not the\n// navigation-to-unload CLS score.\n\ninterface LayoutShifts {\n clusters: readonly Types.Events.SyntheticLayoutShiftCluster[];\n clustersByNavigationId: Map<Types.Events.NavigationId, Types.Events.SyntheticLayoutShiftCluster[]>;\n sessionMaxScore: number;\n // The session window which contains the SessionMaxScore\n clsWindowID: number;\n // We use these to calculate root causes for a given LayoutShift\n // TODO(crbug/41484172): should be readonly\n prePaintEvents: Types.Events.PrePaint[];\n paintImageEvents: Types.Events.PaintImage[];\n layoutInvalidationEvents: readonly Types.Events.LayoutInvalidationTracking[];\n scheduleStyleInvalidationEvents: readonly Types.Events.ScheduleStyleInvalidationTracking[];\n styleRecalcInvalidationEvents: readonly Types.Events.StyleRecalcInvalidationTracking[];\n renderFrameImplCreateChildFrameEvents: readonly Types.Events.RenderFrameImplCreateChildFrame[];\n domLoadingEvents: readonly Types.Events.DomLoading[];\n layoutImageUnsizedEvents: readonly Types.Events.LayoutImageUnsized[];\n remoteFonts: readonly RemoteFont[];\n scoreRecords: readonly ScoreRecord[];\n // TODO(crbug/41484172): should be readonly\n backendNodeIds: Protocol.DOM.BackendNodeId[];\n}\n\ninterface RemoteFont {\n display: string;\n url?: string;\n name?: string;\n beginRemoteFontLoadEvent: Types.Events.BeginRemoteFontLoad;\n}\n\n// This represents the maximum #time we will allow a cluster to go before we\n// reset it.\nexport const MAX_CLUSTER_DURATION = Helpers.Timing.milliToMicro(Types.Timing.Milli(5000));\n\n// This represents the maximum #time we will allow between layout shift events\n// before considering it to be the start of a new cluster.\nexport const MAX_SHIFT_TIME_DELTA = Helpers.Timing.milliToMicro(Types.Timing.Milli(1000));\n\n// Layout shifts are reported globally to the developer, irrespective of which\n// frame they originated in. However, each process does have its own individual\n// CLS score, so we need to segment by process. This means Layout Shifts from\n// sites with one process (no subframes, or subframes from the same origin)\n// will be reported together. In the case of multiple renderers (frames across\n// different origins), we offer the developer the ability to switch renderer in\n// the UI.\nconst layoutShiftEvents: Types.Events.LayoutShift[] = [];\n\n// These events denote potential node resizings. We store them to link captured\n// layout shifts to the resizing of unsized elements.\nconst layoutInvalidationEvents: Types.Events.LayoutInvalidationTracking[] = [];\nconst scheduleStyleInvalidationEvents: Types.Events.ScheduleStyleInvalidationTracking[] = [];\nconst styleRecalcInvalidationEvents: Types.Events.StyleRecalcInvalidationTracking[] = [];\nconst renderFrameImplCreateChildFrameEvents: Types.Events.RenderFrameImplCreateChildFrame[] = [];\nconst domLoadingEvents: Types.Events.DomLoading[] = [];\nconst layoutImageUnsizedEvents: Types.Events.LayoutImageUnsized[] = [];\nconst remoteFonts: RemoteFont[] = [];\n\nconst backendNodeIds = new Set<Protocol.DOM.BackendNodeId>();\n\n// Layout shifts happen during PrePaint as part of the rendering lifecycle.\n// We determine if a LayoutInvalidation event is a potential root cause of a layout\n// shift if the next PrePaint after the LayoutInvalidation is the parent\n// node of such shift.\nconst prePaintEvents: Types.Events.PrePaint[] = [];\n\nconst paintImageEvents: Types.Events.PaintImage[] = [];\n\nlet sessionMaxScore = 0;\n\nlet clsWindowID = -1;\n\nconst clusters: Types.Events.SyntheticLayoutShiftCluster[] = [];\nconst clustersByNavigationId = new Map<Types.Events.NavigationId, Types.Events.SyntheticLayoutShiftCluster[]>();\n\n// Represents a point in time in which a LS score change\n// was recorded.\ninterface ScoreRecord {\n ts: number;\n score: number;\n}\n\n// The complete timeline of LS score changes in a trace.\n// Includes drops to 0 when session windows end.\nconst scoreRecords: ScoreRecord[] = [];\n\nexport function reset(): void {\n layoutShiftEvents.length = 0;\n layoutInvalidationEvents.length = 0;\n scheduleStyleInvalidationEvents.length = 0;\n styleRecalcInvalidationEvents.length = 0;\n prePaintEvents.length = 0;\n paintImageEvents.length = 0;\n renderFrameImplCreateChildFrameEvents.length = 0;\n layoutImageUnsizedEvents.length = 0;\n domLoadingEvents.length = 0;\n remoteFonts.length = 0;\n backendNodeIds.clear();\n clusters.length = 0;\n sessionMaxScore = 0;\n scoreRecords.length = 0;\n clsWindowID = -1;\n clustersByNavigationId.clear();\n}\n\nexport function handleEvent(event: Types.Events.Event): void {\n if (Types.Events.isLayoutShift(event) && !event.args.data?.had_recent_input) {\n layoutShiftEvents.push(event);\n return;\n }\n if (Types.Events.isLayoutInvalidationTracking(event)) {\n layoutInvalidationEvents.push(event);\n return;\n }\n if (Types.Events.isScheduleStyleInvalidationTracking(event)) {\n scheduleStyleInvalidationEvents.push(event);\n }\n if (Types.Events.isStyleRecalcInvalidationTracking(event)) {\n styleRecalcInvalidationEvents.push(event);\n }\n if (Types.Events.isPrePaint(event)) {\n prePaintEvents.push(event);\n return;\n }\n if (Types.Events.isRenderFrameImplCreateChildFrame(event)) {\n renderFrameImplCreateChildFrameEvents.push(event);\n }\n if (Types.Events.isDomLoading(event)) {\n domLoadingEvents.push(event);\n }\n if (Types.Events.isLayoutImageUnsized(event)) {\n layoutImageUnsizedEvents.push(event);\n }\n if (Types.Events.isBeginRemoteFontLoad(event)) {\n remoteFonts.push({\n display: event.args.display,\n url: event.args.url,\n beginRemoteFontLoadEvent: event,\n });\n }\n if (Types.Events.isRemoteFontLoaded(event)) {\n for (const remoteFont of remoteFonts) {\n if (remoteFont.url === event.args.url) {\n remoteFont.name = event.args.name;\n }\n }\n }\n if (Types.Events.isPaintImage(event)) {\n paintImageEvents.push(event);\n }\n}\n\nfunction traceWindowFromTime(time: Types.Timing.Micro): Types.Timing.TraceWindowMicro {\n return {\n min: time,\n max: time,\n range: Types.Timing.Micro(0),\n };\n}\n\nfunction updateTraceWindowMax(traceWindow: Types.Timing.TraceWindowMicro, newMax: Types.Timing.Micro): void {\n traceWindow.max = newMax;\n traceWindow.range = Types.Timing.Micro(traceWindow.max - traceWindow.min);\n}\n\nfunction findScreenshots(timestamp: Types.Timing.Micro): Types.Events.LayoutShiftParsedData['screenshots'] {\n const data = screenshotsHandlerData();\n if (data.screenshots) {\n const before = Helpers.Trace.findPreviousEventBeforeTimestamp(data.screenshots, timestamp);\n const after = before ? data.screenshots[data.screenshots.indexOf(before) + 1] : null;\n return {before, after};\n }\n if (data.legacySyntheticScreenshots) {\n const before = Helpers.Trace.findPreviousEventBeforeTimestamp(data.legacySyntheticScreenshots, timestamp);\n const after = before ? data.legacySyntheticScreenshots[data.legacySyntheticScreenshots.indexOf(before) + 1] : null;\n return {before, after};\n }\n // No screenshots\n return {before: null, after: null};\n}\n\nfunction buildScoreRecords(): void {\n const {traceBounds} = metaHandlerData();\n scoreRecords.push({ts: traceBounds.min, score: 0});\n\n for (const cluster of clusters) {\n let clusterScore = 0;\n if (cluster.events[0].args.data) {\n scoreRecords.push({ts: cluster.clusterWindow.min, score: cluster.events[0].args.data.weighted_score_delta});\n }\n for (let i = 0; i < cluster.events.length; i++) {\n const event = cluster.events[i];\n if (!event.args.data) {\n continue;\n }\n clusterScore += event.args.data.weighted_score_delta;\n scoreRecords.push({ts: event.ts, score: clusterScore});\n }\n scoreRecords.push({ts: cluster.clusterWindow.max, score: 0});\n }\n}\n\n/**\n * Collects backend node ids coming from LayoutShift and LayoutInvalidation\n * events.\n */\nfunction collectNodes(): void {\n backendNodeIds.clear();\n\n // Collect the node ids present in the shifts.\n for (const layoutShift of layoutShiftEvents) {\n if (!layoutShift.args.data?.impacted_nodes) {\n continue;\n }\n for (const node of layoutShift.args.data.impacted_nodes) {\n backendNodeIds.add(node.node_id);\n }\n }\n\n // Collect the node ids present in LayoutInvalidation & scheduleStyleInvalidation events.\n for (const layoutInvalidation of layoutInvalidationEvents) {\n if (!layoutInvalidation.args.data?.nodeId) {\n continue;\n }\n backendNodeIds.add(layoutInvalidation.args.data.nodeId);\n }\n for (const scheduleStyleInvalidation of scheduleStyleInvalidationEvents) {\n if (!scheduleStyleInvalidation.args.data?.nodeId) {\n continue;\n }\n backendNodeIds.add(scheduleStyleInvalidation.args.data.nodeId);\n }\n}\n\nexport async function finalize(): Promise<void> {\n // Ensure the events are sorted by #time ascending.\n layoutShiftEvents.sort((a, b) => a.ts - b.ts);\n prePaintEvents.sort((a, b) => a.ts - b.ts);\n layoutInvalidationEvents.sort((a, b) => a.ts - b.ts);\n renderFrameImplCreateChildFrameEvents.sort((a, b) => a.ts - b.ts);\n domLoadingEvents.sort((a, b) => a.ts - b.ts);\n layoutImageUnsizedEvents.sort((a, b) => a.ts - b.ts);\n remoteFonts.sort((a, b) => a.beginRemoteFontLoadEvent.ts - b.beginRemoteFontLoadEvent.ts);\n paintImageEvents.sort((a, b) => a.ts - b.ts);\n\n // Each function transforms the data used by the next, as such the invoke order\n // is important.\n await buildLayoutShiftsClusters();\n buildScoreRecords();\n collectNodes();\n}\n\nasync function buildLayoutShiftsClusters(): Promise<void> {\n const {navigationsByFrameId, mainFrameId, traceBounds} = metaHandlerData();\n const navigations = navigationsByFrameId.get(mainFrameId) || [];\n if (layoutShiftEvents.length === 0) {\n return;\n }\n let firstShiftTime = layoutShiftEvents[0].ts;\n let lastShiftTime = layoutShiftEvents[0].ts;\n let lastShiftNavigation = null;\n // Now step through each and create clusters.\n // A cluster is equivalent to a session window (see https://web.dev/cls/#what-is-cls).\n // To make the line chart clear, we explicitly demark the limits of each session window\n // by starting the cumulative score of the window at the time of the first layout shift\n // and ending it (dropping the line back to 0) when the window ends according to the\n // thresholds (MAX_CLUSTER_DURATION, MAX_SHIFT_TIME_DELTA).\n for (const event of layoutShiftEvents) {\n // First detect if either the cluster duration or the #time between this and\n // the last shift has been exceeded.\n const clusterDurationExceeded = event.ts - firstShiftTime > MAX_CLUSTER_DURATION;\n const maxTimeDeltaSinceLastShiftExceeded = event.ts - lastShiftTime > MAX_SHIFT_TIME_DELTA;\n\n // Next take a look at navigations. If between this and the last shift we have navigated,\n // note it.\n const currentShiftNavigation = Platform.ArrayUtilities.nearestIndexFromEnd(navigations, nav => nav.ts < event.ts);\n const hasNavigated = lastShiftNavigation !== currentShiftNavigation && currentShiftNavigation !== null;\n\n // If any of the above criteria are met or if we don't have any cluster yet we should\n // start a new one.\n if (clusterDurationExceeded || maxTimeDeltaSinceLastShiftExceeded || hasNavigated || !clusters.length) {\n // The cluster starts #time should be the timestamp of the first layout shift in it.\n const clusterStartTime = event.ts;\n\n // If the last session window ended because the max delta time between shifts\n // was exceeded set the endtime to MAX_SHIFT_TIME_DELTA microseconds after the\n // last shift in the session.\n const endTimeByMaxSessionDuration = clusterDurationExceeded ? firstShiftTime + MAX_CLUSTER_DURATION : Infinity;\n\n // If the last session window ended because the max session duration was\n // surpassed, set the endtime so that the window length = MAX_CLUSTER_DURATION;\n const endTimeByMaxShiftGap = maxTimeDeltaSinceLastShiftExceeded ? lastShiftTime + MAX_SHIFT_TIME_DELTA : Infinity;\n\n // If there was a navigation during the last window, close it at the time\n // of the navigation.\n const endTimeByNavigation = hasNavigated ? navigations[currentShiftNavigation].ts : Infinity;\n\n // End the previous cluster at the time of the first of the criteria above that was met.\n const previousClusterEndTime = Math.min(endTimeByMaxSessionDuration, endTimeByMaxShiftGap, endTimeByNavigation);\n\n // If there is an existing cluster update its closing time.\n if (clusters.length > 0) {\n const currentCluster = clusters[clusters.length - 1];\n updateTraceWindowMax(currentCluster.clusterWindow, Types.Timing.Micro(previousClusterEndTime));\n }\n\n // If this cluster happened after a navigation, set the navigationId to\n // the current navigation. This lets us easily group clusters by\n // navigation.\n const navigationId = currentShiftNavigation === null ?\n Types.Events.NO_NAVIGATION :\n navigations[currentShiftNavigation].args.data?.navigationId;\n // TODO: `navigationId` is `string | undefined`, but the undefined portion\n // comes from `data.navigationId`. I don't think that is possible for this\n // event type. Can we make this typing stronger? In the meantime, we allow\n // `navigationId` to include undefined values.\n\n clusters.push({\n name: 'SyntheticLayoutShiftCluster',\n events: [],\n clusterWindow: traceWindowFromTime(clusterStartTime),\n clusterCumulativeScore: 0,\n scoreWindows: {\n good: traceWindowFromTime(clusterStartTime),\n },\n navigationId,\n // Set default Event so that this event is treated accordingly for the track appender.\n ts: event.ts,\n pid: event.pid,\n tid: event.tid,\n ph: Types.Events.Phase.COMPLETE,\n cat: '',\n dur: Types.Timing.Micro(-1), // This `cluster.dur` is updated below.\n });\n\n firstShiftTime = clusterStartTime;\n }\n\n // Given the above we should have a cluster available, so pick the most\n // recent one and append the shift, bump its score and window values accordingly.\n const currentCluster = clusters[clusters.length - 1];\n const timeFromNavigation = currentShiftNavigation !== null ?\n Types.Timing.Micro(event.ts - navigations[currentShiftNavigation].ts) :\n undefined;\n\n currentCluster.clusterCumulativeScore += event.args.data ? event.args.data.weighted_score_delta : 0;\n if (!event.args.data) {\n continue;\n }\n const shift =\n Helpers.SyntheticEvents.SyntheticEventsManager.registerSyntheticEvent<Types.Events.SyntheticLayoutShift>({\n rawSourceEvent: event,\n ...event,\n name: Types.Events.Name.SYNTHETIC_LAYOUT_SHIFT,\n args: {\n frame: event.args.frame,\n data: {\n ...event.args.data,\n rawEvent: event,\n navigationId: currentCluster.navigationId ?? undefined,\n },\n },\n parsedData: {\n timeFromNavigation,\n screenshots: findScreenshots(event.ts),\n cumulativeWeightedScoreInWindow: currentCluster.clusterCumulativeScore,\n // The score of the session window is temporarily set to 0 just\n // to initialize it. Since we need to get the score of all shifts\n // in the session window to determine its value, its definite\n // value is set when stepping through the built clusters.\n sessionWindowData: {cumulativeWindowScore: 0, id: clusters.length},\n },\n });\n currentCluster.events.push(shift);\n updateTraceWindowMax(currentCluster.clusterWindow, event.ts);\n\n lastShiftTime = event.ts;\n lastShiftNavigation = currentShiftNavigation;\n }\n\n // Now step through each cluster and set up the times at which the value\n // goes from Good, to needs improvement, to Bad. Note that if there is a\n // large jump we may go from Good to Bad without ever creating a Needs\n // Improvement window at all.\n for (const cluster of clusters) {\n let weightedScore = 0;\n let windowID = -1;\n // If this is the last cluster update its window. The cluster duration is determined\n // by the minimum between: time to next navigation, trace end time, time to maximum\n // cluster duration and time to maximum gap between layout shifts.\n if (cluster === clusters[clusters.length - 1]) {\n const clusterEndByMaxDuration = MAX_CLUSTER_DURATION + cluster.clusterWindow.min;\n const clusterEndByMaxGap = cluster.clusterWindow.max + MAX_SHIFT_TIME_DELTA;\n const nextNavigationIndex =\n Platform.ArrayUtilities.nearestIndexFromBeginning(navigations, nav => nav.ts > cluster.clusterWindow.max);\n const nextNavigationTime = nextNavigationIndex ? navigations[nextNavigationIndex].ts : Infinity;\n const clusterEnd = Math.min(clusterEndByMaxDuration, clusterEndByMaxGap, traceBounds.max, nextNavigationTime);\n updateTraceWindowMax(cluster.clusterWindow, Types.Timing.Micro(clusterEnd));\n }\n\n let largestScore = 0;\n let worstShiftEvent: Types.Events.Event|null = null;\n\n for (const shift of cluster.events) {\n weightedScore += shift.args.data ? shift.args.data.weighted_score_delta : 0;\n windowID = shift.parsedData.sessionWindowData.id;\n const ts = shift.ts;\n // Update the the CLS score of this shift's session window now that\n // we have it.\n shift.parsedData.sessionWindowData.cumulativeWindowScore = cluster.clusterCumulativeScore;\n if (weightedScore < LayoutShiftsThreshold.NEEDS_IMPROVEMENT) {\n // Expand the Good window.\n updateTraceWindowMax(cluster.scoreWindows.good, ts);\n } else if (\n weightedScore >= LayoutShiftsThreshold.NEEDS_IMPROVEMENT && weightedScore < LayoutShiftsThreshold.BAD) {\n if (!cluster.scoreWindows.needsImprovement) {\n // Close the Good window, and open the needs improvement window.\n updateTraceWindowMax(cluster.scoreWindows.good, Types.Timing.Micro(ts - 1));\n cluster.scoreWindows.needsImprovement = traceWindowFromTime(ts);\n }\n\n // Expand the needs improvement window.\n updateTraceWindowMax(cluster.scoreWindows.needsImprovement, ts);\n } else if (weightedScore >= LayoutShiftsThreshold.BAD) {\n if (!cluster.scoreWindows.bad) {\n // We may jump from Good to Bad here, so update whichever window is open.\n if (cluster.scoreWindows.needsImprovement) {\n updateTraceWindowMax(cluster.scoreWindows.needsImprovement, Types.Timing.Micro(ts - 1));\n } else {\n updateTraceWindowMax(cluster.scoreWindows.good, Types.Timing.Micro(ts - 1));\n }\n\n cluster.scoreWindows.bad = traceWindowFromTime(shift.ts);\n }\n\n // Expand the Bad window.\n updateTraceWindowMax(cluster.scoreWindows.bad, ts);\n }\n\n // At this point the windows are set by the timestamps of the events, but the\n // next cluster begins at the timestamp of its first event. As such we now\n // need to expand the score window to the end of the cluster, and we do so\n // by using the Bad widow if it's there, or the NI window, or finally the\n // Good window.\n if (cluster.scoreWindows.bad) {\n updateTraceWindowMax(cluster.scoreWindows.bad, cluster.clusterWindow.max);\n } else if (cluster.scoreWindows.needsImprovement) {\n updateTraceWindowMax(cluster.scoreWindows.needsImprovement, cluster.clusterWindow.max);\n } else {\n updateTraceWindowMax(cluster.scoreWindows.good, cluster.clusterWindow.max);\n }\n\n // Find the worst layout shift of the cluster.\n const score = shift.args.data?.weighted_score_delta;\n if (score !== undefined && score > largestScore) {\n largestScore = score;\n worstShiftEvent = shift;\n }\n }\n // Update the cluster's worst layout shift.\n if (worstShiftEvent) {\n cluster.worstShiftEvent = worstShiftEvent;\n }\n\n // layout shifts are already sorted by time ascending.\n // Capture the time range of the cluster.\n cluster.ts = cluster.events[0].ts;\n const lastShiftTimings = Helpers.Timing.eventTimingsMicroSeconds(cluster.events[cluster.events.length - 1]);\n // Add MAX_SHIFT_TIME_DELTA, the section gap after the last layout shift. This marks the end of the cluster.\n cluster.dur = Types.Timing.Micro((lastShiftTimings.endTime - cluster.events[0].ts) + MAX_SHIFT_TIME_DELTA);\n\n if (weightedScore > sessionMaxScore) {\n clsWindowID = windowID;\n sessionMaxScore = weightedScore;\n }\n\n if (cluster.navigationId) {\n const clustersForId = Platform.MapUtilities.getWithDefault(clustersByNavigationId, cluster.navigationId, () => {\n return [];\n });\n clustersForId.push(cluster);\n }\n }\n}\n\nexport function data(): LayoutShifts {\n return {\n clusters,\n sessionMaxScore,\n clsWindowID,\n prePaintEvents,\n layoutInvalidationEvents,\n scheduleStyleInvalidationEvents,\n styleRecalcInvalidationEvents: [],\n renderFrameImplCreateChildFrameEvents,\n domLoadingEvents,\n layoutImageUnsizedEvents,\n remoteFonts,\n scoreRecords,\n // TODO(crbug/41484172): change the type so no need to clone\n backendNodeIds: [...backendNodeIds],\n clustersByNavigationId: new Map(clustersByNavigationId),\n paintImageEvents,\n };\n}\n\nexport function deps(): HandlerName[] {\n return ['Screenshots', 'Meta'];\n}\n\nexport function scoreClassificationForLayoutShift(score: number): ScoreClassification {\n let state = ScoreClassification.GOOD;\n if (score >= LayoutShiftsThreshold.NEEDS_IMPROVEMENT) {\n state = ScoreClassification.OK;\n }\n\n if (score >= LayoutShiftsThreshold.BAD) {\n state = ScoreClassification.BAD;\n }\n\n return state;\n}\n\n// Based on https://web.dev/cls/\nexport const enum LayoutShiftsThreshold {\n GOOD = 0,\n NEEDS_IMPROVEMENT = 0.1,\n BAD = 0.25,\n}\n"]}
|
|
@@ -287,7 +287,13 @@ export async function finalize() {
|
|
|
287
287
|
// each particular renderer started and stopped being the main renderer
|
|
288
288
|
// process.
|
|
289
289
|
for (const [, processWindows] of rendererProcessesByFrameId) {
|
|
290
|
-
|
|
290
|
+
// Sort the windows by time; we cannot assume by default they arrive via
|
|
291
|
+
// events in time order. Because we set the window bounds per-process based
|
|
292
|
+
// on the time of the current + next window, we need them sorted in ASC
|
|
293
|
+
// order.
|
|
294
|
+
const processWindowValues = [...processWindows.values()].flat().sort((a, b) => {
|
|
295
|
+
return a.window.min - b.window.min;
|
|
296
|
+
});
|
|
291
297
|
for (let i = 0; i < processWindowValues.length; i++) {
|
|
292
298
|
const currentWindow = processWindowValues[i];
|
|
293
299
|
const nextWindow = processWindowValues[i + 1];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetaHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/MetaHandler.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK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AG,GAAG,qBAAqB,CAAC;QACnG,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,oBAAoB,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,iBAAiB;YACnG,2BAA2B,EAAE,CAAC;YAChC,YAAY,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC;QAC/D,CAAC;IACH,CAAC;AACH,CAAC;AAiDD,MAAM,UAAU,IAAI;IAClB,OAAO;QACL,WAAW,EAAE,EAAC,GAAG,WAAW,EAAC;QAC7B,gBAAgB;QAChB,eAAe;QACf,YAAY;QACZ,YAAY;QACZ,WAAW,EAAE,WAAW,KAAK,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW;QAChF,YAAY,EAAE,YAAY,IAAI,SAAS;QACvC,gBAAgB,EAAE,gBAAgB,IAAI,SAAS;QAC/C,WAAW;QACX,YAAY;QACZ,oBAAoB;QACpB,yBAAyB;QACzB,gBAAgB;QAChB,wBAAwB,EAAE,0BAA0B;QACpD,mBAAmB;QACnB,gBAAgB,EAAE,iBAAiB;QACnC,oBAAoB;QACpB,cAAc;KACf,CAAC;AACJ,CAAC","sourcesContent":["// Copyright 2022 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Platform from '../../../core/platform/platform.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\n// We track the renderer processes we see in each frame on the way through the trace.\nconst rendererProcessesByFrameId: FrameProcessData = new Map();\n\n// We will often want to key data by Frame IDs, and commonly we'll care most\n// about the main frame's ID, so we store and expose that.\nlet mainFrameId = '';\nlet mainFrameURL = '';\n\nconst framesByProcessId = new Map<Types.Events.ProcessID, Map<string, Types.Events.TraceFrame>>();\n\n// We will often want to key data by the browser process, GPU process and top\n// level renderer IDs, so keep a track on those.\nlet browserProcessId: Types.Events.ProcessID = Types.Events.ProcessID(-1);\nlet browserThreadId: Types.Events.ThreadID = Types.Events.ThreadID(-1);\nlet gpuProcessId: Types.Events.ProcessID = Types.Events.ProcessID(-1);\nlet gpuThreadId: Types.Events.ThreadID = Types.Events.ThreadID(-1);\nlet viewportRect: DOMRect|null = null;\nlet devicePixelRatio: number|null = null;\n\nconst processNames = new Map<Types.Events.ProcessID, Types.Events.ProcessName>();\n\nconst topLevelRendererIds = new Set<Types.Events.ProcessID>();\nconst traceBounds: Types.Timing.TraceWindowMicro = {\n min: Types.Timing.Micro(Number.POSITIVE_INFINITY),\n max: Types.Timing.Micro(Number.NEGATIVE_INFINITY),\n range: Types.Timing.Micro(Number.POSITIVE_INFINITY),\n};\n\n/**\n * These represent the user navigating. Values such as First Contentful Paint,\n * etc, are relative to the navigation.\n *\n * We store navigation events both by the frame and navigation ID. This means\n * when we need to look them up, we can use whichever ID we have.\n *\n * Note that these Maps will have the same values in them; these are just keyed\n * differently to make look-ups easier.\n *\n * We also additionally maintain an array of only navigations that occurred on\n * the main frame. In many places in the UI we only care about highlighting\n * main frame navigations, so calculating this list here is better than\n * filtering either of the below maps over and over again at the UI layer.\n */\nconst navigationsByFrameId = new Map<string, Types.Events.NavigationStart[]>();\nconst navigationsByNavigationId = new Map<string, Types.Events.NavigationStart>();\nconst mainFrameNavigations: Types.Events.NavigationStart[] = [];\n\n// Represents all the threads in the trace, organized by process. This is mostly for internal\n// bookkeeping so that during the finalize pass we can obtain the main and browser thread IDs.\nconst threadsInProcess = new Map<Types.Events.ProcessID, Map<Types.Events.ThreadID, Types.Events.ThreadName>>();\n\nlet traceStartedTimeFromTracingStartedEvent = Types.Timing.Micro(-1);\nconst eventPhasesOfInterestForTraceBounds = new Set([\n Types.Events.Phase.BEGIN,\n Types.Events.Phase.END,\n Types.Events.Phase.COMPLETE,\n Types.Events.Phase.INSTANT,\n]);\n\n// Tracks if the trace is a generic trace, which here means that it did not come from athe DevTools Performance Panel recording.\n// We assume a trace is generic, and mark it as not generic if we see any of:\n// - TracingStartedInPage\n// - TracingStartedInBrowser\n// - TracingSessionIdForWorker\n// These are all events which indicate this is a Chrome browser trace.\nlet traceIsGeneric = true;\nconst CHROME_WEB_TRACE_EVENTS = new Set([\n Types.Events.Name.TRACING_STARTED_IN_PAGE,\n Types.Events.Name.TRACING_SESSION_ID_FOR_WORKER,\n Types.Events.Name.TRACING_STARTED_IN_BROWSER,\n\n]);\n\nexport function reset(): void {\n navigationsByFrameId.clear();\n navigationsByNavigationId.clear();\n processNames.clear();\n mainFrameNavigations.length = 0;\n\n browserProcessId = Types.Events.ProcessID(-1);\n browserThreadId = Types.Events.ThreadID(-1);\n gpuProcessId = Types.Events.ProcessID(-1);\n gpuThreadId = Types.Events.ThreadID(-1);\n viewportRect = null;\n topLevelRendererIds.clear();\n threadsInProcess.clear();\n rendererProcessesByFrameId.clear();\n framesByProcessId.clear();\n\n traceBounds.min = Types.Timing.Micro(Number.POSITIVE_INFINITY);\n traceBounds.max = Types.Timing.Micro(Number.NEGATIVE_INFINITY);\n traceBounds.range = Types.Timing.Micro(Number.POSITIVE_INFINITY);\n traceStartedTimeFromTracingStartedEvent = Types.Timing.Micro(-1);\n\n traceIsGeneric = true;\n}\n\nfunction updateRendererProcessByFrame(event: Types.Events.Event, frame: Types.Events.TraceFrame): void {\n const framesInProcessById = Platform.MapUtilities.getWithDefault(framesByProcessId, frame.processId, () => new Map());\n framesInProcessById.set(frame.frame, frame);\n\n const rendererProcessInFrame = Platform.MapUtilities.getWithDefault(\n rendererProcessesByFrameId, frame.frame,\n () => new Map<\n Types.Events.ProcessID, Array<{frame: Types.Events.TraceFrame, window: Types.Timing.TraceWindowMicro}>>());\n const rendererProcessInfo = Platform.MapUtilities.getWithDefault(rendererProcessInFrame, frame.processId, () => {\n return [];\n });\n const lastProcessData = rendererProcessInfo.at(-1);\n\n // Only store a new entry if the URL changed, otherwise it's just\n // redundant information.\n if (lastProcessData && lastProcessData.frame.url === frame.url) {\n return;\n }\n // For now we store the time of the event as the min. In the finalize we step\n // through each of these windows and update their max and range values.\n rendererProcessInfo.push({\n frame,\n window: {\n min: event.ts,\n max: Types.Timing.Micro(0),\n range: Types.Timing.Micro(0),\n },\n });\n}\n\nexport function handleEvent(event: Types.Events.Event): void {\n if (traceIsGeneric && CHROME_WEB_TRACE_EVENTS.has(event.name as Types.Events.Name)) {\n traceIsGeneric = false;\n }\n\n if (Types.Events.isProcessName(event)) {\n processNames.set(event.pid, event);\n }\n\n // If there is a timestamp (which meta events do not have), and the event does\n // not end with ::UMA then it, and the event is in the set of valid phases,\n // then it should be included for the purposes of calculating the trace bounds.\n // The UMA events in particular seem to be reported on page unloading, which\n // often extends the bounds of the trace unhelpfully.\n if (event.ts !== 0 && !event.name.endsWith('::UMA') && eventPhasesOfInterestForTraceBounds.has(event.ph)) {\n traceBounds.min = Types.Timing.Micro(Math.min(event.ts, traceBounds.min));\n const eventDuration = event.dur ?? Types.Timing.Micro(0);\n traceBounds.max = Types.Timing.Micro(Math.max(event.ts + eventDuration, traceBounds.max));\n }\n\n if (Types.Events.isProcessName(event) && (event.args.name === 'Browser' || event.args.name === 'HeadlessBrowser')) {\n browserProcessId = event.pid;\n return;\n }\n\n if (Types.Events.isProcessName(event) && (event.args.name === 'Gpu' || event.args.name === 'GPU Process')) {\n gpuProcessId = event.pid;\n return;\n }\n\n if (Types.Events.isThreadName(event) && event.args.name === 'CrGpuMain') {\n gpuThreadId = event.tid;\n return;\n }\n\n if (Types.Events.isThreadName(event) && event.args.name === 'CrBrowserMain') {\n browserThreadId = event.tid;\n }\n\n if (Types.Events.isMainFrameViewport(event) && viewportRect === null) {\n const rectAsArray = event.args.data.viewport_rect;\n const viewportX = rectAsArray[0];\n const viewportY = rectAsArray[1];\n const viewportWidth = rectAsArray[2];\n const viewportHeight = rectAsArray[5];\n viewportRect = new DOMRect(viewportX, viewportY, viewportWidth, viewportHeight);\n devicePixelRatio = event.args.data.dpr;\n }\n\n // The TracingStartedInBrowser event includes the data on which frames are\n // in scope at the start of the trace. We use this to identify the frame with\n // no parent, i.e. the top level frame.\n if (Types.Events.isTracingStartedInBrowser(event)) {\n traceStartedTimeFromTracingStartedEvent = event.ts;\n\n if (!event.args.data) {\n throw new Error('No frames found in trace data');\n }\n\n for (const frame of (event.args.data.frames ?? [])) {\n updateRendererProcessByFrame(event, frame);\n\n if (!frame.parent) {\n topLevelRendererIds.add(frame.processId);\n }\n /**\n * The code here uses a few different methods to try to determine the main frame.\n * The ideal is that the frames have two flags present:\n *\n * 1. isOutermostMainFrame (added in April 2024 - crrev.com/c/5424783)\n * 2. isInPrimaryMainFrame (added in June 2024 - crrev.com/c/5595033)\n *\n * The frame where both of these are set to `true` is the main frame. The\n * reason we need both of these flags to have 100% confidence is because\n * with the introduction of MPArch and pre-rendering, we can have other\n * frames that are the outermost frame, but are not the primary process.\n * Relying on isOutermostMainFrame in isolation caused the engine to\n * incorrectly identify the wrong frame as main (see crbug.com/343873756).\n *\n * See https://source.chromium.org/chromium/chromium/src/+/main:docs/frame_trees.md\n * for a bit more context on FrameTrees in Chromium.\n *\n * To avoid breaking entirely for traces pre-June 2024 that don't have\n * both of these flags, we will fallback to less accurate methods:\n *\n * 1. If we have isOutermostMainFrame, we will use that\n * (and accept we might get it wrong)\n * 2. If we don't have isOutermostMainFrame, we fallback to finding a\n * frame that has a URL, but doesn't have a parent. This is a crude\n * guess at the main frame...but better than nothing and is historically\n * how DevTools identified the main frame.\n */\n\n const traceHasPrimaryMainFrameFlag = 'isInPrimaryMainFrame' in frame;\n const traceHasOutermostMainFrameFlag = 'isOutermostMainFrame' in frame;\n\n if (traceHasPrimaryMainFrameFlag && traceHasOutermostMainFrameFlag) {\n // Ideal situation: identify the main frame as the one that has both these flags set to true.\n if (frame.isInPrimaryMainFrame && frame.isOutermostMainFrame) {\n mainFrameId = frame.frame;\n mainFrameURL = frame.url;\n }\n } else if (traceHasOutermostMainFrameFlag) {\n // Less ideal: \"guess\" at the main thread by using this flag.\n if (frame.isOutermostMainFrame) {\n mainFrameId = frame.frame;\n mainFrameURL = frame.url;\n }\n // Worst case: guess by seeing if the frame doesn't have a parent, and does have a URL.\n } else if (!frame.parent && frame.url) {\n mainFrameId = frame.frame;\n mainFrameURL = frame.url;\n }\n }\n\n return;\n }\n\n // FrameCommittedInBrowser events tell us information about each frame\n // and we use these to track how long each individual renderer is active\n // for. We track all renderers here (top level and those in frames), but\n // for convenience we also populate a set of top level renderer IDs.\n if (Types.Events.isFrameCommittedInBrowser(event)) {\n const frame = event.args.data;\n if (!frame) {\n return;\n }\n\n updateRendererProcessByFrame(event, frame);\n\n if (frame.parent) {\n return;\n }\n\n topLevelRendererIds.add(frame.processId);\n return;\n }\n\n if (Types.Events.isCommitLoad(event)) {\n const frameData = event.args.data;\n if (!frameData) {\n return;\n }\n\n const {frame, name, url} = frameData;\n updateRendererProcessByFrame(event, {processId: event.pid, frame, name, url});\n return;\n }\n\n // Track all threads based on the process & thread IDs.\n if (Types.Events.isThreadName(event)) {\n const threads = Platform.MapUtilities.getWithDefault(threadsInProcess, event.pid, () => new Map());\n threads.set(event.tid, event);\n return;\n }\n\n // Track all navigation events. Note that there can be navigation start events\n // but where the documentLoaderURL is empty. As far as the trace rendering is\n // concerned, these events are noise so we filter them out here.\n // (The filtering of empty URLs is done in the isNavigationStart check)\n if (Types.Events.isNavigationStart(event) && event.args.data) {\n const navigationId = event.args.data.navigationId;\n if (navigationsByNavigationId.has(navigationId)) {\n // We have only ever seen this situation once, in crbug.com/1503982, where the user ran:\n // window.location.href = 'javascript:console.log(\"foo\")'\n // In this situation two identical navigationStart events are emitted with the same data, URL and ID.\n // So, in this situation we drop/ignore any subsequent navigations if we have already seen that ID.\n return;\n }\n navigationsByNavigationId.set(navigationId, event);\n\n const frameId = event.args.frame;\n const existingFrameNavigations = navigationsByFrameId.get(frameId) || [];\n existingFrameNavigations.push(event);\n navigationsByFrameId.set(frameId, existingFrameNavigations);\n if (frameId === mainFrameId) {\n mainFrameNavigations.push(event);\n }\n return;\n }\n}\n\nexport async function finalize(): Promise<void> {\n // We try to set the minimum time by finding the event with the smallest\n // timestamp. However, if we also got a timestamp from the\n // TracingStartedInBrowser event, we should always use that.\n // But in some traces (for example, CPU profiles) we do not get that event,\n // hence why we need to check we got a timestamp from it before setting it.\n if (traceStartedTimeFromTracingStartedEvent >= 0) {\n traceBounds.min = traceStartedTimeFromTracingStartedEvent;\n }\n traceBounds.range = Types.Timing.Micro(traceBounds.max - traceBounds.min);\n\n // If we go from foo.com to example.com we will get a new renderer, and\n // therefore the \"top level renderer\" will have a different PID as it has\n // changed. Here we step through each renderer process and updated its window\n // bounds, such that we end up with the time ranges in the trace for when\n // each particular renderer started and stopped being the main renderer\n // process.\n for (const [, processWindows] of rendererProcessesByFrameId) {\n const processWindowValues = [...processWindows.values()].flat();\n for (let i = 0; i < processWindowValues.length; i++) {\n const currentWindow = processWindowValues[i];\n const nextWindow = processWindowValues[i + 1];\n\n // For the last window we set its max to be positive infinity.\n // TODO: Move the trace bounds handler into meta so we can clamp first and last windows.\n if (!nextWindow) {\n currentWindow.window.max = Types.Timing.Micro(traceBounds.max);\n currentWindow.window.range = Types.Timing.Micro(traceBounds.max - currentWindow.window.min);\n } else {\n currentWindow.window.max = Types.Timing.Micro(nextWindow.window.min - 1);\n currentWindow.window.range = Types.Timing.Micro(currentWindow.window.max - currentWindow.window.min);\n }\n }\n }\n\n // Frame ids which we didn't register using either the TracingStartedInBrowser or\n // the FrameCommittedInBrowser events are considered noise, so we filter them out, as well\n // as the navigations that belong to such frames.\n for (const [frameId, navigations] of navigationsByFrameId) {\n // The frames in the rendererProcessesByFrameId map come only from the\n // TracingStartedInBrowser and FrameCommittedInBrowser events, so we can use it as point\n // of comparison to determine if a frameId should be discarded.\n if (rendererProcessesByFrameId.has(frameId)) {\n continue;\n }\n navigationsByFrameId.delete(frameId);\n for (const navigation of navigations) {\n if (!navigation.args.data) {\n continue;\n }\n navigationsByNavigationId.delete(navigation.args.data.navigationId);\n }\n }\n\n // Sometimes in traces the TracingStartedInBrowser event can give us an\n // incorrect initial URL for the main frame's URL - about:blank or the URL of\n // the previous page. This doesn't matter too much except we often use this\n // URL as the visual name of the trace shown to the user (e.g. in the history\n // dropdown). We can be more accurate by finding the first main frame\n // navigation, and using its URL, if we have it.\n // However, to avoid doing this in a case where the first navigation is far\n // into the trace's lifecycle, we only do this in situations where the first\n // navigation happened very soon (0.5 seconds) after the trace started\n // recording.\n const firstMainFrameNav = mainFrameNavigations.at(0);\n const firstNavTimeThreshold = Helpers.Timing.secondsToMicro(Types.Timing.Seconds(0.5));\n if (firstMainFrameNav) {\n const navigationIsWithinThreshold = firstMainFrameNav.ts - traceBounds.min < firstNavTimeThreshold;\n if (firstMainFrameNav.args.data?.isOutermostMainFrame && firstMainFrameNav.args.data?.documentLoaderURL &&\n navigationIsWithinThreshold) {\n mainFrameURL = firstMainFrameNav.args.data.documentLoaderURL;\n }\n }\n}\n\nexport interface MetaHandlerData {\n traceIsGeneric: boolean;\n traceBounds: Types.Timing.TraceWindowMicro;\n browserProcessId: Types.Events.ProcessID;\n processNames: Map<Types.Events.ProcessID, Types.Events.ProcessName>;\n browserThreadId: Types.Events.ThreadID;\n gpuProcessId: Types.Events.ProcessID;\n navigationsByFrameId: Map<string, Types.Events.NavigationStart[]>;\n navigationsByNavigationId: Map<string, Types.Events.NavigationStart>;\n threadsInProcess: Map<Types.Events.ProcessID, Map<Types.Events.ThreadID, Types.Events.ThreadName>>;\n mainFrameId: string;\n mainFrameURL: string;\n /**\n * A frame can have multiple renderer processes, at the same time,\n * a renderer process can have multiple URLs. This map tracks the\n * processes active on a given frame, with the time window in which\n * they were active. Because a renderer process might have multiple\n * URLs, each process in each frame has an array of windows, with an\n * entry for each URL it had.\n */\n rendererProcessesByFrame: FrameProcessData;\n topLevelRendererIds: Set<Types.Events.ProcessID>;\n frameByProcessId: Map<Types.Events.ProcessID, Map<string, Types.Events.TraceFrame>>;\n mainFrameNavigations: Types.Events.NavigationStart[];\n gpuThreadId?: Types.Events.ThreadID;\n viewportRect?: DOMRect;\n devicePixelRatio?: number;\n}\n\n// Each frame has a single render process at a given time but it can have\n// multiple render processes during a trace, for example if a navigation\n// occurred in the frame. This map tracks the process that was active for\n// each frame at each point in time. Also, because a process can be\n// assigned to multiple URLs, there is a window for each URL a process\n// was assigned.\n//\n// Note that different sites always end up in different render\n// processes, however two different URLs can point to the same site.\n// For example: https://google.com and https://maps.google.com point to\n// the same site.\n// Read more about this in\n// https://developer.chrome.com/articles/renderingng-architecture/#threads\n// and https://web.dev/same-site-same-origin/\nexport type FrameProcessData =\n Map<string,\n Map<Types.Events.ProcessID, Array<{frame: Types.Events.TraceFrame, window: Types.Timing.TraceWindowMicro}>>>;\n\nexport function data(): MetaHandlerData {\n return {\n traceBounds: {...traceBounds},\n browserProcessId,\n browserThreadId,\n processNames,\n gpuProcessId,\n gpuThreadId: gpuThreadId === Types.Events.ThreadID(-1) ? undefined : gpuThreadId,\n viewportRect: viewportRect || undefined,\n devicePixelRatio: devicePixelRatio ?? undefined,\n mainFrameId,\n mainFrameURL,\n navigationsByFrameId,\n navigationsByNavigationId,\n threadsInProcess,\n rendererProcessesByFrame: rendererProcessesByFrameId,\n topLevelRendererIds,\n frameByProcessId: framesByProcessId,\n mainFrameNavigations,\n traceIsGeneric,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"MetaHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/MetaHandler.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,qFAAqF;AACrF,MAAM,0BAA0B,GAAqB,IAAI,GAAG,EAAE,CAAC;AAE/D,4EAA4E;AAC5E,0DAA0D;AAC1D,IAAI,WAAW,GAA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,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,oBAAoB,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,iBAAiB;YACnG,2BAA2B,EAAE,CAAC;YAChC,YAAY,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC;QAC/D,CAAC;IACH,CAAC;AACH,CAAC;AAiDD,MAAM,UAAU,IAAI;IAClB,OAAO;QACL,WAAW,EAAE,EAAC,GAAG,WAAW,EAAC;QAC7B,gBAAgB;QAChB,eAAe;QACf,YAAY;QACZ,YAAY;QACZ,WAAW,EAAE,WAAW,KAAK,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW;QAChF,YAAY,EAAE,YAAY,IAAI,SAAS;QACvC,gBAAgB,EAAE,gBAAgB,IAAI,SAAS;QAC/C,WAAW;QACX,YAAY;QACZ,oBAAoB;QACpB,yBAAyB;QACzB,gBAAgB;QAChB,wBAAwB,EAAE,0BAA0B;QACpD,mBAAmB;QACnB,gBAAgB,EAAE,iBAAiB;QACnC,oBAAoB;QACpB,cAAc;KACf,CAAC;AACJ,CAAC","sourcesContent":["// Copyright 2022 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Platform from '../../../core/platform/platform.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\n// We track the renderer processes we see in each frame on the way through the trace.\nconst rendererProcessesByFrameId: FrameProcessData = new Map();\n\n// We will often want to key data by Frame IDs, and commonly we'll care most\n// about the main frame's ID, so we store and expose that.\nlet mainFrameId = '';\nlet mainFrameURL = '';\n\nconst framesByProcessId = new Map<Types.Events.ProcessID, Map<string, Types.Events.TraceFrame>>();\n\n// We will often want to key data by the browser process, GPU process and top\n// level renderer IDs, so keep a track on those.\nlet browserProcessId: Types.Events.ProcessID = Types.Events.ProcessID(-1);\nlet browserThreadId: Types.Events.ThreadID = Types.Events.ThreadID(-1);\nlet gpuProcessId: Types.Events.ProcessID = Types.Events.ProcessID(-1);\nlet gpuThreadId: Types.Events.ThreadID = Types.Events.ThreadID(-1);\nlet viewportRect: DOMRect|null = null;\nlet devicePixelRatio: number|null = null;\n\nconst processNames = new Map<Types.Events.ProcessID, Types.Events.ProcessName>();\n\nconst topLevelRendererIds = new Set<Types.Events.ProcessID>();\nconst traceBounds: Types.Timing.TraceWindowMicro = {\n min: Types.Timing.Micro(Number.POSITIVE_INFINITY),\n max: Types.Timing.Micro(Number.NEGATIVE_INFINITY),\n range: Types.Timing.Micro(Number.POSITIVE_INFINITY),\n};\n\n/**\n * These represent the user navigating. Values such as First Contentful Paint,\n * etc, are relative to the navigation.\n *\n * We store navigation events both by the frame and navigation ID. This means\n * when we need to look them up, we can use whichever ID we have.\n *\n * Note that these Maps will have the same values in them; these are just keyed\n * differently to make look-ups easier.\n *\n * We also additionally maintain an array of only navigations that occurred on\n * the main frame. In many places in the UI we only care about highlighting\n * main frame navigations, so calculating this list here is better than\n * filtering either of the below maps over and over again at the UI layer.\n */\nconst navigationsByFrameId = new Map<string, Types.Events.NavigationStart[]>();\nconst navigationsByNavigationId = new Map<string, Types.Events.NavigationStart>();\nconst mainFrameNavigations: Types.Events.NavigationStart[] = [];\n\n// Represents all the threads in the trace, organized by process. This is mostly for internal\n// bookkeeping so that during the finalize pass we can obtain the main and browser thread IDs.\nconst threadsInProcess = new Map<Types.Events.ProcessID, Map<Types.Events.ThreadID, Types.Events.ThreadName>>();\n\nlet traceStartedTimeFromTracingStartedEvent = Types.Timing.Micro(-1);\nconst eventPhasesOfInterestForTraceBounds = new Set([\n Types.Events.Phase.BEGIN,\n Types.Events.Phase.END,\n Types.Events.Phase.COMPLETE,\n Types.Events.Phase.INSTANT,\n]);\n\n// Tracks if the trace is a generic trace, which here means that it did not come from athe DevTools Performance Panel recording.\n// We assume a trace is generic, and mark it as not generic if we see any of:\n// - TracingStartedInPage\n// - TracingStartedInBrowser\n// - TracingSessionIdForWorker\n// These are all events which indicate this is a Chrome browser trace.\nlet traceIsGeneric = true;\nconst CHROME_WEB_TRACE_EVENTS = new Set([\n Types.Events.Name.TRACING_STARTED_IN_PAGE,\n Types.Events.Name.TRACING_SESSION_ID_FOR_WORKER,\n Types.Events.Name.TRACING_STARTED_IN_BROWSER,\n\n]);\n\nexport function reset(): void {\n navigationsByFrameId.clear();\n navigationsByNavigationId.clear();\n processNames.clear();\n mainFrameNavigations.length = 0;\n\n browserProcessId = Types.Events.ProcessID(-1);\n browserThreadId = Types.Events.ThreadID(-1);\n gpuProcessId = Types.Events.ProcessID(-1);\n gpuThreadId = Types.Events.ThreadID(-1);\n viewportRect = null;\n topLevelRendererIds.clear();\n threadsInProcess.clear();\n rendererProcessesByFrameId.clear();\n framesByProcessId.clear();\n\n traceBounds.min = Types.Timing.Micro(Number.POSITIVE_INFINITY);\n traceBounds.max = Types.Timing.Micro(Number.NEGATIVE_INFINITY);\n traceBounds.range = Types.Timing.Micro(Number.POSITIVE_INFINITY);\n traceStartedTimeFromTracingStartedEvent = Types.Timing.Micro(-1);\n\n traceIsGeneric = true;\n}\n\nfunction updateRendererProcessByFrame(event: Types.Events.Event, frame: Types.Events.TraceFrame): void {\n const framesInProcessById = Platform.MapUtilities.getWithDefault(framesByProcessId, frame.processId, () => new Map());\n framesInProcessById.set(frame.frame, frame);\n\n const rendererProcessInFrame = Platform.MapUtilities.getWithDefault(\n rendererProcessesByFrameId, frame.frame,\n () => new Map<\n Types.Events.ProcessID, Array<{frame: Types.Events.TraceFrame, window: Types.Timing.TraceWindowMicro}>>());\n const rendererProcessInfo = Platform.MapUtilities.getWithDefault(rendererProcessInFrame, frame.processId, () => {\n return [];\n });\n const lastProcessData = rendererProcessInfo.at(-1);\n\n // Only store a new entry if the URL changed, otherwise it's just\n // redundant information.\n if (lastProcessData && lastProcessData.frame.url === frame.url) {\n return;\n }\n // For now we store the time of the event as the min. In the finalize we step\n // through each of these windows and update their max and range values.\n rendererProcessInfo.push({\n frame,\n window: {\n min: event.ts,\n max: Types.Timing.Micro(0),\n range: Types.Timing.Micro(0),\n },\n });\n}\n\nexport function handleEvent(event: Types.Events.Event): void {\n if (traceIsGeneric && CHROME_WEB_TRACE_EVENTS.has(event.name as Types.Events.Name)) {\n traceIsGeneric = false;\n }\n\n if (Types.Events.isProcessName(event)) {\n processNames.set(event.pid, event);\n }\n\n // If there is a timestamp (which meta events do not have), and the event does\n // not end with ::UMA then it, and the event is in the set of valid phases,\n // then it should be included for the purposes of calculating the trace bounds.\n // The UMA events in particular seem to be reported on page unloading, which\n // often extends the bounds of the trace unhelpfully.\n if (event.ts !== 0 && !event.name.endsWith('::UMA') && eventPhasesOfInterestForTraceBounds.has(event.ph)) {\n traceBounds.min = Types.Timing.Micro(Math.min(event.ts, traceBounds.min));\n const eventDuration = event.dur ?? Types.Timing.Micro(0);\n traceBounds.max = Types.Timing.Micro(Math.max(event.ts + eventDuration, traceBounds.max));\n }\n\n if (Types.Events.isProcessName(event) && (event.args.name === 'Browser' || event.args.name === 'HeadlessBrowser')) {\n browserProcessId = event.pid;\n return;\n }\n\n if (Types.Events.isProcessName(event) && (event.args.name === 'Gpu' || event.args.name === 'GPU Process')) {\n gpuProcessId = event.pid;\n return;\n }\n\n if (Types.Events.isThreadName(event) && event.args.name === 'CrGpuMain') {\n gpuThreadId = event.tid;\n return;\n }\n\n if (Types.Events.isThreadName(event) && event.args.name === 'CrBrowserMain') {\n browserThreadId = event.tid;\n }\n\n if (Types.Events.isMainFrameViewport(event) && viewportRect === null) {\n const rectAsArray = event.args.data.viewport_rect;\n const viewportX = rectAsArray[0];\n const viewportY = rectAsArray[1];\n const viewportWidth = rectAsArray[2];\n const viewportHeight = rectAsArray[5];\n viewportRect = new DOMRect(viewportX, viewportY, viewportWidth, viewportHeight);\n devicePixelRatio = event.args.data.dpr;\n }\n\n // The TracingStartedInBrowser event includes the data on which frames are\n // in scope at the start of the trace. We use this to identify the frame with\n // no parent, i.e. the top level frame.\n if (Types.Events.isTracingStartedInBrowser(event)) {\n traceStartedTimeFromTracingStartedEvent = event.ts;\n\n if (!event.args.data) {\n throw new Error('No frames found in trace data');\n }\n\n for (const frame of (event.args.data.frames ?? [])) {\n updateRendererProcessByFrame(event, frame);\n\n if (!frame.parent) {\n topLevelRendererIds.add(frame.processId);\n }\n /**\n * The code here uses a few different methods to try to determine the main frame.\n * The ideal is that the frames have two flags present:\n *\n * 1. isOutermostMainFrame (added in April 2024 - crrev.com/c/5424783)\n * 2. isInPrimaryMainFrame (added in June 2024 - crrev.com/c/5595033)\n *\n * The frame where both of these are set to `true` is the main frame. The\n * reason we need both of these flags to have 100% confidence is because\n * with the introduction of MPArch and pre-rendering, we can have other\n * frames that are the outermost frame, but are not the primary process.\n * Relying on isOutermostMainFrame in isolation caused the engine to\n * incorrectly identify the wrong frame as main (see crbug.com/343873756).\n *\n * See https://source.chromium.org/chromium/chromium/src/+/main:docs/frame_trees.md\n * for a bit more context on FrameTrees in Chromium.\n *\n * To avoid breaking entirely for traces pre-June 2024 that don't have\n * both of these flags, we will fallback to less accurate methods:\n *\n * 1. If we have isOutermostMainFrame, we will use that\n * (and accept we might get it wrong)\n * 2. If we don't have isOutermostMainFrame, we fallback to finding a\n * frame that has a URL, but doesn't have a parent. This is a crude\n * guess at the main frame...but better than nothing and is historically\n * how DevTools identified the main frame.\n */\n\n const traceHasPrimaryMainFrameFlag = 'isInPrimaryMainFrame' in frame;\n const traceHasOutermostMainFrameFlag = 'isOutermostMainFrame' in frame;\n\n if (traceHasPrimaryMainFrameFlag && traceHasOutermostMainFrameFlag) {\n // Ideal situation: identify the main frame as the one that has both these flags set to true.\n if (frame.isInPrimaryMainFrame && frame.isOutermostMainFrame) {\n mainFrameId = frame.frame;\n mainFrameURL = frame.url;\n }\n } else if (traceHasOutermostMainFrameFlag) {\n // Less ideal: \"guess\" at the main thread by using this flag.\n if (frame.isOutermostMainFrame) {\n mainFrameId = frame.frame;\n mainFrameURL = frame.url;\n }\n // Worst case: guess by seeing if the frame doesn't have a parent, and does have a URL.\n } else if (!frame.parent && frame.url) {\n mainFrameId = frame.frame;\n mainFrameURL = frame.url;\n }\n }\n\n return;\n }\n\n // FrameCommittedInBrowser events tell us information about each frame\n // and we use these to track how long each individual renderer is active\n // for. We track all renderers here (top level and those in frames), but\n // for convenience we also populate a set of top level renderer IDs.\n if (Types.Events.isFrameCommittedInBrowser(event)) {\n const frame = event.args.data;\n if (!frame) {\n return;\n }\n\n updateRendererProcessByFrame(event, frame);\n\n if (frame.parent) {\n return;\n }\n\n topLevelRendererIds.add(frame.processId);\n return;\n }\n\n if (Types.Events.isCommitLoad(event)) {\n const frameData = event.args.data;\n if (!frameData) {\n return;\n }\n\n const {frame, name, url} = frameData;\n updateRendererProcessByFrame(event, {processId: event.pid, frame, name, url});\n return;\n }\n\n // Track all threads based on the process & thread IDs.\n if (Types.Events.isThreadName(event)) {\n const threads = Platform.MapUtilities.getWithDefault(threadsInProcess, event.pid, () => new Map());\n threads.set(event.tid, event);\n return;\n }\n\n // Track all navigation events. Note that there can be navigation start events\n // but where the documentLoaderURL is empty. As far as the trace rendering is\n // concerned, these events are noise so we filter them out here.\n // (The filtering of empty URLs is done in the isNavigationStart check)\n if (Types.Events.isNavigationStart(event) && event.args.data) {\n const navigationId = event.args.data.navigationId;\n if (navigationsByNavigationId.has(navigationId)) {\n // We have only ever seen this situation once, in crbug.com/1503982, where the user ran:\n // window.location.href = 'javascript:console.log(\"foo\")'\n // In this situation two identical navigationStart events are emitted with the same data, URL and ID.\n // So, in this situation we drop/ignore any subsequent navigations if we have already seen that ID.\n return;\n }\n navigationsByNavigationId.set(navigationId, event);\n\n const frameId = event.args.frame;\n const existingFrameNavigations = navigationsByFrameId.get(frameId) || [];\n existingFrameNavigations.push(event);\n navigationsByFrameId.set(frameId, existingFrameNavigations);\n if (frameId === mainFrameId) {\n mainFrameNavigations.push(event);\n }\n return;\n }\n}\n\nexport async function finalize(): Promise<void> {\n // We try to set the minimum time by finding the event with the smallest\n // timestamp. However, if we also got a timestamp from the\n // TracingStartedInBrowser event, we should always use that.\n // But in some traces (for example, CPU profiles) we do not get that event,\n // hence why we need to check we got a timestamp from it before setting it.\n if (traceStartedTimeFromTracingStartedEvent >= 0) {\n traceBounds.min = traceStartedTimeFromTracingStartedEvent;\n }\n traceBounds.range = Types.Timing.Micro(traceBounds.max - traceBounds.min);\n\n // If we go from foo.com to example.com we will get a new renderer, and\n // therefore the \"top level renderer\" will have a different PID as it has\n // changed. Here we step through each renderer process and updated its window\n // bounds, such that we end up with the time ranges in the trace for when\n // each particular renderer started and stopped being the main renderer\n // process.\n for (const [, processWindows] of rendererProcessesByFrameId) {\n // Sort the windows by time; we cannot assume by default they arrive via\n // events in time order. Because we set the window bounds per-process based\n // on the time of the current + next window, we need them sorted in ASC\n // order.\n const processWindowValues = [...processWindows.values()].flat().sort((a, b) => {\n return a.window.min - b.window.min;\n });\n for (let i = 0; i < processWindowValues.length; i++) {\n const currentWindow = processWindowValues[i];\n const nextWindow = processWindowValues[i + 1];\n\n // For the last window we set its max to be positive infinity.\n // TODO: Move the trace bounds handler into meta so we can clamp first and last windows.\n if (!nextWindow) {\n currentWindow.window.max = Types.Timing.Micro(traceBounds.max);\n currentWindow.window.range = Types.Timing.Micro(traceBounds.max - currentWindow.window.min);\n } else {\n currentWindow.window.max = Types.Timing.Micro(nextWindow.window.min - 1);\n currentWindow.window.range = Types.Timing.Micro(currentWindow.window.max - currentWindow.window.min);\n }\n }\n }\n\n // Frame ids which we didn't register using either the TracingStartedInBrowser or\n // the FrameCommittedInBrowser events are considered noise, so we filter them out, as well\n // as the navigations that belong to such frames.\n for (const [frameId, navigations] of navigationsByFrameId) {\n // The frames in the rendererProcessesByFrameId map come only from the\n // TracingStartedInBrowser and FrameCommittedInBrowser events, so we can use it as point\n // of comparison to determine if a frameId should be discarded.\n if (rendererProcessesByFrameId.has(frameId)) {\n continue;\n }\n navigationsByFrameId.delete(frameId);\n for (const navigation of navigations) {\n if (!navigation.args.data) {\n continue;\n }\n navigationsByNavigationId.delete(navigation.args.data.navigationId);\n }\n }\n\n // Sometimes in traces the TracingStartedInBrowser event can give us an\n // incorrect initial URL for the main frame's URL - about:blank or the URL of\n // the previous page. This doesn't matter too much except we often use this\n // URL as the visual name of the trace shown to the user (e.g. in the history\n // dropdown). We can be more accurate by finding the first main frame\n // navigation, and using its URL, if we have it.\n // However, to avoid doing this in a case where the first navigation is far\n // into the trace's lifecycle, we only do this in situations where the first\n // navigation happened very soon (0.5 seconds) after the trace started\n // recording.\n const firstMainFrameNav = mainFrameNavigations.at(0);\n const firstNavTimeThreshold = Helpers.Timing.secondsToMicro(Types.Timing.Seconds(0.5));\n if (firstMainFrameNav) {\n const navigationIsWithinThreshold = firstMainFrameNav.ts - traceBounds.min < firstNavTimeThreshold;\n if (firstMainFrameNav.args.data?.isOutermostMainFrame && firstMainFrameNav.args.data?.documentLoaderURL &&\n navigationIsWithinThreshold) {\n mainFrameURL = firstMainFrameNav.args.data.documentLoaderURL;\n }\n }\n}\n\nexport interface MetaHandlerData {\n traceIsGeneric: boolean;\n traceBounds: Types.Timing.TraceWindowMicro;\n browserProcessId: Types.Events.ProcessID;\n processNames: Map<Types.Events.ProcessID, Types.Events.ProcessName>;\n browserThreadId: Types.Events.ThreadID;\n gpuProcessId: Types.Events.ProcessID;\n navigationsByFrameId: Map<string, Types.Events.NavigationStart[]>;\n navigationsByNavigationId: Map<string, Types.Events.NavigationStart>;\n threadsInProcess: Map<Types.Events.ProcessID, Map<Types.Events.ThreadID, Types.Events.ThreadName>>;\n mainFrameId: string;\n mainFrameURL: string;\n /**\n * A frame can have multiple renderer processes, at the same time,\n * a renderer process can have multiple URLs. This map tracks the\n * processes active on a given frame, with the time window in which\n * they were active. Because a renderer process might have multiple\n * URLs, each process in each frame has an array of windows, with an\n * entry for each URL it had.\n */\n rendererProcessesByFrame: FrameProcessData;\n topLevelRendererIds: Set<Types.Events.ProcessID>;\n frameByProcessId: Map<Types.Events.ProcessID, Map<string, Types.Events.TraceFrame>>;\n mainFrameNavigations: Types.Events.NavigationStart[];\n gpuThreadId?: Types.Events.ThreadID;\n viewportRect?: DOMRect;\n devicePixelRatio?: number;\n}\n\n// Each frame has a single render process at a given time but it can have\n// multiple render processes during a trace, for example if a navigation\n// occurred in the frame. This map tracks the process that was active for\n// each frame at each point in time. Also, because a process can be\n// assigned to multiple URLs, there is a window for each URL a process\n// was assigned.\n//\n// Note that different sites always end up in different render\n// processes, however two different URLs can point to the same site.\n// For example: https://google.com and https://maps.google.com point to\n// the same site.\n// Read more about this in\n// https://developer.chrome.com/articles/renderingng-architecture/#threads\n// and https://web.dev/same-site-same-origin/\nexport type FrameProcessData =\n Map<string,\n Map<Types.Events.ProcessID, Array<{frame: Types.Events.TraceFrame, window: Types.Timing.TraceWindowMicro}>>>;\n\nexport function data(): MetaHandlerData {\n return {\n traceBounds: {...traceBounds},\n browserProcessId,\n browserThreadId,\n processNames,\n gpuProcessId,\n gpuThreadId: gpuThreadId === Types.Events.ThreadID(-1) ? undefined : gpuThreadId,\n viewportRect: viewportRect || undefined,\n devicePixelRatio: devicePixelRatio ?? undefined,\n mainFrameId,\n mainFrameURL,\n navigationsByFrameId,\n navigationsByNavigationId,\n threadsInProcess,\n rendererProcessesByFrame: rendererProcessesByFrameId,\n topLevelRendererIds,\n frameByProcessId: framesByProcessId,\n mainFrameNavigations,\n traceIsGeneric,\n };\n}\n"]}
|
|
@@ -69,3 +69,8 @@ export interface MetricScore {
|
|
|
69
69
|
estimated?: boolean;
|
|
70
70
|
timing: Types.Timing.Micro;
|
|
71
71
|
}
|
|
72
|
+
export type LCPMetricScore = MetricScore & {
|
|
73
|
+
event: Types.Events.LargestContentfulPaintCandidate;
|
|
74
|
+
metricName: MetricName.LCP;
|
|
75
|
+
};
|
|
76
|
+
export declare function metricIsLCP(metric: MetricScore): metric is LCPMetricScore;
|