@paulirish/trace_engine 0.0.56 → 0.0.58
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/tsconfig.tsbuildinfo +1 -1
- package/README.md +2 -2
- package/core/platform/Brand.d.ts +8 -1
- package/core/platform/Brand.js.map +1 -1
- package/core/platform/DevToolsPath.d.ts +1 -1
- package/core/platform/DevToolsPath.js +1 -1
- package/core/platform/DevToolsPath.js.map +1 -1
- package/core/platform/StringUtilities.d.ts +12 -2
- package/core/platform/StringUtilities.js +31 -7
- package/core/platform/StringUtilities.js.map +1 -1
- package/generated/protocol.d.ts +8290 -7994
- package/locales/af.json +82 -67
- package/locales/am.json +82 -67
- package/locales/ar.json +93 -78
- package/locales/as.json +82 -67
- package/locales/az.json +82 -67
- package/locales/be.json +81 -66
- package/locales/bg.json +82 -67
- package/locales/bn.json +82 -67
- package/locales/bs.json +82 -67
- package/locales/ca.json +82 -67
- package/locales/cs.json +82 -67
- package/locales/cy.json +82 -67
- package/locales/da.json +82 -67
- package/locales/de.json +82 -67
- package/locales/el.json +82 -67
- package/locales/en-GB.json +82 -67
- package/locales/en-US.json +13 -10
- package/locales/en-XL.json +13 -10
- package/locales/es-419.json +82 -67
- package/locales/es.json +82 -67
- package/locales/et.json +82 -67
- package/locales/eu.json +82 -67
- package/locales/fa.json +86 -71
- package/locales/fi.json +82 -67
- package/locales/fil.json +82 -67
- package/locales/fr-CA.json +82 -67
- package/locales/fr.json +82 -67
- package/locales/gl.json +82 -67
- package/locales/gu.json +82 -67
- package/locales/he.json +104 -89
- package/locales/hi.json +82 -67
- package/locales/hr.json +82 -67
- package/locales/hu.json +82 -67
- package/locales/hy.json +82 -67
- package/locales/id.json +82 -67
- package/locales/is.json +82 -67
- package/locales/it.json +82 -67
- package/locales/ja.json +82 -67
- package/locales/ka.json +82 -67
- package/locales/kk.json +82 -67
- package/locales/km.json +82 -67
- package/locales/kn.json +81 -66
- package/locales/ko.json +82 -67
- package/locales/ky.json +81 -66
- package/locales/lo.json +82 -67
- package/locales/lt.json +82 -67
- package/locales/lv.json +82 -67
- package/locales/mk.json +82 -67
- package/locales/ml.json +82 -67
- package/locales/mn.json +82 -67
- package/locales/mr.json +81 -66
- package/locales/ms.json +81 -66
- package/locales/my.json +83 -68
- package/locales/ne.json +83 -68
- package/locales/nl.json +82 -67
- package/locales/no.json +82 -67
- package/locales/or.json +82 -67
- package/locales/pa.json +81 -66
- package/locales/pl.json +82 -67
- package/locales/pt-PT.json +82 -67
- package/locales/pt.json +82 -67
- package/locales/ro.json +82 -67
- package/locales/ru.json +82 -67
- package/locales/si.json +82 -67
- package/locales/sk.json +82 -67
- package/locales/sl.json +82 -67
- package/locales/sq.json +82 -67
- package/locales/sr-Latn.json +82 -67
- package/locales/sr.json +82 -67
- package/locales/sv.json +82 -67
- package/locales/sw.json +81 -66
- package/locales/ta.json +82 -67
- package/locales/te.json +82 -67
- package/locales/th.json +84 -69
- package/locales/tr.json +81 -66
- package/locales/uk.json +81 -66
- package/locales/ur.json +82 -67
- package/locales/uz.json +81 -66
- package/locales/vi.json +82 -67
- package/locales/zh-HK.json +82 -67
- package/locales/zh-TW.json +82 -67
- package/locales/zh.json +82 -67
- package/locales/zu.json +82 -67
- package/models/trace/ModelImpl.d.ts +1 -1
- package/models/trace/ModelImpl.js +17 -7
- package/models/trace/ModelImpl.js.map +1 -1
- package/models/trace/Processor.js +26 -16
- package/models/trace/Processor.js.map +1 -1
- package/models/trace/extras/ThirdParties.js +1 -2
- package/models/trace/extras/ThirdParties.js.map +1 -1
- package/models/trace/extras/TraceTree.d.ts +4 -2
- package/models/trace/extras/TraceTree.js +7 -5
- package/models/trace/extras/TraceTree.js.map +1 -1
- package/models/trace/handlers/AnimationFramesHandler.d.ts +1 -0
- package/models/trace/handlers/AnimationFramesHandler.js +8 -0
- package/models/trace/handlers/AnimationFramesHandler.js.map +1 -1
- package/models/trace/handlers/ExtensionTraceDataHandler.d.ts +1 -1
- package/models/trace/handlers/ExtensionTraceDataHandler.js +29 -15
- package/models/trace/handlers/ExtensionTraceDataHandler.js.map +1 -1
- package/models/trace/handlers/FramesHandler.js +38 -28
- package/models/trace/handlers/FramesHandler.js.map +1 -1
- package/models/trace/handlers/ImagePaintingHandler.d.ts +2 -1
- package/models/trace/handlers/ImagePaintingHandler.js.map +1 -1
- package/models/trace/handlers/InitiatorsHandler.js +27 -0
- package/models/trace/handlers/InitiatorsHandler.js.map +1 -1
- package/models/trace/handlers/NetworkRequestsHandler.js +12 -2
- package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -1
- package/models/trace/handlers/RendererHandler.d.ts +0 -5
- package/models/trace/handlers/RendererHandler.js +9 -12
- package/models/trace/handlers/RendererHandler.js.map +1 -1
- package/models/trace/handlers/SamplesHandler.js +6 -12
- package/models/trace/handlers/SamplesHandler.js.map +1 -1
- package/models/trace/handlers/ScriptsHandler.d.ts +4 -3
- package/models/trace/handlers/ScriptsHandler.js +3 -0
- package/models/trace/handlers/ScriptsHandler.js.map +1 -1
- package/models/trace/handlers/SelectorStatsHandler.d.ts +17 -0
- package/models/trace/handlers/SelectorStatsHandler.js +42 -0
- package/models/trace/handlers/SelectorStatsHandler.js.map +1 -1
- package/models/trace/handlers/UserInteractionsHandler.d.ts +4 -2
- package/models/trace/handlers/UserInteractionsHandler.js.map +1 -1
- package/models/trace/handlers/helpers.d.ts +3 -6
- package/models/trace/handlers/helpers.js +17 -9
- package/models/trace/handlers/helpers.js.map +1 -1
- package/models/trace/handlers/types.d.ts +4 -1
- package/models/trace/handlers/types.js.map +1 -1
- package/models/trace/helpers/SamplesIntegrator.d.ts +1 -0
- package/models/trace/helpers/SamplesIntegrator.js +21 -21
- package/models/trace/helpers/SamplesIntegrator.js.map +1 -1
- package/models/trace/helpers/SyntheticEvents.d.ts +0 -6
- package/models/trace/helpers/SyntheticEvents.js +2 -2
- package/models/trace/helpers/SyntheticEvents.js.map +1 -1
- package/models/trace/helpers/Timing.d.ts +5 -0
- package/models/trace/helpers/Timing.js +55 -3
- package/models/trace/helpers/Timing.js.map +1 -1
- package/models/trace/helpers/Trace.d.ts +1 -1
- package/models/trace/helpers/Trace.js +1 -1
- package/models/trace/helpers/Trace.js.map +1 -1
- package/models/trace/helpers/TreeHelpers.d.ts +1 -1
- package/models/trace/helpers/TreeHelpers.js.map +1 -1
- package/models/trace/insights/CLSCulprits.d.ts +3 -2
- package/models/trace/insights/CLSCulprits.js +24 -2
- package/models/trace/insights/CLSCulprits.js.map +1 -1
- package/models/trace/insights/Cache.d.ts +2 -0
- package/models/trace/insights/Cache.js +10 -0
- package/models/trace/insights/Cache.js.map +1 -1
- package/models/trace/insights/Common.d.ts +6 -5
- package/models/trace/insights/Common.js +29 -17
- package/models/trace/insights/Common.js.map +1 -1
- package/models/trace/insights/DOMSize.d.ts +2 -1
- package/models/trace/insights/DOMSize.js +9 -1
- package/models/trace/insights/DOMSize.js.map +1 -1
- package/models/trace/insights/DocumentLatency.d.ts +3 -2
- package/models/trace/insights/DocumentLatency.js +44 -2
- package/models/trace/insights/DocumentLatency.js.map +1 -1
- package/models/trace/insights/DuplicatedJavaScript.d.ts +3 -0
- package/models/trace/insights/DuplicatedJavaScript.js +12 -3
- package/models/trace/insights/DuplicatedJavaScript.js.map +1 -1
- package/models/trace/insights/FontDisplay.d.ts +1 -0
- package/models/trace/insights/FontDisplay.js +7 -0
- package/models/trace/insights/FontDisplay.js.map +1 -1
- package/models/trace/insights/ForcedReflow.d.ts +5 -3
- package/models/trace/insights/ForcedReflow.js +20 -3
- package/models/trace/insights/ForcedReflow.js.map +1 -1
- package/models/trace/insights/INPBreakdown.d.ts +11 -5
- package/models/trace/insights/INPBreakdown.js +36 -5
- package/models/trace/insights/INPBreakdown.js.map +1 -1
- package/models/trace/insights/ImageDelivery.d.ts +4 -0
- package/models/trace/insights/ImageDelivery.js +13 -0
- package/models/trace/insights/ImageDelivery.js.map +1 -1
- package/models/trace/insights/LCPBreakdown.d.ts +7 -6
- package/models/trace/insights/LCPBreakdown.js +33 -12
- package/models/trace/insights/LCPBreakdown.js.map +1 -1
- package/models/trace/insights/LCPDiscovery.d.ts +14 -2
- package/models/trace/insights/LCPDiscovery.js +60 -2
- package/models/trace/insights/LCPDiscovery.js.map +1 -1
- package/models/trace/insights/LegacyJavaScript.d.ts +3 -0
- package/models/trace/insights/LegacyJavaScript.js +12 -3
- package/models/trace/insights/LegacyJavaScript.js.map +1 -1
- package/models/trace/insights/ModernHTTP.d.ts +8 -5
- package/models/trace/insights/ModernHTTP.js +27 -14
- package/models/trace/insights/ModernHTTP.js.map +1 -1
- package/models/trace/insights/NetworkDependencyTree.d.ts +1 -0
- package/models/trace/insights/NetworkDependencyTree.js +25 -1
- package/models/trace/insights/NetworkDependencyTree.js.map +1 -1
- package/models/trace/insights/RenderBlocking.d.ts +3 -1
- package/models/trace/insights/RenderBlocking.js +11 -1
- package/models/trace/insights/RenderBlocking.js.map +1 -1
- package/models/trace/insights/SlowCSSSelector.d.ts +17 -8
- package/models/trace/insights/SlowCSSSelector.js +39 -20
- package/models/trace/insights/SlowCSSSelector.js.map +1 -1
- package/models/trace/insights/ThirdParties.d.ts +3 -0
- package/models/trace/insights/ThirdParties.js +31 -0
- package/models/trace/insights/ThirdParties.js.map +1 -1
- package/models/trace/insights/Viewport.d.ts +2 -1
- package/models/trace/insights/Viewport.js +16 -0
- package/models/trace/insights/Viewport.js.map +1 -1
- package/models/trace/insights/types.d.ts +4 -1
- package/models/trace/insights/types.js +1 -0
- package/models/trace/insights/types.js.map +1 -1
- package/models/trace/lantern/graph/BaseNode.d.ts +1 -1
- package/models/trace/lantern/graph/BaseNode.js +1 -1
- package/models/trace/lantern/graph/BaseNode.js.map +1 -1
- package/models/trace/lantern/simulation/SimulationTimingMap.js +1 -1
- package/models/trace/lantern/simulation/SimulationTimingMap.js.map +1 -1
- package/models/trace/types/Configuration.d.ts +7 -0
- package/models/trace/types/Configuration.js +1 -0
- package/models/trace/types/Configuration.js.map +1 -1
- package/models/trace/types/Extensions.d.ts +14 -2
- package/models/trace/types/Extensions.js +5 -1
- package/models/trace/types/Extensions.js.map +1 -1
- package/models/trace/types/File.d.ts +3 -0
- package/models/trace/types/File.js.map +1 -1
- package/models/trace/types/Overlays.d.ts +115 -0
- package/models/trace/types/Overlays.js +5 -0
- package/models/trace/types/Overlays.js.map +1 -0
- package/models/trace/types/TraceEvents.d.ts +79 -36
- package/models/trace/types/TraceEvents.js +8 -13
- package/models/trace/types/TraceEvents.js.map +1 -1
- package/models/trace/types/types-tsconfig.json +1 -0
- package/models/trace/types/types.d.ts +1 -0
- package/models/trace/types/types.js +1 -0
- package/models/trace/types/types.js.map +1 -1
- package/package.json +1 -1
- package/test/test-trace-engine.mjs +1 -2
- package/core/platform/devtools_entrypoint-bundle-tsconfig-tsconfig.json +0 -43
- package/core/platform/platform.prebundle.d.ts +0 -18
- package/core/platform/platform.prebundle.js +0 -53
- package/core/platform/platform.prebundle.js.map +0 -1
- package/core/platform/platform.prebundle.ts +0 -71
- package/models/cpu_profile/cpu_profile.prebundle.d.ts +0 -3
- package/models/cpu_profile/cpu_profile.prebundle.js +0 -7
- package/models/cpu_profile/cpu_profile.prebundle.js.map +0 -1
- package/models/cpu_profile/cpu_profile.prebundle.ts +0 -11
- package/models/cpu_profile/devtools_entrypoint-bundle-tsconfig-tsconfig.json +0 -43
- package/models/trace/devtools_entrypoint-bundle-tsconfig-tsconfig.json +0 -61
- package/models/trace/extras/devtools_entrypoint-bundle-tsconfig-tsconfig.json +0 -43
- package/models/trace/extras/extras.prebundle.d.ts +0 -7
- package/models/trace/extras/extras.prebundle.js +0 -11
- package/models/trace/extras/extras.prebundle.js.map +0 -1
- package/models/trace/extras/extras.prebundle.ts +0 -11
- package/models/trace/handlers/devtools_entrypoint-bundle-tsconfig-tsconfig.json +0 -43
- package/models/trace/handlers/handlers.prebundle.d.ts +0 -4
- package/models/trace/handlers/handlers.prebundle.js +0 -8
- package/models/trace/handlers/handlers.prebundle.js.map +0 -1
- package/models/trace/handlers/handlers.prebundle.ts +0 -8
- package/models/trace/helpers/devtools_entrypoint-bundle-tsconfig-tsconfig.json +0 -43
- package/models/trace/helpers/helpers.prebundle.d.ts +0 -7
- package/models/trace/helpers/helpers.prebundle.js +0 -11
- package/models/trace/helpers/helpers.prebundle.js.map +0 -1
- package/models/trace/helpers/helpers.prebundle.ts +0 -11
- package/models/trace/insights/devtools_entrypoint-bundle-tsconfig-tsconfig.json +0 -43
- package/models/trace/insights/insights.prebundle.d.ts +0 -4
- package/models/trace/insights/insights.prebundle.js +0 -8
- package/models/trace/insights/insights.prebundle.js.map +0 -1
- package/models/trace/insights/insights.prebundle.ts +0 -8
- package/models/trace/lantern/core/core.prebundle.d.ts +0 -2
- package/models/trace/lantern/core/core.prebundle.js +0 -6
- package/models/trace/lantern/core/core.prebundle.js.map +0 -1
- package/models/trace/lantern/core/core.prebundle.ts +0 -6
- package/models/trace/lantern/core/devtools_entrypoint-bundle-tsconfig-tsconfig.json +0 -43
- package/models/trace/lantern/devtools_entrypoint-bundle-tsconfig-tsconfig.json +0 -43
- package/models/trace/lantern/graph/devtools_entrypoint-bundle-tsconfig-tsconfig.json +0 -43
- package/models/trace/lantern/graph/graph.prebundle.d.ts +0 -4
- package/models/trace/lantern/graph/graph.prebundle.js +0 -8
- package/models/trace/lantern/graph/graph.prebundle.js.map +0 -1
- package/models/trace/lantern/graph/graph.prebundle.ts +0 -8
- package/models/trace/lantern/lantern.prebundle.d.ts +0 -6
- package/models/trace/lantern/lantern.prebundle.js +0 -10
- package/models/trace/lantern/lantern.prebundle.js.map +0 -1
- package/models/trace/lantern/lantern.prebundle.ts +0 -17
- package/models/trace/lantern/metrics/devtools_entrypoint-bundle-tsconfig-tsconfig.json +0 -43
- package/models/trace/lantern/metrics/metrics.prebundle.d.ts +0 -8
- package/models/trace/lantern/metrics/metrics.prebundle.js +0 -12
- package/models/trace/lantern/metrics/metrics.prebundle.js.map +0 -1
- package/models/trace/lantern/metrics/metrics.prebundle.ts +0 -12
- package/models/trace/lantern/simulation/devtools_entrypoint-bundle-tsconfig-tsconfig.json +0 -43
- package/models/trace/lantern/simulation/simulation.prebundle.d.ts +0 -6
- package/models/trace/lantern/simulation/simulation.prebundle.js +0 -10
- package/models/trace/lantern/simulation/simulation.prebundle.js.map +0 -1
- package/models/trace/lantern/simulation/simulation.prebundle.ts +0 -10
- package/models/trace/lantern/types/devtools_entrypoint-bundle-tsconfig-tsconfig.json +0 -43
- package/models/trace/lantern/types/types.prebundle.d.ts +0 -1
- package/models/trace/lantern/types/types.prebundle.js +0 -5
- package/models/trace/lantern/types/types.prebundle.js.map +0 -1
- package/models/trace/lantern/types/types.prebundle.ts +0 -5
- package/models/trace/trace.prebundle.d.ts +0 -10
- package/models/trace/trace.prebundle.js +0 -14
- package/models/trace/trace.prebundle.js.map +0 -1
- package/models/trace/trace.prebundle.ts +0 -25
- package/models/trace/types/devtools_entrypoint-bundle-tsconfig-tsconfig.json +0 -43
- package/models/trace/types/types.prebundle.d.ts +0 -5
- package/models/trace/types/types.prebundle.js +0 -9
- package/models/trace/types/types.prebundle.js.map +0 -1
- package/models/trace/types/types.prebundle.ts +0 -9
|
@@ -8,7 +8,7 @@ import * as Types from '../types/types.js';
|
|
|
8
8
|
import { InsightCategory, InsightKeys, } from './types.js';
|
|
9
9
|
export const UIStrings = {
|
|
10
10
|
/**
|
|
11
|
-
|
|
11
|
+
* @description Title of an insight that provides details about slow CSS selectors.
|
|
12
12
|
*/
|
|
13
13
|
title: 'CSS Selector costs',
|
|
14
14
|
/**
|
|
@@ -16,35 +16,44 @@ export const UIStrings = {
|
|
|
16
16
|
*/
|
|
17
17
|
description: 'If Recalculate Style costs remain high, selector optimization can reduce them. [Optimize the selectors](https://developer.chrome.com/docs/devtools/performance/selector-stats) with both high elapsed time and high slow-path %. Simpler selectors, fewer selectors, a smaller DOM, and a shallower DOM will all reduce matching costs.',
|
|
18
18
|
/**
|
|
19
|
-
|
|
19
|
+
* @description Column name for count of elements that the engine attempted to match against a style rule
|
|
20
20
|
*/
|
|
21
21
|
matchAttempts: 'Match attempts',
|
|
22
22
|
/**
|
|
23
|
-
|
|
23
|
+
* @description Column name for count of elements that matched a style rule
|
|
24
24
|
*/
|
|
25
25
|
matchCount: 'Match count',
|
|
26
26
|
/**
|
|
27
|
-
|
|
27
|
+
* @description Column name for elapsed time spent computing a style rule
|
|
28
28
|
*/
|
|
29
29
|
elapsed: 'Elapsed time',
|
|
30
30
|
/**
|
|
31
|
-
|
|
31
|
+
* @description Column name for the selectors that took the longest amount of time/effort.
|
|
32
32
|
*/
|
|
33
33
|
topSelectors: 'Top selectors',
|
|
34
34
|
/**
|
|
35
|
-
|
|
35
|
+
* @description Column name for a total sum.
|
|
36
36
|
*/
|
|
37
37
|
total: 'Total',
|
|
38
38
|
/**
|
|
39
39
|
* @description Text status indicating that no CSS selector data was found.
|
|
40
40
|
*/
|
|
41
41
|
enableSelectorData: 'No CSS selector data was found. CSS selector stats need to be enabled in the performance panel settings.',
|
|
42
|
+
/**
|
|
43
|
+
* @description top CSS selector when ranked by elapsed time in ms
|
|
44
|
+
*/
|
|
45
|
+
topSelectorElapsedTime: 'Top selector elaspsed time',
|
|
46
|
+
/**
|
|
47
|
+
* @description top CSS selector when ranked by match attempt
|
|
48
|
+
*/
|
|
49
|
+
topSelectorMatchAttempt: 'Top selector match attempt',
|
|
42
50
|
};
|
|
43
51
|
// const str_ = i18n.i18n.registerUIStrings('models/trace/insights/SlowCSSSelector.ts', UIStrings);
|
|
44
52
|
export const i18nString = (i18nId, values) => ({i18nId, values}); // i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
53
|
+
const slowCSSSelectorThreshold = 500; // 500us threshold for slow selectors
|
|
45
54
|
function aggregateSelectorStats(data, context) {
|
|
46
55
|
const selectorMap = new Map();
|
|
47
|
-
for (const [event, value] of data) {
|
|
56
|
+
for (const [event, value] of data.dataForUpdateLayoutEvent) {
|
|
48
57
|
if (event.args.beginData?.frame !== context.frameId) {
|
|
49
58
|
continue;
|
|
50
59
|
}
|
|
@@ -74,8 +83,7 @@ function finalize(partialModel) {
|
|
|
74
83
|
title: i18nString(UIStrings.title),
|
|
75
84
|
description: i18nString(UIStrings.description),
|
|
76
85
|
category: InsightCategory.ALL,
|
|
77
|
-
state: partialModel.
|
|
78
|
-
'pass',
|
|
86
|
+
state: partialModel.topSelectorElapsedMs && partialModel.topSelectorMatchAttempts ? 'informative' : 'pass',
|
|
79
87
|
...partialModel,
|
|
80
88
|
};
|
|
81
89
|
}
|
|
@@ -84,7 +92,7 @@ export function generateInsight(parsedTrace, context) {
|
|
|
84
92
|
if (!selectorStatsData) {
|
|
85
93
|
throw new Error('no selector stats data');
|
|
86
94
|
}
|
|
87
|
-
const selectorTimings = aggregateSelectorStats(selectorStatsData
|
|
95
|
+
const selectorTimings = aggregateSelectorStats(selectorStatsData, context);
|
|
88
96
|
let totalElapsedUs = 0;
|
|
89
97
|
let totalMatchAttempts = 0;
|
|
90
98
|
let totalMatchCount = 0;
|
|
@@ -93,22 +101,33 @@ export function generateInsight(parsedTrace, context) {
|
|
|
93
101
|
totalMatchAttempts += timing[SelectorTimingsKey.MatchAttempts];
|
|
94
102
|
totalMatchCount += timing[SelectorTimingsKey.MatchCount];
|
|
95
103
|
});
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
let topSelectorElapsedMs = null;
|
|
105
|
+
let topSelectorMatchAttempts = null;
|
|
106
|
+
if (selectorTimings.length > 0) {
|
|
107
|
+
// find the selector with most elapsed time
|
|
108
|
+
topSelectorElapsedMs = selectorTimings.reduce((a, b) => {
|
|
109
|
+
return a[SelectorTimingsKey.Elapsed] > b[SelectorTimingsKey.Elapsed] ? a : b;
|
|
110
|
+
});
|
|
111
|
+
// check if the slowest selector is slow enough to trigger insights info
|
|
112
|
+
if (topSelectorElapsedMs && topSelectorElapsedMs[SelectorTimingsKey.Elapsed] < slowCSSSelectorThreshold) {
|
|
113
|
+
topSelectorElapsedMs = null;
|
|
114
|
+
}
|
|
115
|
+
// find the selector with most match attempts
|
|
116
|
+
topSelectorMatchAttempts = selectorTimings.reduce((a, b) => {
|
|
117
|
+
return a[SelectorTimingsKey.MatchAttempts] > b[SelectorTimingsKey.MatchAttempts] ? a : b;
|
|
118
|
+
});
|
|
119
|
+
}
|
|
104
120
|
return finalize({
|
|
105
121
|
// TODO: should we identify UpdateLayout events as linked to this insight?
|
|
106
122
|
relatedEvents: [],
|
|
107
123
|
totalElapsedMs: Types.Timing.Milli(totalElapsedUs / 1000.0),
|
|
108
124
|
totalMatchAttempts,
|
|
109
125
|
totalMatchCount,
|
|
110
|
-
|
|
111
|
-
|
|
126
|
+
topSelectorElapsedMs,
|
|
127
|
+
topSelectorMatchAttempts,
|
|
112
128
|
});
|
|
113
129
|
}
|
|
130
|
+
export function createOverlays(_) {
|
|
131
|
+
return [];
|
|
132
|
+
}
|
|
114
133
|
//# sourceMappingURL=SlowCSSSelector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlowCSSSelector.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/SlowCSSSelector.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AAEnD,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAsB,kBAAkB,EAAC,MAAM,yBAAyB,CAAC;AAChF,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EACL,eAAe,EACf,WAAW,GAIZ,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;;OAEG;IACH,KAAK,EAAE,oBAAoB;IAE3B;;OAEG;IACH,WAAW,EACP,yUAAyU;IAC7U;;OAEG;IACH,aAAa,EAAE,gBAAgB;IAC/B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is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as i18n from '../../../core/i18n/i18n.js';\nimport type * as Handlers from '../handlers/handlers.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport {type SelectorTiming, SelectorTimingsKey} from '../types/TraceEvents.js';\nimport * as Types from '../types/types.js';\n\nimport {\n InsightCategory,\n InsightKeys,\n type InsightModel,\n type InsightSetContext,\n type PartialInsightModel,\n} from './types.js';\n\nexport const UIStrings = {\n /**\n *@description Title of an insight that provides details about slow CSS selectors.\n */\n title: 'CSS Selector costs',\n\n /**\n * @description Text to describe how to improve the performance of CSS selectors.\n */\n description:\n 'If Recalculate Style costs remain high, selector optimization can reduce them. [Optimize the selectors](https://developer.chrome.com/docs/devtools/performance/selector-stats) with both high elapsed time and high slow-path %. Simpler selectors, fewer selectors, a smaller DOM, and a shallower DOM will all reduce matching costs.',\n /**\n *@description Column name for count of elements that the engine attempted to match against a style rule\n */\n matchAttempts: 'Match attempts',\n /**\n *@description Column name for count of elements that matched a style rule\n */\n matchCount: 'Match count',\n /**\n *@description Column name for elapsed time spent computing a style rule\n */\n elapsed: 'Elapsed time',\n /**\n *@description Column name for the selectors that took the longest amount of time/effort.\n */\n topSelectors: 'Top selectors',\n /**\n *@description Column name for a total sum.\n */\n total: 'Total',\n /**\n * @description Text status indicating that no CSS selector data was found.\n */\n enableSelectorData:\n 'No CSS selector data was found. CSS selector stats need to be enabled in the performance panel settings.',\n} as const;\n\nconst str_ = i18n.i18n.registerUIStrings('models/trace/insights/SlowCSSSelector.ts', UIStrings);\nexport const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);\n\nexport type SlowCSSSelectorInsightModel = InsightModel<typeof UIStrings, {\n totalElapsedMs: Types.Timing.Milli,\n totalMatchAttempts: number,\n totalMatchCount: number,\n topElapsedMs: Types.Events.SelectorTiming[],\n topMatchAttempts: Types.Events.SelectorTiming[],\n}>;\n\nfunction aggregateSelectorStats(\n data: Map<Types.Events.UpdateLayoutTree, {\n timings: Types.Events.SelectorTiming[],\n }>,\n context: InsightSetContext): SelectorTiming[] {\n const selectorMap = new Map<String, SelectorTiming>();\n\n for (const [event, value] of data) {\n if (event.args.beginData?.frame !== context.frameId) {\n continue;\n }\n if (!Helpers.Timing.eventIsInBounds(event, context.bounds)) {\n continue;\n }\n for (const timing of value.timings) {\n const key = timing[SelectorTimingsKey.Selector] + '_' + timing[SelectorTimingsKey.StyleSheetId];\n const findTiming = selectorMap.get(key);\n if (findTiming !== undefined) {\n findTiming[SelectorTimingsKey.Elapsed] += timing[SelectorTimingsKey.Elapsed];\n findTiming[SelectorTimingsKey.FastRejectCount] += timing[SelectorTimingsKey.FastRejectCount];\n findTiming[SelectorTimingsKey.MatchAttempts] += timing[SelectorTimingsKey.MatchAttempts];\n findTiming[SelectorTimingsKey.MatchCount] += timing[SelectorTimingsKey.MatchCount];\n } else {\n selectorMap.set(key, {...timing});\n }\n }\n }\n\n return [...selectorMap.values()];\n}\n\nfunction finalize(partialModel: PartialInsightModel<SlowCSSSelectorInsightModel>): SlowCSSSelectorInsightModel {\n return {\n insightKey: InsightKeys.SLOW_CSS_SELECTOR,\n strings: UIStrings,\n title: i18nString(UIStrings.title),\n description: i18nString(UIStrings.description),\n category: InsightCategory.ALL,\n state: partialModel.topElapsedMs.length !== 0 && partialModel.topMatchAttempts.length !== 0 ? 'informative' :\n 'pass',\n ...partialModel,\n };\n}\n\nexport function generateInsight(\n parsedTrace: Handlers.Types.ParsedTrace, context: InsightSetContext): SlowCSSSelectorInsightModel {\n const selectorStatsData = parsedTrace.SelectorStats;\n\n if (!selectorStatsData) {\n throw new Error('no selector stats data');\n }\n\n const selectorTimings = aggregateSelectorStats(selectorStatsData.dataForUpdateLayoutEvent, context);\n\n let totalElapsedUs = 0;\n let totalMatchAttempts = 0;\n let totalMatchCount = 0;\n\n selectorTimings.map(timing => {\n totalElapsedUs += timing[SelectorTimingsKey.Elapsed];\n totalMatchAttempts += timing[SelectorTimingsKey.MatchAttempts];\n totalMatchCount += timing[SelectorTimingsKey.MatchCount];\n });\n\n // sort by elapsed time\n const sortByElapsedMs = [...selectorTimings].sort((a, b) => {\n return b[SelectorTimingsKey.Elapsed] - a[SelectorTimingsKey.Elapsed];\n });\n\n // sort by match attempts\n const sortByMatchAttempts = [...selectorTimings].sort((a, b) => {\n return b[SelectorTimingsKey.MatchAttempts] - a[SelectorTimingsKey.MatchAttempts];\n });\n\n return finalize({\n // TODO: should we identify UpdateLayout events as linked to this insight?\n relatedEvents: [],\n totalElapsedMs: Types.Timing.Milli(totalElapsedUs / 1000.0),\n totalMatchAttempts,\n totalMatchCount,\n topElapsedMs: sortByElapsedMs.slice(0, 3),\n topMatchAttempts: sortByMatchAttempts.slice(0, 3),\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SlowCSSSelector.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/SlowCSSSelector.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AAGnD,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAsB,kBAAkB,EAAC,MAAM,yBAAyB,CAAC;AAChF,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EACL,eAAe,EACf,WAAW,GAIZ,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;;OAEG;IACH,KAAK,EAAE,oBAAoB;IAE3B;;OAEG;IACH,WAAW,EACP,yUAAyU;IAC7U;;OAEG;IACH,aAAa,EAAE,gBAAgB;IAC/B;;OAEG;IACH,UAAU,EAAE,aAAa;IACzB;;OAEG;IACH,OAAO,EAAE,cAAc;IACvB;;OAEG;IACH,YAAY,EAAE,eAAe;IAC7B;;OAEG;IACH,KAAK,EAAE,OAAO;IACd;;OAEG;IACH,kBAAkB,EACd,0GAA0G;IAC9G;;OAEG;IACH,sBAAsB,EA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3D,kBAAkB;QAClB,eAAe;QACf,oBAAoB;QACpB,wBAAwB;KACzB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,CAA8B;IAC3D,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["// Copyright 2024 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 i18n from '../../../core/i18n/i18n.js';\nimport type * as Handlers from '../handlers/handlers.js';\nimport type {SelectorStatsData} from '../handlers/SelectorStatsHandler.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport {type SelectorTiming, SelectorTimingsKey} from '../types/TraceEvents.js';\nimport * as Types from '../types/types.js';\n\nimport {\n InsightCategory,\n InsightKeys,\n type InsightModel,\n type InsightSetContext,\n type PartialInsightModel,\n} from './types.js';\n\nexport const UIStrings = {\n /**\n * @description Title of an insight that provides details about slow CSS selectors.\n */\n title: 'CSS Selector costs',\n\n /**\n * @description Text to describe how to improve the performance of CSS selectors.\n */\n description:\n 'If Recalculate Style costs remain high, selector optimization can reduce them. [Optimize the selectors](https://developer.chrome.com/docs/devtools/performance/selector-stats) with both high elapsed time and high slow-path %. Simpler selectors, fewer selectors, a smaller DOM, and a shallower DOM will all reduce matching costs.',\n /**\n * @description Column name for count of elements that the engine attempted to match against a style rule\n */\n matchAttempts: 'Match attempts',\n /**\n * @description Column name for count of elements that matched a style rule\n */\n matchCount: 'Match count',\n /**\n * @description Column name for elapsed time spent computing a style rule\n */\n elapsed: 'Elapsed time',\n /**\n * @description Column name for the selectors that took the longest amount of time/effort.\n */\n topSelectors: 'Top selectors',\n /**\n * @description Column name for a total sum.\n */\n total: 'Total',\n /**\n * @description Text status indicating that no CSS selector data was found.\n */\n enableSelectorData:\n 'No CSS selector data was found. CSS selector stats need to be enabled in the performance panel settings.',\n /**\n * @description top CSS selector when ranked by elapsed time in ms\n */\n topSelectorElapsedTime: 'Top selector elaspsed time',\n /**\n * @description top CSS selector when ranked by match attempt\n */\n topSelectorMatchAttempt: 'Top selector match attempt',\n} as const;\n\nconst str_ = i18n.i18n.registerUIStrings('models/trace/insights/SlowCSSSelector.ts', UIStrings);\nexport const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);\nconst slowCSSSelectorThreshold = 500; // 500us threshold for slow selectors\n\nexport type SlowCSSSelectorInsightModel = InsightModel<typeof UIStrings, {\n totalElapsedMs: Types.Timing.Milli,\n totalMatchAttempts: number,\n totalMatchCount: number,\n topSelectorElapsedMs: Types.Events.SelectorTiming | null,\n topSelectorMatchAttempts: Types.Events.SelectorTiming | null,\n}>;\n\nfunction aggregateSelectorStats(data: SelectorStatsData, context: InsightSetContext): SelectorTiming[] {\n const selectorMap = new Map<String, SelectorTiming>();\n\n for (const [event, value] of data.dataForUpdateLayoutEvent) {\n if (event.args.beginData?.frame !== context.frameId) {\n continue;\n }\n if (!Helpers.Timing.eventIsInBounds(event, context.bounds)) {\n continue;\n }\n for (const timing of value.timings) {\n const key = timing[SelectorTimingsKey.Selector] + '_' + timing[SelectorTimingsKey.StyleSheetId];\n const findTiming = selectorMap.get(key);\n if (findTiming !== undefined) {\n findTiming[SelectorTimingsKey.Elapsed] += timing[SelectorTimingsKey.Elapsed];\n findTiming[SelectorTimingsKey.FastRejectCount] += timing[SelectorTimingsKey.FastRejectCount];\n findTiming[SelectorTimingsKey.MatchAttempts] += timing[SelectorTimingsKey.MatchAttempts];\n findTiming[SelectorTimingsKey.MatchCount] += timing[SelectorTimingsKey.MatchCount];\n } else {\n selectorMap.set(key, {...timing});\n }\n }\n }\n\n return [...selectorMap.values()];\n}\n\nfunction finalize(partialModel: PartialInsightModel<SlowCSSSelectorInsightModel>): SlowCSSSelectorInsightModel {\n return {\n insightKey: InsightKeys.SLOW_CSS_SELECTOR,\n strings: UIStrings,\n title: i18nString(UIStrings.title),\n description: i18nString(UIStrings.description),\n category: InsightCategory.ALL,\n state: partialModel.topSelectorElapsedMs && partialModel.topSelectorMatchAttempts ? 'informative' : 'pass',\n ...partialModel,\n };\n}\n\nexport function generateInsight(\n parsedTrace: Handlers.Types.ParsedTrace, context: InsightSetContext): SlowCSSSelectorInsightModel {\n const selectorStatsData = parsedTrace.SelectorStats;\n\n if (!selectorStatsData) {\n throw new Error('no selector stats data');\n }\n\n const selectorTimings = aggregateSelectorStats(selectorStatsData, context);\n\n let totalElapsedUs = 0;\n let totalMatchAttempts = 0;\n let totalMatchCount = 0;\n\n selectorTimings.map(timing => {\n totalElapsedUs += timing[SelectorTimingsKey.Elapsed];\n totalMatchAttempts += timing[SelectorTimingsKey.MatchAttempts];\n totalMatchCount += timing[SelectorTimingsKey.MatchCount];\n });\n\n let topSelectorElapsedMs: SelectorTiming|null = null;\n let topSelectorMatchAttempts: SelectorTiming|null = null;\n\n if (selectorTimings.length > 0) {\n // find the selector with most elapsed time\n topSelectorElapsedMs = selectorTimings.reduce((a, b) => {\n return a[SelectorTimingsKey.Elapsed] > b[SelectorTimingsKey.Elapsed] ? a : b;\n });\n\n // check if the slowest selector is slow enough to trigger insights info\n if (topSelectorElapsedMs && topSelectorElapsedMs[SelectorTimingsKey.Elapsed] < slowCSSSelectorThreshold) {\n topSelectorElapsedMs = null;\n }\n\n // find the selector with most match attempts\n topSelectorMatchAttempts = selectorTimings.reduce((a, b) => {\n return a[SelectorTimingsKey.MatchAttempts] > b[SelectorTimingsKey.MatchAttempts] ? a : b;\n });\n }\n\n return finalize({\n // TODO: should we identify UpdateLayout events as linked to this insight?\n relatedEvents: [],\n totalElapsedMs: Types.Timing.Milli(totalElapsedUs / 1000.0),\n totalMatchAttempts,\n totalMatchCount,\n topSelectorElapsedMs,\n topSelectorMatchAttempts,\n });\n}\n\nexport function createOverlays(_: SlowCSSSelectorInsightModel): Types.Overlays.Overlay[] {\n return [];\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as Extras from '../extras/extras.js';
|
|
2
2
|
import * as Handlers from '../handlers/handlers.js';
|
|
3
|
+
import type * as Types from '../types/types.js';
|
|
3
4
|
import { type InsightModel, type InsightSetContext } from './types.js';
|
|
4
5
|
export declare const UIStrings: {
|
|
5
6
|
/** Title of an insight that provides details about the code on a web page that the user doesn't control (referred to as "third-party code"). */
|
|
@@ -27,3 +28,5 @@ export type ThirdPartiesInsightModel = InsightModel<typeof UIStrings, {
|
|
|
27
28
|
firstPartyEntity?: Extras.ThirdParties.Entity;
|
|
28
29
|
}>;
|
|
29
30
|
export declare function generateInsight(parsedTrace: Handlers.Types.ParsedTrace, context: InsightSetContext): ThirdPartiesInsightModel;
|
|
31
|
+
export declare function createOverlaysForSummary(summary: Extras.ThirdParties.EntitySummary): Types.Overlays.Overlay[];
|
|
32
|
+
export declare function createOverlays(model: ThirdPartiesInsightModel): Types.Overlays.Overlay[];
|
|
@@ -61,4 +61,35 @@ export function generateInsight(parsedTrace, context) {
|
|
|
61
61
|
entitySummaries,
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
+
export function createOverlaysForSummary(summary) {
|
|
65
|
+
const overlays = [];
|
|
66
|
+
for (const event of summary.relatedEvents) {
|
|
67
|
+
// The events found for a third party can be vast, as they gather every
|
|
68
|
+
// single main thread task along with everything else on the page. If the
|
|
69
|
+
// main thread is busy with large icicles, we can easily create tens of
|
|
70
|
+
// thousands of overlays. Therefore, only create overlays for events of at least 1ms.
|
|
71
|
+
if (event.dur === undefined || event.dur < 1_000) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
const overlay = {
|
|
75
|
+
type: 'ENTRY_OUTLINE',
|
|
76
|
+
entry: event,
|
|
77
|
+
outlineReason: 'INFO',
|
|
78
|
+
};
|
|
79
|
+
overlays.push(overlay);
|
|
80
|
+
}
|
|
81
|
+
return overlays;
|
|
82
|
+
}
|
|
83
|
+
export function createOverlays(model) {
|
|
84
|
+
const overlays = [];
|
|
85
|
+
const summaries = model.entitySummaries ?? [];
|
|
86
|
+
for (const summary of summaries) {
|
|
87
|
+
if (summary.entity === model.firstPartyEntity) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const summaryOverlays = createOverlaysForSummary(summary);
|
|
91
|
+
overlays.push(...summaryOverlays);
|
|
92
|
+
}
|
|
93
|
+
return overlays;
|
|
94
|
+
}
|
|
64
95
|
//# sourceMappingURL=ThirdParties.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThirdParties.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/ThirdParties.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AACnD,OAAO,KAAK,aAAa,MAAM,yDAAyD,CAAC;AACzF,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EACL,eAAe,EACf,WAAW,GAIZ,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,gJAAgJ;IAChJ,KAAK,EAAE,aAAa;IACpB;;;OAGG;IACH,WAAW,EAAE,4DAA4D;QACrE,0KAA0K;IAC9K,iFAAiF;IACjF,gBAAgB,EAAE,WAAW;IAC7B,4GAA4G;IAC5G,kBAAkB,EAAE,eAAe;IACnC,wJAAwJ;IACxJ,oBAAoB,EAAE,kBAAkB;IACxC;;OAEG;IACH,cAAc,EAAE,wBAAwB;CAChC,CAAC;AAEX,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,uCAAuC,EAAE,SAAS,CAAC,CAAC;AAC7F,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAQ7E,SAAS,gBAAgB,CACrB,SAA8C,EAC9C,gBAAsD;IACxD,MAAM,aAAa,GAAG,EAAE,CAAC;IACzB,KAAK,MAAM,OAAO,IA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AAgB;QAChB,eAAe;KAChB,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright 2024 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 i18n from '../../../core/i18n/i18n.js';\nimport * as ThirdPartyWeb from '../../../third_party/third-party-web/third-party-web.js';\nimport * as Extras from '../extras/extras.js';\nimport * as Handlers from '../handlers/handlers.js';\nimport type * as Types from '../types/types.js';\n\nimport {\n InsightCategory,\n InsightKeys,\n type InsightModel,\n type InsightSetContext,\n type PartialInsightModel,\n} from './types.js';\n\nexport const UIStrings = {\n /** Title of an insight that provides details about the code on a web page that the user doesn't control (referred to as \"third-party code\"). */\n title: '3rd parties',\n /**\n * @description Description of a DevTools insight that identifies the code on the page that the user doesn't control.\n * This is displayed after a user expands the section to see more. No character length limits.\n */\n description: '3rd party code can significantly impact load performance. ' +\n '[Reduce and defer loading of 3rd party code](https://web.dev/articles/optimizing-content-efficiency-loading-third-party-javascript/) to prioritize your page\\'s content.',\n /** Label for a table column that displays the name of a third-party provider. */\n columnThirdParty: '3rd party',\n /** Label for a column in a data table; entries will be the download size of a web resource in kilobytes. */\n columnTransferSize: 'Transfer size',\n /** Label for a table column that displays how much time each row spent running on the main thread, entries will be the number of milliseconds spent. */\n columnMainThreadTime: 'Main thread time',\n /**\n * @description Text block indicating that no third party content was detected on the page\n */\n noThirdParties: 'No third parties found',\n} as const;\n\nconst str_ = i18n.i18n.registerUIStrings('models/trace/insights/ThirdParties.ts', UIStrings);\nexport const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);\n\nexport type ThirdPartiesInsightModel = InsightModel<typeof UIStrings, {\n /** The entity for this navigation's URL. Any other entity is from a third party. */\n entitySummaries: Extras.ThirdParties.EntitySummary[],\n firstPartyEntity?: Extras.ThirdParties.Entity,\n}>;\n\nfunction getRelatedEvents(\n summaries: Extras.ThirdParties.EntitySummary[],\n firstPartyEntity: Extras.ThirdParties.Entity|undefined): Types.Events.Event[] {\n const relatedEvents = [];\n for (const summary of summaries) {\n if (summary.entity !== firstPartyEntity) {\n relatedEvents.push(...summary.relatedEvents);\n }\n }\n\n return relatedEvents;\n}\n\nfunction finalize(partialModel: PartialInsightModel<ThirdPartiesInsightModel>): ThirdPartiesInsightModel {\n return {\n insightKey: InsightKeys.THIRD_PARTIES,\n strings: UIStrings,\n title: i18nString(UIStrings.title),\n description: i18nString(UIStrings.description),\n category: InsightCategory.ALL,\n state: partialModel.entitySummaries.find(summary => summary.entity !== partialModel.firstPartyEntity) ?\n 'informative' :\n 'pass',\n ...partialModel,\n };\n}\n\nexport function generateInsight(\n parsedTrace: Handlers.Types.ParsedTrace, context: InsightSetContext): ThirdPartiesInsightModel {\n const entitySummaries =\n Extras.ThirdParties.summarizeByThirdParty(parsedTrace as Handlers.Types.ParsedTrace, context.bounds);\n\n const firstPartyUrl = context.navigation?.args.data?.documentLoaderURL ?? parsedTrace.Meta.mainFrameURL;\n const firstPartyEntity = ThirdPartyWeb.ThirdPartyWeb.getEntity(firstPartyUrl) ||\n Handlers.Helpers.makeUpEntity(parsedTrace.Renderer.entityMappings.createdEntityCache, firstPartyUrl);\n\n return finalize({\n relatedEvents: getRelatedEvents(entitySummaries, firstPartyEntity),\n firstPartyEntity,\n entitySummaries,\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ThirdParties.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/ThirdParties.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AACnD,OAAO,KAAK,aAAa,MAAM,yDAAyD,CAAC;AACzF,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EACL,eAAe,EACf,WAAW,GAIZ,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG;I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CAAC;IAC9C,MAAM,SAAS,GAAG,KAAK,CAAC,eAAe,IAAI,EAAE,CAAC;IAC9C,KAAK,MAAM,OAAO,IAAI,SAAS,EAAE,CAAC;QAChC,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK,CAAC,gBAAgB,EAAE,CAAC;YAC9C,SAAS;QACX,CAAC;QAED,MAAM,eAAe,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAC;QAC1D,QAAQ,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["// Copyright 2024 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 i18n from '../../../core/i18n/i18n.js';\nimport * as ThirdPartyWeb from '../../../third_party/third-party-web/third-party-web.js';\nimport * as Extras from '../extras/extras.js';\nimport * as Handlers from '../handlers/handlers.js';\nimport type * as Types from '../types/types.js';\n\nimport {\n InsightCategory,\n InsightKeys,\n type InsightModel,\n type InsightSetContext,\n type PartialInsightModel,\n} from './types.js';\n\nexport const UIStrings = {\n /** Title of an insight that provides details about the code on a web page that the user doesn't control (referred to as \"third-party code\"). */\n title: '3rd parties',\n /**\n * @description Description of a DevTools insight that identifies the code on the page that the user doesn't control.\n * This is displayed after a user expands the section to see more. No character length limits.\n */\n description: '3rd party code can significantly impact load performance. ' +\n '[Reduce and defer loading of 3rd party code](https://web.dev/articles/optimizing-content-efficiency-loading-third-party-javascript/) to prioritize your page\\'s content.',\n /** Label for a table column that displays the name of a third-party provider. */\n columnThirdParty: '3rd party',\n /** Label for a column in a data table; entries will be the download size of a web resource in kilobytes. */\n columnTransferSize: 'Transfer size',\n /** Label for a table column that displays how much time each row spent running on the main thread, entries will be the number of milliseconds spent. */\n columnMainThreadTime: 'Main thread time',\n /**\n * @description Text block indicating that no third party content was detected on the page\n */\n noThirdParties: 'No third parties found',\n} as const;\n\nconst str_ = i18n.i18n.registerUIStrings('models/trace/insights/ThirdParties.ts', UIStrings);\nexport const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);\n\nexport type ThirdPartiesInsightModel = InsightModel<typeof UIStrings, {\n /** The entity for this navigation's URL. Any other entity is from a third party. */\n entitySummaries: Extras.ThirdParties.EntitySummary[],\n firstPartyEntity?: Extras.ThirdParties.Entity,\n}>;\n\nfunction getRelatedEvents(\n summaries: Extras.ThirdParties.EntitySummary[],\n firstPartyEntity: Extras.ThirdParties.Entity|undefined): Types.Events.Event[] {\n const relatedEvents = [];\n for (const summary of summaries) {\n if (summary.entity !== firstPartyEntity) {\n relatedEvents.push(...summary.relatedEvents);\n }\n }\n\n return relatedEvents;\n}\n\nfunction finalize(partialModel: PartialInsightModel<ThirdPartiesInsightModel>): ThirdPartiesInsightModel {\n return {\n insightKey: InsightKeys.THIRD_PARTIES,\n strings: UIStrings,\n title: i18nString(UIStrings.title),\n description: i18nString(UIStrings.description),\n category: InsightCategory.ALL,\n state: partialModel.entitySummaries.find(summary => summary.entity !== partialModel.firstPartyEntity) ?\n 'informative' :\n 'pass',\n ...partialModel,\n };\n}\n\nexport function generateInsight(\n parsedTrace: Handlers.Types.ParsedTrace, context: InsightSetContext): ThirdPartiesInsightModel {\n const entitySummaries =\n Extras.ThirdParties.summarizeByThirdParty(parsedTrace as Handlers.Types.ParsedTrace, context.bounds);\n\n const firstPartyUrl = context.navigation?.args.data?.documentLoaderURL ?? parsedTrace.Meta.mainFrameURL;\n const firstPartyEntity = ThirdPartyWeb.ThirdPartyWeb.getEntity(firstPartyUrl) ||\n Handlers.Helpers.makeUpEntity(parsedTrace.Renderer.entityMappings.createdEntityCache, firstPartyUrl);\n\n return finalize({\n relatedEvents: getRelatedEvents(entitySummaries, firstPartyEntity),\n firstPartyEntity,\n entitySummaries,\n });\n}\n\nexport function createOverlaysForSummary(summary: Extras.ThirdParties.EntitySummary): Types.Overlays.Overlay[] {\n const overlays = [];\n for (const event of summary.relatedEvents) {\n // The events found for a third party can be vast, as they gather every\n // single main thread task along with everything else on the page. If the\n // main thread is busy with large icicles, we can easily create tens of\n // thousands of overlays. Therefore, only create overlays for events of at least 1ms.\n if (event.dur === undefined || event.dur < 1_000) {\n continue;\n }\n\n const overlay: Types.Overlays.Overlay = {\n type: 'ENTRY_OUTLINE',\n entry: event,\n outlineReason: 'INFO',\n };\n overlays.push(overlay);\n }\n return overlays;\n}\n\nexport function createOverlays(model: ThirdPartiesInsightModel): Types.Overlays.Overlay[] {\n const overlays: Types.Overlays.Overlay[] = [];\n const summaries = model.entitySummaries ?? [];\n for (const summary of summaries) {\n if (summary.entity === model.firstPartyEntity) {\n continue;\n }\n\n const summaryOverlays = createOverlaysForSummary(summary);\n overlays.push(...summaryOverlays);\n }\n\n return overlays;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Platform from '../../../core/platform/platform.js';
|
|
2
2
|
import * as Handlers from '../handlers/handlers.js';
|
|
3
|
-
import
|
|
3
|
+
import * as Types from '../types/types.js';
|
|
4
4
|
import { type InsightModel, type InsightSetContext } from './types.js';
|
|
5
5
|
export declare const UIStrings: {
|
|
6
6
|
/** Title of an insight that provides details about if the page's viewport is optimized for mobile viewing. */
|
|
@@ -21,3 +21,4 @@ export type ViewportInsightModel = InsightModel<typeof UIStrings, {
|
|
|
21
21
|
longPointerInteractions?: Types.Events.SyntheticInteractionPair[];
|
|
22
22
|
}>;
|
|
23
23
|
export declare function generateInsight(parsedTrace: Handlers.Types.ParsedTrace, context: InsightSetContext): ViewportInsightModel;
|
|
24
|
+
export declare function createOverlays(model: ViewportInsightModel): Types.Overlays.Overlay[];
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as Platform from '../../../core/platform/platform.js';
|
|
6
6
|
import * as Handlers from '../handlers/handlers.js';
|
|
7
7
|
import * as Helpers from '../helpers/helpers.js';
|
|
8
|
+
import * as Types from '../types/types.js';
|
|
8
9
|
import { InsightCategory, InsightKeys, InsightWarning, } from './types.js';
|
|
9
10
|
export const UIStrings = {
|
|
10
11
|
/** Title of an insight that provides details about if the page's viewport is optimized for mobile viewing. */
|
|
@@ -80,4 +81,19 @@ export function generateInsight(parsedTrace, context) {
|
|
|
80
81
|
viewportEvent,
|
|
81
82
|
});
|
|
82
83
|
}
|
|
84
|
+
export function createOverlays(model) {
|
|
85
|
+
if (!model.longPointerInteractions) {
|
|
86
|
+
return [];
|
|
87
|
+
}
|
|
88
|
+
return model.longPointerInteractions.map(interaction => {
|
|
89
|
+
const delay = Math.min(interaction.inputDelay, 300 * 1000);
|
|
90
|
+
const bounds = Helpers.Timing.traceWindowFromMicroSeconds(Types.Timing.Micro(interaction.ts), Types.Timing.Micro(interaction.ts + delay));
|
|
91
|
+
return {
|
|
92
|
+
type: 'TIMESPAN_BREAKDOWN',
|
|
93
|
+
entry: interaction,
|
|
94
|
+
sections: [{ bounds, label: i18nString(UIStrings.mobileTapDelayLabel), showDuration: true }],
|
|
95
|
+
renderLocation: 'ABOVE_EVENT',
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
}
|
|
83
99
|
//# sourceMappingURL=Viewport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Viewport.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/Viewport.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AACnD,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"Viewport.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/Viewport.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AACn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CAAC,mBAAmB,CAAC,EAAE,YAAY,EAAE,IAAI,EAAC,CAAC;YAC1F,cAAc,EAAE,aAAa;SAC9B,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright 2024 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 i18n from '../../../core/i18n/i18n.js';\nimport * as Platform from '../../../core/platform/platform.js';\nimport * as Handlers from '../handlers/handlers.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport {\n InsightCategory,\n InsightKeys,\n type InsightModel,\n type InsightSetContext,\n InsightWarning,\n type PartialInsightModel,\n} from './types.js';\n\nexport const UIStrings = {\n /** Title of an insight that provides details about if the page's viewport is optimized for mobile viewing. */\n title: 'Optimize viewport for mobile',\n /**\n * @description Text to tell the user how a viewport meta element can improve performance. \\xa0 is a non-breaking space\n */\n description:\n 'Tap interactions may be [delayed by up to 300\\xA0ms](https://developer.chrome.com/blog/300ms-tap-delay-gone-away/) if the viewport is not optimized for mobile.',\n /**\n * @description Text for a label describing the portion of an interaction event that was delayed due to a bad mobile viewport.\n */\n mobileTapDelayLabel: 'Mobile tap delay',\n} as const;\n\nconst str_ = i18n.i18n.registerUIStrings('models/trace/insights/Viewport.ts', UIStrings);\nexport const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);\n\nexport type ViewportInsightModel = InsightModel<typeof UIStrings, {\n mobileOptimized: boolean | null,\n viewportEvent?: Types.Events.ParseMetaViewport,\n longPointerInteractions?: Types.Events.SyntheticInteractionPair[],\n}>;\n\nfunction finalize(partialModel: PartialInsightModel<ViewportInsightModel>): ViewportInsightModel {\n return {\n insightKey: InsightKeys.VIEWPORT,\n strings: UIStrings,\n title: i18nString(UIStrings.title),\n description: i18nString(UIStrings.description),\n category: InsightCategory.INP,\n state: partialModel.mobileOptimized === false ? 'fail' : 'pass',\n ...partialModel,\n };\n}\n\nexport function generateInsight(\n parsedTrace: Handlers.Types.ParsedTrace, context: InsightSetContext): ViewportInsightModel {\n const viewportEvent = parsedTrace.UserInteractions.parseMetaViewportEvents.find(event => {\n if (event.args.data.frame !== context.frameId) {\n return false;\n }\n\n return Helpers.Timing.eventIsInBounds(event, context.bounds);\n });\n\n const compositorEvents = parsedTrace.UserInteractions.beginCommitCompositorFrameEvents.filter(event => {\n if (event.args.frame !== context.frameId) {\n return false;\n }\n\n // Commit compositor frame events can be emitted before the viewport tag is parsed.\n // We shouldn't count these since the browser hasn't had time to make the viewport mobile optimized.\n if (viewportEvent && event.ts < viewportEvent.ts) {\n return false;\n }\n\n return Helpers.Timing.eventIsInBounds(event, context.bounds);\n });\n\n if (!compositorEvents.length) {\n // Trace doesn't have the data we need.\n return finalize({\n mobileOptimized: null,\n warnings: [InsightWarning.NO_LAYOUT],\n });\n }\n\n // Returns true only if all events are mobile optimized.\n for (const event of compositorEvents) {\n if (!event.args.is_mobile_optimized) {\n // Grab all the pointer events with at least 50ms of input delay.\n const longPointerInteractions = [...parsedTrace.UserInteractions.interactionsOverThreshold.values()].filter(\n interaction => Handlers.ModelHandlers.UserInteractions.categoryOfInteraction(interaction) === 'POINTER' &&\n interaction.inputDelay >= 50_000);\n\n // The actual impact varies between 0 and 300.\n // Using inputDelay as the closest thing we have for measuring this, though inputDelay may be high for other reasons.\n // b/371566378#comment8\n const inputDelay = Math.max(0, ...longPointerInteractions.map(interaction => interaction.inputDelay)) / 1000;\n const inpMetricSavings = Platform.NumberUtilities.clamp(inputDelay, 0, 300);\n\n return finalize({\n mobileOptimized: false,\n viewportEvent,\n longPointerInteractions,\n metricSavings: {INP: inpMetricSavings as Types.Timing.Milli},\n });\n }\n }\n\n return finalize({\n mobileOptimized: true,\n viewportEvent,\n });\n}\n\nexport function createOverlays(model: ViewportInsightModel): Types.Overlays.Overlay[] {\n if (!model.longPointerInteractions) {\n return [];\n }\n\n return model.longPointerInteractions.map(interaction => {\n const delay = Math.min(interaction.inputDelay, 300 * 1000);\n const bounds = Helpers.Timing.traceWindowFromMicroSeconds(\n Types.Timing.Micro(interaction.ts),\n Types.Timing.Micro(interaction.ts + delay),\n );\n return {\n type: 'TIMESPAN_BREAKDOWN',\n entry: interaction,\n sections: [{bounds, label: i18nString(UIStrings.mobileTapDelayLabel), showDuration: true}],\n renderLocation: 'ABOVE_EVENT',\n };\n });\n}\n"]}
|
|
@@ -76,6 +76,8 @@ export type InsightModel<UIStrings extends Record<string, string> = Record<strin
|
|
|
76
76
|
* If this insight is attached to a navigation, this stores its ID.
|
|
77
77
|
*/
|
|
78
78
|
navigationId?: string;
|
|
79
|
+
/** This is lazily-generated because some insights may create many overlays. */
|
|
80
|
+
createOverlays?: () => Types.Overlays.Overlay[];
|
|
79
81
|
};
|
|
80
82
|
export type PartialInsightModel<T> = Omit<T, 'strings' | 'title' | 'description' | 'category' | 'state' | 'insightKey' | 'navigationId' | 'frameId'>;
|
|
81
83
|
/**
|
|
@@ -122,5 +124,6 @@ export declare enum InsightKeys {
|
|
|
122
124
|
NETWORK_DEPENDENCY_TREE = "NetworkDependencyTree",
|
|
123
125
|
RENDER_BLOCKING = "RenderBlocking",
|
|
124
126
|
SLOW_CSS_SELECTOR = "SlowCSSSelector",
|
|
125
|
-
VIEWPORT = "Viewport"
|
|
127
|
+
VIEWPORT = "Viewport",
|
|
128
|
+
MODERN_HTTP = "ModernHTTP"
|
|
126
129
|
}
|
|
@@ -34,5 +34,6 @@ export var InsightKeys;
|
|
|
34
34
|
InsightKeys["RENDER_BLOCKING"] = "RenderBlocking";
|
|
35
35
|
InsightKeys["SLOW_CSS_SELECTOR"] = "SlowCSSSelector";
|
|
36
36
|
InsightKeys["VIEWPORT"] = "Viewport";
|
|
37
|
+
InsightKeys["MODERN_HTTP"] = "ModernHTTP";
|
|
37
38
|
})(InsightKeys || (InsightKeys = {}));
|
|
38
39
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/types.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAoC7B,MAAM,CAAN,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,iCAAe,CAAA;IACf,mCAAiB,CAAA;IACjB,uEAAuE;IACvE,6DAA2C,CAAA;IAC3C,yCAAuB,CAAA;AACzB,CAAC,EANW,cAAc,KAAd,cAAc,QAMzB;AAYD,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,8BAAW,CAAA;IACX,8BAAW,CAAA;IACX,8BAAW,CAAA;IACX,8BAAW,CAAA;AACb,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/types.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAoC7B,MAAM,CAAN,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,iCAAe,CAAA;IACf,mCAAiB,CAAA;IACjB,uEAAuE;IACvE,6DAA2C,CAAA;IAC3C,yCAAuB,CAAA;AACzB,CAAC,EANW,cAAc,KAAd,cAAc,QAMzB;AAYD,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,8BAAW,CAAA;IACX,8BAAW,CAAA;IACX,8BAAW,CAAA;IACX,8BAAW,CAAA;AACb,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B;AAyED,MAAM,CAAN,IAAY,WAkBX;AAlBD,WAAY,WAAW;IACrB,6CAA8B,CAAA;IAC9B,6CAA8B,CAAA;IAC9B,2CAA4B,CAAA;IAC5B,6CAA8B,CAAA;IAC9B,mDAAoC,CAAA;IACpC,mCAAoB,CAAA;IACpB,4DAA6C,CAAA;IAC7C,2CAA4B,CAAA;IAC5B,6CAA8B,CAAA;IAC9B,+CAAgC,CAAA;IAChC,6CAA8B,CAAA;IAC9B,qDAAsC,CAAA;IACtC,gEAAiD,CAAA;IACjD,iDAAkC,CAAA;IAClC,oDAAqC,CAAA;IACrC,oCAAqB,CAAA;IACrB,yCAA0B,CAAA;AAC5B,CAAC,EAlBW,WAAW,KAAX,WAAW,QAkBtB","sourcesContent":["// Copyright 2024 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 type * as Common from '../../../core/common/common.js';\nimport type * as Lantern from '../lantern/lantern.js';\nimport type * as Types from '../types/types.js';\n\nimport type * as Models from './Models.js';\n\n/**\n * Context for the portion of the trace an insight should look at.\n */\nexport type InsightSetContext = InsightSetContextWithoutNavigation|InsightSetContextWithNavigation;\n\nexport interface InsightSetContextWithoutNavigation {\n bounds: Types.Timing.TraceWindowMicro;\n frameId: string;\n navigation?: never;\n}\n\nexport interface InsightSetContextWithNavigation {\n bounds: Types.Timing.TraceWindowMicro;\n frameId: string;\n navigation: Types.Events.NavigationStart;\n navigationId: string;\n lantern?: LanternContext;\n}\n\nexport interface LanternContext {\n requests: Array<Lantern.Types.NetworkRequest<Types.Events.SyntheticNetworkRequest>>;\n graph: Lantern.Graph.Node<Types.Events.SyntheticNetworkRequest>;\n simulator: Lantern.Simulation.Simulator<Types.Events.SyntheticNetworkRequest>;\n metrics: Record<string, Lantern.Metrics.MetricResult>;\n}\n\nexport type InsightModelsType = typeof Models;\n\nexport enum InsightWarning {\n NO_FP = 'NO_FP',\n NO_LCP = 'NO_LCP',\n // No network request could be identified as the primary HTML document.\n NO_DOCUMENT_REQUEST = 'NO_DOCUMENT_REQUEST',\n NO_LAYOUT = 'NO_LAYOUT',\n}\n\nexport interface MetricSavings {\n /* eslint-disable @typescript-eslint/naming-convention */\n FCP?: Types.Timing.Milli;\n LCP?: Types.Timing.Milli;\n TBT?: Types.Timing.Milli;\n CLS?: number;\n INP?: Types.Timing.Milli;\n /* eslint-enable @typescript-eslint/naming-convention */\n}\n\nexport enum InsightCategory {\n ALL = 'All',\n INP = 'INP',\n LCP = 'LCP',\n CLS = 'CLS',\n}\n\nexport type RelatedEventsMap = Map<Types.Events.Event, string[]>;\n\nexport type Checklist<Keys extends string> = Record<Keys, {label: Common.UIString.LocalizedString, value: boolean}>;\n\nexport type InsightModel<UIStrings extends Record<string, string> = Record<string, string>,\n ExtraDetail extends Record<string, unknown> = Record<string, unknown>> =\n ExtraDetail&{\n /** Used internally to identify the type of a model, not shown visibly to users **/\n insightKey: keyof InsightModelsType,\n /** Not used within DevTools - this is for external consumers (like Lighthouse). */\n strings: UIStrings,\n title: Common.UIString.LocalizedString,\n description: Common.UIString.LocalizedString,\n category: InsightCategory,\n state: 'pass' | 'fail' | 'informative',\n /** Used by RelatedInsightChips.ts */\n relatedEvents?: RelatedEventsMap | Types.Events.Event[],\n warnings?: InsightWarning[],\n metricSavings?: MetricSavings,\n /**\n * An estimate for the number of bytes that this insight deems to have been wasted.\n * Bytes are in terms of transfer size: for each component of savings related to an\n * individual request, the insight will estimate its impact on transfer size by using\n * the compression ratio of the resource.\n *\n * This field is only displayed for informational purposes.\n */\n wastedBytes?: number,\n frameId?: string,\n /**\n * If this insight is attached to a navigation, this stores its ID.\n */\n navigationId?: string,\n /** This is lazily-generated because some insights may create many overlays. */\n createOverlays?: () => Types.Overlays.Overlay[],\n };\n\nexport type PartialInsightModel<T> =\n Omit<T, 'strings'|'title'|'description'|'category'|'state'|'insightKey'|'navigationId'|'frameId'>;\n\n/**\n * Contains insights for a specific navigation. If a trace began after a navigation already started,\n * this could instead represent the duration from the beginning of the trace up to the first recorded\n * navigation (or the end of the trace).\n */\nexport interface InsightSet {\n /** If for a navigation, this is the navigationId. Else it is Trace.Types.Events.NO_NAVIGATION. */\n id: Types.Events.NavigationId;\n /** The URL to show in the accordion list. */\n url: URL;\n frameId: string;\n bounds: Types.Timing.TraceWindowMicro;\n model: InsightModels;\n navigation?: Types.Events.NavigationStart;\n}\n\n/**\n * Contains insights for a specific insight set.\n */\nexport type InsightModels = {\n [I in keyof InsightModelsType]: ReturnType<InsightModelsType[I]['generateInsight']>;\n};\n\n/**\n * Contains insights for the entire trace. Insights are mostly grouped by `navigationId`, with one exception:\n *\n * If the analyzed trace started after the navigation, and has meaningful work with that span, there is no\n * navigation to map it to. In this case `Types.Events.NO_NAVIGATION` is used for the key.\n */\nexport type TraceInsightSets = Map<Types.Events.NavigationId, InsightSet>;\n\nexport enum InsightKeys {\n LCP_BREAKDOWN = 'LCPBreakdown',\n INP_BREAKDOWN = 'INPBreakdown',\n CLS_CULPRITS = 'CLSCulprits',\n THIRD_PARTIES = 'ThirdParties',\n DOCUMENT_LATENCY = 'DocumentLatency',\n DOM_SIZE = 'DOMSize',\n DUPLICATE_JAVASCRIPT = 'DuplicatedJavaScript',\n FONT_DISPLAY = 'FontDisplay',\n FORCED_REFLOW = 'ForcedReflow',\n IMAGE_DELIVERY = 'ImageDelivery',\n LCP_DISCOVERY = 'LCPDiscovery',\n LEGACY_JAVASCRIPT = 'LegacyJavaScript',\n NETWORK_DEPENDENCY_TREE = 'NetworkDependencyTree',\n RENDER_BLOCKING = 'RenderBlocking',\n SLOW_CSS_SELECTOR = 'SlowCSSSelector',\n VIEWPORT = 'Viewport',\n MODERN_HTTP = 'ModernHTTP',\n}\n"]}
|
|
@@ -7,7 +7,7 @@ import type { NetworkNode } from './NetworkNode.js';
|
|
|
7
7
|
*/
|
|
8
8
|
export type Node<T = Lantern.AnyNetworkObject> = CPUNode<T> | NetworkNode<T>;
|
|
9
9
|
/**
|
|
10
|
-
* @
|
|
10
|
+
* @file This class encapsulates logic for handling resources and tasks used to model the
|
|
11
11
|
* execution dependency graph of the page. A node has a unique identifier and can depend on other
|
|
12
12
|
* nodes/be depended on. The construction of the graph maintains some important invariants that are
|
|
13
13
|
* inherent to the model:
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
import * as Core from '../core/core.js';
|
|
5
5
|
/**
|
|
6
|
-
* @
|
|
6
|
+
* @file This class encapsulates logic for handling resources and tasks used to model the
|
|
7
7
|
* execution dependency graph of the page. A node has a unique identifier and can depend on other
|
|
8
8
|
* nodes/be depended on. The construction of the graph maintains some important invariants that are
|
|
9
9
|
* inherent to the model:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseNode.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/graph/BaseNode.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAYxC;;;;;;;;;;;GAWG;AAEH,MAAM,QAAQ;IACZ,MAAM,CAAC,KAAK,GAAG;QACb,OAAO,EAAE,SAAS;QAClB,GAAG,EAAE,KAAK;KACF,CAAC;IAEX,GAAG,CAAS;IACZ,eAAe,CAAU;IACzB,UAAU,CAAS;IACnB,YAAY,CAAS;IAErB,YAAY,EAAU;QACpB,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;IACzB,CAAC;IAED,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAED,IAAI,IAAI;QACN,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACT,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IAC/C,CAAC;IAED,iBAAiB,CAAC,KAAc;QAC9B,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;IAC/B,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,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,CAAC;YACpB,CAAC;YAED,gFAAgF;YAChF,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YACzB,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAE9B,iDAAiD;YACjD,MAAM,cAAc,GAAG,SAAS,KAAK,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC;YACtG,KAAK,MAAM,QAAQ,IAAI,cAAc,EAAE,CAAC;gBACtC,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;oBAC/B,SAAS;gBACX,CAAC;gBACD,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACvB,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,WAAW,CAAC,IAAU;QACpB,OAAO,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC;IAC1C,CAAC;;AAGH,OAAO,EAAC,QAAQ,EAAC,CAAC","sourcesContent":["// Copyright 2024 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 Core from '../core/core.js';\nimport type * as Lantern from '../types/types.js';\n\nimport type {CPUNode} from './CPUNode.js';\nimport type {NetworkNode} from './NetworkNode.js';\n\n/**\n * A union of all types derived from BaseNode, allowing type check discrimination\n * based on `node.type`. If a new node type is created, it should be added here.\n */\nexport type Node<T = Lantern.AnyNetworkObject> = CPUNode<T>|NetworkNode<T>;\n\n/**\n * @fileoverview This class encapsulates logic for handling resources and tasks used to model the\n * execution dependency graph of the page. A node has a unique identifier and can depend on other\n * nodes/be depended on. The construction of the graph maintains some important invariants that are\n * inherent to the model:\n *\n * 1. The graph is a DAG, there are no cycles.\n * 2. There is always a root node upon which all other nodes eventually depend.\n *\n * This allows particular optimizations in this class so that we do no need to check for cycles as\n * these methods are called and we can always start traversal at the root node.\n */\n\nclass BaseNode<T = Lantern.AnyNetworkObject> {\n static types = {\n NETWORK: 'network',\n CPU: 'cpu',\n } as const;\n\n _id: string;\n _isMainDocument: boolean;\n dependents: Node[];\n dependencies: Node[];\n\n constructor(id: string) {\n this._id = id;\n this._isMainDocument = false;\n this.dependents = [];\n this.dependencies = [];\n }\n\n get id(): string {\n return this._id;\n }\n\n get type(): 'network'|'cpu' {\n throw new Core.LanternError('Unimplemented');\n }\n\n /**\n * In microseconds\n */\n get startTime(): number {\n throw new Core.LanternError('Unimplemented');\n }\n\n /**\n * In microseconds\n */\n get endTime(): number {\n throw new Core.LanternError('Unimplemented');\n }\n\n setIsMainDocument(value: boolean): void {\n this._isMainDocument = value;\n }\n\n isMainDocument(): boolean {\n return this._isMainDocument;\n }\n\n getDependents(): Node[] {\n return this.dependents.slice();\n }\n\n getNumberOfDependents(): number {\n return this.dependents.length;\n }\n\n getDependencies(): Node[] {\n return this.dependencies.slice();\n }\n\n getNumberOfDependencies(): number {\n return this.dependencies.length;\n }\n\n getRootNode(): Node<T> {\n let rootNode = this as BaseNode as Node;\n while (rootNode.dependencies.length) {\n rootNode = rootNode.dependencies[0];\n }\n\n return rootNode;\n }\n\n addDependent(node: Node): void {\n node.addDependency(this as BaseNode as Node);\n }\n\n addDependency(node: Node): void {\n // @ts-expect-error - in checkJs, ts doesn't know that CPUNode and NetworkNode *are* BaseNodes.\n if (node === this) {\n throw new Core.LanternError('Cannot add dependency on itself');\n }\n\n if (this.dependencies.includes(node)) {\n return;\n }\n\n node.dependents.push(this as BaseNode as Node);\n this.dependencies.push(node);\n }\n\n removeDependent(node: Node): void {\n node.removeDependency(this as BaseNode as Node);\n }\n\n removeDependency(node: Node): void {\n if (!this.dependencies.includes(node)) {\n return;\n }\n\n const thisIndex = node.dependents.indexOf(this as BaseNode as Node);\n node.dependents.splice(thisIndex, 1);\n this.dependencies.splice(this.dependencies.indexOf(node), 1);\n }\n\n // Unused in devtools, but used in LH.\n removeAllDependencies(): void {\n for (const node of this.dependencies.slice()) {\n this.removeDependency(node);\n }\n }\n\n /**\n * Computes whether the given node is anywhere in the dependency graph of this node.\n * While this method can prevent cycles, it walks the graph and should be used sparingly.\n * Nodes are always considered dependent on themselves for the purposes of cycle detection.\n */\n isDependentOn(node: BaseNode<T>): boolean {\n let isDependentOnNode = false;\n this.traverse(\n currentNode => {\n if (isDependentOnNode) {\n return;\n }\n isDependentOnNode = currentNode === node;\n },\n currentNode => {\n // If we've already found the dependency, don't traverse further.\n if (isDependentOnNode) {\n return [];\n }\n // Otherwise, traverse the dependencies.\n return currentNode.getDependencies();\n });\n\n return isDependentOnNode;\n }\n\n /**\n * Clones the node's information without adding any dependencies/dependents.\n */\n cloneWithoutRelationships(): Node<T> {\n const node = new BaseNode(this.id) as Node<T>;\n node.setIsMainDocument(this._isMainDocument);\n return node;\n }\n\n /**\n * Clones the entire graph connected to this node filtered by the optional predicate. If a node is\n * included by the predicate, all nodes along the paths between the node and the root will be included. If the\n * node this was called on is not included in the resulting filtered graph, the method will throw.\n *\n * This does not clone NetworkNode's `record` or `rawRecord` fields. It may be reasonable to clone the former,\n * to assist in graph construction, but the latter should never be cloned as one constraint of Lantern is that\n * the underlying data records are accessible for plain object reference equality checks.\n */\n cloneWithRelationships(predicate?: (arg0: Node) => boolean): Node {\n const rootNode = this.getRootNode();\n\n const idsToIncludedClones = new Map<string, Node>();\n\n // Walk down dependents.\n rootNode.traverse(node => {\n if (idsToIncludedClones.has(node.id)) {\n return;\n }\n\n if (predicate === undefined) {\n // No condition for entry, so clone every node.\n idsToIncludedClones.set(node.id, node.cloneWithoutRelationships());\n return;\n }\n\n if (predicate(node)) {\n // Node included, so walk back up dependencies, cloning nodes from here back to the root.\n node.traverse(\n node => idsToIncludedClones.set(node.id, node.cloneWithoutRelationships()),\n // Dependencies already cloned have already cloned ancestors, so no need to visit again.\n node => node.dependencies.filter(parent => !idsToIncludedClones.has(parent.id)),\n );\n }\n });\n\n // Copy dependencies between nodes.\n rootNode.traverse(originalNode => {\n const clonedNode = idsToIncludedClones.get(originalNode.id);\n if (!clonedNode) {\n return;\n }\n\n for (const dependency of originalNode.dependencies) {\n const clonedDependency = idsToIncludedClones.get(dependency.id);\n if (!clonedDependency) {\n throw new Core.LanternError('Dependency somehow not cloned');\n }\n clonedNode.addDependency(clonedDependency);\n }\n });\n\n const clonedThisNode = idsToIncludedClones.get(this.id);\n if (!clonedThisNode) {\n throw new Core.LanternError('Cloned graph missing node');\n }\n return clonedThisNode;\n }\n\n /**\n * Traverses all connected nodes in BFS order, calling `callback` exactly once\n * on each. `traversalPath` is the shortest (though not necessarily unique)\n * path from `node` to the root of the iteration.\n *\n * The `getNextNodes` function takes a visited node and returns which nodes to\n * visit next. It defaults to returning the node's dependents.\n */\n traverse(\n callback: (node: Node<T>, traversalPath: Array<Node<T>>) => void,\n getNextNodes?: (arg0: Node<T>) => Array<Node<T>>): void {\n for (const {node, traversalPath} of this.traverseGenerator(getNextNodes)) {\n callback(node, traversalPath);\n }\n }\n\n /**\n * @see BaseNode.traverse\n */\n // clang-format off\n *traverseGenerator(getNextNodes?: (arg0: Node) => Node[]):\n Generator<{node: Node, traversalPath: Node[]}, void, unknown> {\n // clang-format on\n if (!getNextNodes) {\n getNextNodes = node => node.getDependents();\n }\n\n // @ts-expect-error - only traverses graphs of Node, so force tsc to treat `this` as one\n const queue: Node[][] = [[this]];\n const visited = new Set([this.id]);\n\n while (queue.length) {\n // @ts-expect-error - queue has length so it's guaranteed to have an item\n const traversalPath: Node[] = queue.shift();\n const node = traversalPath[0];\n yield {node, traversalPath};\n\n for (const nextNode of getNextNodes(node)) {\n if (visited.has(nextNode.id)) {\n continue;\n }\n visited.add(nextNode.id);\n\n queue.push([nextNode, ...traversalPath]);\n }\n }\n }\n\n /**\n * If the given node has a cycle, returns a path representing that cycle.\n * Else returns null.\n *\n * Does a DFS on in its dependent graph.\n */\n static findCycle(node: Node, direction: 'dependents'|'dependencies'|'both' = 'both'): BaseNode[]|null {\n // Checking 'both' is the default entrypoint to recursively check both directions\n if (direction === 'both') {\n return BaseNode.findCycle(node, 'dependents') || BaseNode.findCycle(node, 'dependencies');\n }\n\n const visited = new Set();\n const currentPath: BaseNode[] = [];\n const toVisit = [node];\n const depthAdded = new Map([[node, 0]]);\n\n // Keep going while we have nodes to visit in the stack\n while (toVisit.length) {\n // Get the last node in the stack (DFS uses stack, not queue)\n // @ts-expect-error - toVisit has length so it's guaranteed to have an item\n const currentNode: BaseNode = toVisit.pop();\n\n // We've hit a cycle if the node we're visiting is in our current dependency path\n if (currentPath.includes(currentNode)) {\n return currentPath;\n }\n // If we've already visited the node, no need to revisit it\n if (visited.has(currentNode)) {\n continue;\n }\n\n // Since we're visiting this node, clear out any nodes in our path that we had to backtrack\n // @ts-expect-error\n while (currentPath.length > depthAdded.get(currentNode)) {\n currentPath.pop();\n }\n\n // Update our data structures to reflect that we're adding this node to our path\n visited.add(currentNode);\n currentPath.push(currentNode);\n\n // Add all of its dependents to our toVisit stack\n const nodesToExplore = direction === 'dependents' ? currentNode.dependents : currentNode.dependencies;\n for (const nextNode of nodesToExplore) {\n if (toVisit.includes(nextNode)) {\n continue;\n }\n toVisit.push(nextNode);\n depthAdded.set(nextNode, currentPath.length);\n }\n }\n\n return null;\n }\n\n canDependOn(node: Node): boolean {\n return node.startTime <= this.startTime;\n }\n}\n\nexport {BaseNode};\n"]}
|
|
1
|
+
{"version":3,"file":"BaseNode.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/graph/BaseNode.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAYxC;;;;;;;;;;;GAWG;AAEH,MAAM,QAAQ;IACZ,MAAM,CAAC,KAAK,GAAG;QACb,OAAO,EAAE,SAAS;QAClB,GAAG,EAAE,KAAK;KACF,CAAC;IAEX,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U,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,WAAW,CAAC,IAAU;QACpB,OAAO,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC;IAC1C,CAAC;;AAGH,OAAO,EAAC,QAAQ,EAAC,CAAC","sourcesContent":["// Copyright 2024 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 Core from '../core/core.js';\nimport type * as Lantern from '../types/types.js';\n\nimport type {CPUNode} from './CPUNode.js';\nimport type {NetworkNode} from './NetworkNode.js';\n\n/**\n * A union of all types derived from BaseNode, allowing type check discrimination\n * based on `node.type`. If a new node type is created, it should be added here.\n */\nexport type Node<T = Lantern.AnyNetworkObject> = CPUNode<T>|NetworkNode<T>;\n\n/**\n * @file This class encapsulates logic for handling resources and tasks used to model the\n * execution dependency graph of the page. A node has a unique identifier and can depend on other\n * nodes/be depended on. The construction of the graph maintains some important invariants that are\n * inherent to the model:\n *\n * 1. The graph is a DAG, there are no cycles.\n * 2. There is always a root node upon which all other nodes eventually depend.\n *\n * This allows particular optimizations in this class so that we do no need to check for cycles as\n * these methods are called and we can always start traversal at the root node.\n */\n\nclass BaseNode<T = Lantern.AnyNetworkObject> {\n static types = {\n NETWORK: 'network',\n CPU: 'cpu',\n } as const;\n\n _id: string;\n _isMainDocument: boolean;\n dependents: Node[];\n dependencies: Node[];\n\n constructor(id: string) {\n this._id = id;\n this._isMainDocument = false;\n this.dependents = [];\n this.dependencies = [];\n }\n\n get id(): string {\n return this._id;\n }\n\n get type(): 'network'|'cpu' {\n throw new Core.LanternError('Unimplemented');\n }\n\n /**\n * In microseconds\n */\n get startTime(): number {\n throw new Core.LanternError('Unimplemented');\n }\n\n /**\n * In microseconds\n */\n get endTime(): number {\n throw new Core.LanternError('Unimplemented');\n }\n\n setIsMainDocument(value: boolean): void {\n this._isMainDocument = value;\n }\n\n isMainDocument(): boolean {\n return this._isMainDocument;\n }\n\n getDependents(): Node[] {\n return this.dependents.slice();\n }\n\n getNumberOfDependents(): number {\n return this.dependents.length;\n }\n\n getDependencies(): Node[] {\n return this.dependencies.slice();\n }\n\n getNumberOfDependencies(): number {\n return this.dependencies.length;\n }\n\n getRootNode(): Node<T> {\n let rootNode = this as BaseNode as Node;\n while (rootNode.dependencies.length) {\n rootNode = rootNode.dependencies[0];\n }\n\n return rootNode;\n }\n\n addDependent(node: Node): void {\n node.addDependency(this as BaseNode as Node);\n }\n\n addDependency(node: Node): void {\n // @ts-expect-error - in checkJs, ts doesn't know that CPUNode and NetworkNode *are* BaseNodes.\n if (node === this) {\n throw new Core.LanternError('Cannot add dependency on itself');\n }\n\n if (this.dependencies.includes(node)) {\n return;\n }\n\n node.dependents.push(this as BaseNode as Node);\n this.dependencies.push(node);\n }\n\n removeDependent(node: Node): void {\n node.removeDependency(this as BaseNode as Node);\n }\n\n removeDependency(node: Node): void {\n if (!this.dependencies.includes(node)) {\n return;\n }\n\n const thisIndex = node.dependents.indexOf(this as BaseNode as Node);\n node.dependents.splice(thisIndex, 1);\n this.dependencies.splice(this.dependencies.indexOf(node), 1);\n }\n\n // Unused in devtools, but used in LH.\n removeAllDependencies(): void {\n for (const node of this.dependencies.slice()) {\n this.removeDependency(node);\n }\n }\n\n /**\n * Computes whether the given node is anywhere in the dependency graph of this node.\n * While this method can prevent cycles, it walks the graph and should be used sparingly.\n * Nodes are always considered dependent on themselves for the purposes of cycle detection.\n */\n isDependentOn(node: BaseNode<T>): boolean {\n let isDependentOnNode = false;\n this.traverse(\n currentNode => {\n if (isDependentOnNode) {\n return;\n }\n isDependentOnNode = currentNode === node;\n },\n currentNode => {\n // If we've already found the dependency, don't traverse further.\n if (isDependentOnNode) {\n return [];\n }\n // Otherwise, traverse the dependencies.\n return currentNode.getDependencies();\n });\n\n return isDependentOnNode;\n }\n\n /**\n * Clones the node's information without adding any dependencies/dependents.\n */\n cloneWithoutRelationships(): Node<T> {\n const node = new BaseNode(this.id) as Node<T>;\n node.setIsMainDocument(this._isMainDocument);\n return node;\n }\n\n /**\n * Clones the entire graph connected to this node filtered by the optional predicate. If a node is\n * included by the predicate, all nodes along the paths between the node and the root will be included. If the\n * node this was called on is not included in the resulting filtered graph, the method will throw.\n *\n * This does not clone NetworkNode's `record` or `rawRecord` fields. It may be reasonable to clone the former,\n * to assist in graph construction, but the latter should never be cloned as one constraint of Lantern is that\n * the underlying data records are accessible for plain object reference equality checks.\n */\n cloneWithRelationships(predicate?: (arg0: Node) => boolean): Node {\n const rootNode = this.getRootNode();\n\n const idsToIncludedClones = new Map<string, Node>();\n\n // Walk down dependents.\n rootNode.traverse(node => {\n if (idsToIncludedClones.has(node.id)) {\n return;\n }\n\n if (predicate === undefined) {\n // No condition for entry, so clone every node.\n idsToIncludedClones.set(node.id, node.cloneWithoutRelationships());\n return;\n }\n\n if (predicate(node)) {\n // Node included, so walk back up dependencies, cloning nodes from here back to the root.\n node.traverse(\n node => idsToIncludedClones.set(node.id, node.cloneWithoutRelationships()),\n // Dependencies already cloned have already cloned ancestors, so no need to visit again.\n node => node.dependencies.filter(parent => !idsToIncludedClones.has(parent.id)),\n );\n }\n });\n\n // Copy dependencies between nodes.\n rootNode.traverse(originalNode => {\n const clonedNode = idsToIncludedClones.get(originalNode.id);\n if (!clonedNode) {\n return;\n }\n\n for (const dependency of originalNode.dependencies) {\n const clonedDependency = idsToIncludedClones.get(dependency.id);\n if (!clonedDependency) {\n throw new Core.LanternError('Dependency somehow not cloned');\n }\n clonedNode.addDependency(clonedDependency);\n }\n });\n\n const clonedThisNode = idsToIncludedClones.get(this.id);\n if (!clonedThisNode) {\n throw new Core.LanternError('Cloned graph missing node');\n }\n return clonedThisNode;\n }\n\n /**\n * Traverses all connected nodes in BFS order, calling `callback` exactly once\n * on each. `traversalPath` is the shortest (though not necessarily unique)\n * path from `node` to the root of the iteration.\n *\n * The `getNextNodes` function takes a visited node and returns which nodes to\n * visit next. It defaults to returning the node's dependents.\n */\n traverse(\n callback: (node: Node<T>, traversalPath: Array<Node<T>>) => void,\n getNextNodes?: (arg0: Node<T>) => Array<Node<T>>): void {\n for (const {node, traversalPath} of this.traverseGenerator(getNextNodes)) {\n callback(node, traversalPath);\n }\n }\n\n /**\n * @see BaseNode.traverse\n */\n // clang-format off\n *traverseGenerator(getNextNodes?: (arg0: Node) => Node[]):\n Generator<{node: Node, traversalPath: Node[]}, void, unknown> {\n // clang-format on\n if (!getNextNodes) {\n getNextNodes = node => node.getDependents();\n }\n\n // @ts-expect-error - only traverses graphs of Node, so force tsc to treat `this` as one\n const queue: Node[][] = [[this]];\n const visited = new Set([this.id]);\n\n while (queue.length) {\n // @ts-expect-error - queue has length so it's guaranteed to have an item\n const traversalPath: Node[] = queue.shift();\n const node = traversalPath[0];\n yield {node, traversalPath};\n\n for (const nextNode of getNextNodes(node)) {\n if (visited.has(nextNode.id)) {\n continue;\n }\n visited.add(nextNode.id);\n\n queue.push([nextNode, ...traversalPath]);\n }\n }\n }\n\n /**\n * If the given node has a cycle, returns a path representing that cycle.\n * Else returns null.\n *\n * Does a DFS on in its dependent graph.\n */\n static findCycle(node: Node, direction: 'dependents'|'dependencies'|'both' = 'both'): BaseNode[]|null {\n // Checking 'both' is the default entrypoint to recursively check both directions\n if (direction === 'both') {\n return BaseNode.findCycle(node, 'dependents') || BaseNode.findCycle(node, 'dependencies');\n }\n\n const visited = new Set();\n const currentPath: BaseNode[] = [];\n const toVisit = [node];\n const depthAdded = new Map([[node, 0]]);\n\n // Keep going while we have nodes to visit in the stack\n while (toVisit.length) {\n // Get the last node in the stack (DFS uses stack, not queue)\n // @ts-expect-error - toVisit has length so it's guaranteed to have an item\n const currentNode: BaseNode = toVisit.pop();\n\n // We've hit a cycle if the node we're visiting is in our current dependency path\n if (currentPath.includes(currentNode)) {\n return currentPath;\n }\n // If we've already visited the node, no need to revisit it\n if (visited.has(currentNode)) {\n continue;\n }\n\n // Since we're visiting this node, clear out any nodes in our path that we had to backtrack\n // @ts-expect-error\n while (currentPath.length > depthAdded.get(currentNode)) {\n currentPath.pop();\n }\n\n // Update our data structures to reflect that we're adding this node to our path\n visited.add(currentNode);\n currentPath.push(currentNode);\n\n // Add all of its dependents to our toVisit stack\n const nodesToExplore = direction === 'dependents' ? currentNode.dependents : currentNode.dependencies;\n for (const nextNode of nodesToExplore) {\n if (toVisit.includes(nextNode)) {\n continue;\n }\n toVisit.push(nextNode);\n depthAdded.set(nextNode, currentPath.length);\n }\n }\n\n return null;\n }\n\n canDependOn(node: Node): boolean {\n return node.startTime <= this.startTime;\n }\n}\n\nexport {BaseNode};\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
/**
|
|
5
|
-
* @
|
|
5
|
+
* @file
|
|
6
6
|
*
|
|
7
7
|
* This class encapsulates the type-related validation logic for moving timing information for nodes
|
|
8
8
|
* through the different simulation phases. Methods here ensure that the invariants of simulation hold
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimulationTimingMap.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/simulation/SimulationTimingMap.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B;;;;;;GAMG;AAEH,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAmC3C,MAAM,kBAAkB;IACtB,WAAW,CAAkC;IAE7C;QACE,IAAI,CAAC,WAAW,GAAG,IAAI,GAAG,EAA8B,CAAC;IAC3D,CAAC;IAED,QAAQ;QACN,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,eAAe,CAAC,IAAgB,EAAE,MAA4B;QAC5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E,kBAAkB,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,CAAC,CAAC,sBAAsB,IAAI,MAAM,CAAC,EAAE,CAAC;YACxC,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,IAAI,CAAC,EAAE,sBAAsB,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,YAAY,CAAC,IAAgB;QAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,IAAI,CAAC,EAAE,iBAAiB,CAAC,CAAC;QAChE,CAAC;QACD,IAAI,CAAC,CAAC,WAAW,IAAI,MAAM,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,IAAI,CAAC,EAAE,kBAAkB,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,CAAC,CAAC,sBAAsB,IAAI,MAAM,CAAC,EAAE,CAAC;YACxC,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,IAAI,CAAC,EAAE,sBAAsB,CAAC,CAAC;QACrE,CAAC;QACD,IAAI,CAAC,CAAC,SAAS,IAAI,MAAM,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,IAAI,CAAC,EAAE,oBAAoB,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAED,OAAO,EAAC,kBAAkB,EAAC,CAAC","sourcesContent":["// Copyright 2024 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\n/**\n * @fileoverview\n *\n * This class encapsulates the type-related validation logic for moving timing information for nodes\n * through the different simulation phases. Methods here ensure that the invariants of simulation hold\n * as nodes are queued, partially simulated, and completed.\n */\n\nimport * as Core from '../core/core.js';\nimport * as Graph from '../graph/graph.js';\n\ninterface NodeTimingComplete {\n startTime: number;\n endTime: number;\n queuedTime: number;\n estimatedTimeElapsed: number;\n timeElapsed: number;\n timeElapsedOvershoot: number;\n bytesDownloaded: number;\n}\n\ntype NodeTimingQueued = Pick<NodeTimingComplete, 'queuedTime'>;\n\ntype CpuNodeTimingStarted = NodeTimingQueued&Pick<NodeTimingComplete, 'startTime'|'timeElapsed'>;\ntype NetworkNodeTimingStarted = CpuNodeTimingStarted&Pick<NodeTimingComplete, 'timeElapsedOvershoot'|'bytesDownloaded'>;\n\ntype CpuNodeTimingInProgress = CpuNodeTimingStarted&Pick<NodeTimingComplete, 'estimatedTimeElapsed'>;\ntype NetworkNodeTimingInProgress = NetworkNodeTimingStarted&Pick<NodeTimingComplete, 'estimatedTimeElapsed'>;\n\nexport type CpuNodeTimingComplete = CpuNodeTimingInProgress&Pick<NodeTimingComplete, 'endTime'>;\nexport type NetworkNodeTimingComplete =\n NetworkNodeTimingInProgress&Pick<NodeTimingComplete, 'endTime'>&{connectionTiming: ConnectionTiming};\nexport type CompleteNodeTiming = CpuNodeTimingComplete|NetworkNodeTimingComplete;\n\ntype NodeTimingData = NodeTimingQueued|CpuNodeTimingStarted|NetworkNodeTimingStarted|CpuNodeTimingInProgress|\n NetworkNodeTimingInProgress|CpuNodeTimingComplete|NetworkNodeTimingComplete;\n\nexport interface ConnectionTiming {\n dnsResolutionTime?: number;\n connectionTime?: number;\n sslTime?: number;\n timeToFirstByte: number;\n}\n\nclass SimulatorTimingMap {\n nodeTimings: Map<Graph.Node, NodeTimingData>;\n\n constructor() {\n this.nodeTimings = new Map<Graph.Node, NodeTimingData>();\n }\n\n getNodes(): Graph.Node[] {\n return Array.from(this.nodeTimings.keys());\n }\n\n setReadyToStart(node: Graph.Node, values: {queuedTime: number}): void {\n this.nodeTimings.set(node, values);\n }\n\n setInProgress(node: Graph.Node, values: {startTime: number}): void {\n const nodeTiming = {\n ...this.getQueued(node),\n startTime: values.startTime,\n timeElapsed: 0,\n };\n\n this.nodeTimings.set(\n node,\n node.type === Graph.BaseNode.types.NETWORK ? {...nodeTiming, timeElapsedOvershoot: 0, bytesDownloaded: 0} :\n nodeTiming,\n );\n }\n\n setCompleted(node: Graph.Node, values: {endTime: number, connectionTiming?: ConnectionTiming}): void {\n const nodeTiming = {\n ...this.getInProgress(node),\n endTime: values.endTime,\n connectionTiming: values.connectionTiming,\n };\n\n this.nodeTimings.set(node, nodeTiming);\n }\n\n setCpu(node: Graph.CPUNode, values: {timeElapsed: number}): void {\n const nodeTiming = {\n ...this.getCpuStarted(node),\n timeElapsed: values.timeElapsed,\n };\n\n this.nodeTimings.set(node, nodeTiming);\n }\n\n setCpuEstimated(node: Graph.CPUNode, values: {estimatedTimeElapsed: number}): void {\n const nodeTiming = {\n ...this.getCpuStarted(node),\n estimatedTimeElapsed: values.estimatedTimeElapsed,\n };\n\n this.nodeTimings.set(node, nodeTiming);\n }\n\n setNetwork(\n node: Graph.NetworkNode,\n values: {timeElapsed: number, timeElapsedOvershoot: number, bytesDownloaded: number}): void {\n const nodeTiming = {\n ...this.getNetworkStarted(node),\n timeElapsed: values.timeElapsed,\n timeElapsedOvershoot: values.timeElapsedOvershoot,\n bytesDownloaded: values.bytesDownloaded,\n };\n\n this.nodeTimings.set(node, nodeTiming);\n }\n\n setNetworkEstimated(node: Graph.NetworkNode, values: {estimatedTimeElapsed: number}): void {\n const nodeTiming = {\n ...this.getNetworkStarted(node),\n estimatedTimeElapsed: values.estimatedTimeElapsed,\n };\n\n this.nodeTimings.set(node, nodeTiming);\n }\n\n getQueued(node: Graph.Node): NodeTimingData {\n const timing = this.nodeTimings.get(node);\n if (!timing) {\n throw new Core.LanternError(`Node ${node.id} not yet queued`);\n }\n return timing;\n }\n\n getCpuStarted(node: Graph.CPUNode): CpuNodeTimingStarted {\n const timing = this.nodeTimings.get(node);\n if (!timing) {\n throw new Core.LanternError(`Node ${node.id} not yet queued`);\n }\n if (!('startTime' in timing)) {\n throw new Core.LanternError(`Node ${node.id} not yet started`);\n }\n if ('bytesDownloaded' in timing) {\n throw new Core.LanternError(`Node ${node.id} timing not valid`);\n }\n return timing;\n }\n\n getNetworkStarted(node: Graph.NetworkNode): NetworkNodeTimingStarted {\n const timing = this.nodeTimings.get(node);\n if (!timing) {\n throw new Core.LanternError(`Node ${node.id} not yet queued`);\n }\n if (!('startTime' in timing)) {\n throw new Core.LanternError(`Node ${node.id} not yet started`);\n }\n if (!('bytesDownloaded' in timing)) {\n throw new Core.LanternError(`Node ${node.id} timing not valid`);\n }\n return timing;\n }\n\n getInProgress(node: Graph.Node): CpuNodeTimingInProgress|NetworkNodeTimingInProgress {\n const timing = this.nodeTimings.get(node);\n if (!timing) {\n throw new Core.LanternError(`Node ${node.id} not yet queued`);\n }\n if (!('startTime' in timing)) {\n throw new Core.LanternError(`Node ${node.id} not yet started`);\n }\n if (!('estimatedTimeElapsed' in timing)) {\n throw new Core.LanternError(`Node ${node.id} not yet in progress`);\n }\n return timing;\n }\n\n getCompleted(node: Graph.Node): CpuNodeTimingComplete|NetworkNodeTimingComplete {\n const timing = this.nodeTimings.get(node);\n if (!timing) {\n throw new Core.LanternError(`Node ${node.id} not yet queued`);\n }\n if (!('startTime' in timing)) {\n throw new Core.LanternError(`Node ${node.id} not yet started`);\n }\n if (!('estimatedTimeElapsed' in timing)) {\n throw new Core.LanternError(`Node ${node.id} not yet in progress`);\n }\n if (!('endTime' in timing)) {\n throw new Core.LanternError(`Node ${node.id} not yet completed`);\n }\n return timing;\n }\n}\n\nexport {SimulatorTimingMap};\n"]}
|
|
1
|
+
{"version":3,"file":"SimulationTimingMap.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/simulation/SimulationTimingMap.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B;;;;;;GAMG;AAEH,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO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AC,CAAC;QACnE,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAED,OAAO,EAAC,kBAAkB,EAAC,CAAC","sourcesContent":["// Copyright 2024 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\n/**\n * @file\n *\n * This class encapsulates the type-related validation logic for moving timing information for nodes\n * through the different simulation phases. Methods here ensure that the invariants of simulation hold\n * as nodes are queued, partially simulated, and completed.\n */\n\nimport * as Core from '../core/core.js';\nimport * as Graph from '../graph/graph.js';\n\ninterface NodeTimingComplete {\n startTime: number;\n endTime: number;\n queuedTime: number;\n estimatedTimeElapsed: number;\n timeElapsed: number;\n timeElapsedOvershoot: number;\n bytesDownloaded: number;\n}\n\ntype NodeTimingQueued = Pick<NodeTimingComplete, 'queuedTime'>;\n\ntype CpuNodeTimingStarted = NodeTimingQueued&Pick<NodeTimingComplete, 'startTime'|'timeElapsed'>;\ntype NetworkNodeTimingStarted = CpuNodeTimingStarted&Pick<NodeTimingComplete, 'timeElapsedOvershoot'|'bytesDownloaded'>;\n\ntype CpuNodeTimingInProgress = CpuNodeTimingStarted&Pick<NodeTimingComplete, 'estimatedTimeElapsed'>;\ntype NetworkNodeTimingInProgress = NetworkNodeTimingStarted&Pick<NodeTimingComplete, 'estimatedTimeElapsed'>;\n\nexport type CpuNodeTimingComplete = CpuNodeTimingInProgress&Pick<NodeTimingComplete, 'endTime'>;\nexport type NetworkNodeTimingComplete =\n NetworkNodeTimingInProgress&Pick<NodeTimingComplete, 'endTime'>&{connectionTiming: ConnectionTiming};\nexport type CompleteNodeTiming = CpuNodeTimingComplete|NetworkNodeTimingComplete;\n\ntype NodeTimingData = NodeTimingQueued|CpuNodeTimingStarted|NetworkNodeTimingStarted|CpuNodeTimingInProgress|\n NetworkNodeTimingInProgress|CpuNodeTimingComplete|NetworkNodeTimingComplete;\n\nexport interface ConnectionTiming {\n dnsResolutionTime?: number;\n connectionTime?: number;\n sslTime?: number;\n timeToFirstByte: number;\n}\n\nclass SimulatorTimingMap {\n nodeTimings: Map<Graph.Node, NodeTimingData>;\n\n constructor() {\n this.nodeTimings = new Map<Graph.Node, NodeTimingData>();\n }\n\n getNodes(): Graph.Node[] {\n return Array.from(this.nodeTimings.keys());\n }\n\n setReadyToStart(node: Graph.Node, values: {queuedTime: number}): void {\n this.nodeTimings.set(node, values);\n }\n\n setInProgress(node: Graph.Node, values: {startTime: number}): void {\n const nodeTiming = {\n ...this.getQueued(node),\n startTime: values.startTime,\n timeElapsed: 0,\n };\n\n this.nodeTimings.set(\n node,\n node.type === Graph.BaseNode.types.NETWORK ? {...nodeTiming, timeElapsedOvershoot: 0, bytesDownloaded: 0} :\n nodeTiming,\n );\n }\n\n setCompleted(node: Graph.Node, values: {endTime: number, connectionTiming?: ConnectionTiming}): void {\n const nodeTiming = {\n ...this.getInProgress(node),\n endTime: values.endTime,\n connectionTiming: values.connectionTiming,\n };\n\n this.nodeTimings.set(node, nodeTiming);\n }\n\n setCpu(node: Graph.CPUNode, values: {timeElapsed: number}): void {\n const nodeTiming = {\n ...this.getCpuStarted(node),\n timeElapsed: values.timeElapsed,\n };\n\n this.nodeTimings.set(node, nodeTiming);\n }\n\n setCpuEstimated(node: Graph.CPUNode, values: {estimatedTimeElapsed: number}): void {\n const nodeTiming = {\n ...this.getCpuStarted(node),\n estimatedTimeElapsed: values.estimatedTimeElapsed,\n };\n\n this.nodeTimings.set(node, nodeTiming);\n }\n\n setNetwork(\n node: Graph.NetworkNode,\n values: {timeElapsed: number, timeElapsedOvershoot: number, bytesDownloaded: number}): void {\n const nodeTiming = {\n ...this.getNetworkStarted(node),\n timeElapsed: values.timeElapsed,\n timeElapsedOvershoot: values.timeElapsedOvershoot,\n bytesDownloaded: values.bytesDownloaded,\n };\n\n this.nodeTimings.set(node, nodeTiming);\n }\n\n setNetworkEstimated(node: Graph.NetworkNode, values: {estimatedTimeElapsed: number}): void {\n const nodeTiming = {\n ...this.getNetworkStarted(node),\n estimatedTimeElapsed: values.estimatedTimeElapsed,\n };\n\n this.nodeTimings.set(node, nodeTiming);\n }\n\n getQueued(node: Graph.Node): NodeTimingData {\n const timing = this.nodeTimings.get(node);\n if (!timing) {\n throw new Core.LanternError(`Node ${node.id} not yet queued`);\n }\n return timing;\n }\n\n getCpuStarted(node: Graph.CPUNode): CpuNodeTimingStarted {\n const timing = this.nodeTimings.get(node);\n if (!timing) {\n throw new Core.LanternError(`Node ${node.id} not yet queued`);\n }\n if (!('startTime' in timing)) {\n throw new Core.LanternError(`Node ${node.id} not yet started`);\n }\n if ('bytesDownloaded' in timing) {\n throw new Core.LanternError(`Node ${node.id} timing not valid`);\n }\n return timing;\n }\n\n getNetworkStarted(node: Graph.NetworkNode): NetworkNodeTimingStarted {\n const timing = this.nodeTimings.get(node);\n if (!timing) {\n throw new Core.LanternError(`Node ${node.id} not yet queued`);\n }\n if (!('startTime' in timing)) {\n throw new Core.LanternError(`Node ${node.id} not yet started`);\n }\n if (!('bytesDownloaded' in timing)) {\n throw new Core.LanternError(`Node ${node.id} timing not valid`);\n }\n return timing;\n }\n\n getInProgress(node: Graph.Node): CpuNodeTimingInProgress|NetworkNodeTimingInProgress {\n const timing = this.nodeTimings.get(node);\n if (!timing) {\n throw new Core.LanternError(`Node ${node.id} not yet queued`);\n }\n if (!('startTime' in timing)) {\n throw new Core.LanternError(`Node ${node.id} not yet started`);\n }\n if (!('estimatedTimeElapsed' in timing)) {\n throw new Core.LanternError(`Node ${node.id} not yet in progress`);\n }\n return timing;\n }\n\n getCompleted(node: Graph.Node): CpuNodeTimingComplete|NetworkNodeTimingComplete {\n const timing = this.nodeTimings.get(node);\n if (!timing) {\n throw new Core.LanternError(`Node ${node.id} not yet queued`);\n }\n if (!('startTime' in timing)) {\n throw new Core.LanternError(`Node ${node.id} not yet started`);\n }\n if (!('estimatedTimeElapsed' in timing)) {\n throw new Core.LanternError(`Node ${node.id} not yet in progress`);\n }\n if (!('endTime' in timing)) {\n throw new Core.LanternError(`Node ${node.id} not yet completed`);\n }\n return timing;\n }\n}\n\nexport {SimulatorTimingMap};\n"]}
|
|
@@ -32,6 +32,13 @@ export interface Configuration {
|
|
|
32
32
|
* attempt to gather or track invalidations.
|
|
33
33
|
*/
|
|
34
34
|
maxInvalidationEventsPerEvent: number;
|
|
35
|
+
/**
|
|
36
|
+
* Determines if the AnimationFramesHandler should be enabled. Currently in
|
|
37
|
+
* DevTools we do not use it, so we disable it by default to avoid work that
|
|
38
|
+
* we do not use. If you disable it, you will still see `data.AnimationFrames`
|
|
39
|
+
* from the model, but the contents will be empty.
|
|
40
|
+
*/
|
|
41
|
+
enableAnimationsFrameHandler: boolean;
|
|
35
42
|
}
|
|
36
43
|
export declare const defaults: () => Configuration;
|
|
37
44
|
/**
|