@paulirish/trace_engine 0.0.10 → 0.0.12

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.
Files changed (256) hide show
  1. package/README.md +1 -1
  2. package/analyze-trace.mjs +1 -1
  3. package/core/platform/DevToolsPath.d.ts +4 -13
  4. package/core/platform/DevToolsPath.js +7 -4
  5. package/core/platform/DevToolsPath.js.map +1 -7
  6. package/core/platform/MimeType.d.ts +27 -0
  7. package/core/platform/MimeType.js +119 -86
  8. package/core/platform/MimeType.js.map +1 -7
  9. package/core/platform/Timing.d.ts +7 -0
  10. package/core/platform/Timing.js +7 -4
  11. package/core/platform/Timing.js.map +1 -7
  12. package/core/platform/UIString.d.ts +2 -5
  13. package/core/platform/UIString.js +5 -2
  14. package/core/platform/UIString.js.map +1 -7
  15. package/core/platform/UserVisibleError.js +19 -10
  16. package/core/platform/UserVisibleError.js.map +1 -7
  17. package/core/platform/array-utilities.d.ts +48 -10
  18. package/core/platform/array-utilities.js +160 -124
  19. package/core/platform/array-utilities.js.map +1 -7
  20. package/core/platform/brand.d.ts +14 -0
  21. package/core/platform/brand.js +5 -1
  22. package/core/platform/brand.js.map +1 -7
  23. package/core/platform/date-utilities.js +10 -6
  24. package/core/platform/date-utilities.js.map +1 -7
  25. package/core/platform/dom-utilities.d.ts +3 -1
  26. package/core/platform/dom-utilities.js +94 -83
  27. package/core/platform/dom-utilities.js.map +1 -7
  28. package/core/platform/keyboard-utilities.d.ts +2 -0
  29. package/core/platform/keyboard-utilities.js +15 -24
  30. package/core/platform/keyboard-utilities.js.map +1 -7
  31. package/core/platform/map-utilities.d.ts +4 -0
  32. package/core/platform/map-utilities.js +66 -60
  33. package/core/platform/map-utilities.js.map +1 -7
  34. package/core/platform/number-utilities.js +66 -55
  35. package/core/platform/number-utilities.js.map +1 -7
  36. package/core/platform/platform.d.ts +5 -1
  37. package/core/platform/platform.js +54 -37
  38. package/core/platform/platform.js.map +1 -7
  39. package/core/platform/promise-utilities.d.ts +10 -0
  40. package/core/platform/promise-utilities.js +16 -8
  41. package/core/platform/promise-utilities.js.map +1 -7
  42. package/core/platform/set-utilities.js +20 -17
  43. package/core/platform/set-utilities.js.map +1 -7
  44. package/core/platform/string-utilities.d.ts +32 -1
  45. package/core/platform/string-utilities.js +453 -379
  46. package/core/platform/string-utilities.js.map +1 -7
  47. package/core/platform/typescript-utilities.d.ts +5 -5
  48. package/core/platform/typescript-utilities.js +19 -7
  49. package/core/platform/typescript-utilities.js.map +1 -7
  50. package/generated/protocol.d.ts +2081 -347
  51. package/generated/protocol.js +5 -2230
  52. package/models/cpu_profile/CPUProfileDataModel.d.ts +77 -0
  53. package/models/cpu_profile/CPUProfileDataModel.js +492 -359
  54. package/models/cpu_profile/CPUProfileDataModel.js.map +1 -7
  55. package/models/cpu_profile/ProfileTreeModel.d.ts +29 -0
  56. package/models/cpu_profile/ProfileTreeModel.js +87 -82
  57. package/models/cpu_profile/ProfileTreeModel.js.map +1 -7
  58. package/models/cpu_profile/cpu_profile.d.ts +3 -0
  59. package/models/cpu_profile/cpu_profile.js +7 -7
  60. package/models/cpu_profile/cpu_profile.js.map +1 -7
  61. package/models/trace/EntriesFilter.d.ts +55 -0
  62. package/models/trace/EntriesFilter.js +227 -166
  63. package/models/trace/EntriesFilter.js.map +1 -7
  64. package/models/trace/LegacyTracingModel.js.map +1 -7
  65. package/models/trace/ModelImpl.d.ts +110 -0
  66. package/models/trace/ModelImpl.js +161 -102
  67. package/models/trace/ModelImpl.js.map +1 -7
  68. package/models/trace/Processor.d.ts +36 -0
  69. package/models/trace/Processor.js +197 -163
  70. package/models/trace/Processor.js.map +1 -7
  71. package/models/trace/TracingManager.js.map +1 -7
  72. package/models/trace/extras/FetchNodes.d.ts +46 -0
  73. package/models/trace/extras/FetchNodes.js +132 -91
  74. package/models/trace/extras/FetchNodes.js.map +1 -7
  75. package/models/trace/extras/FilmStrip.d.ts +19 -0
  76. package/models/trace/extras/FilmStrip.js +38 -31
  77. package/models/trace/extras/FilmStrip.js.map +1 -7
  78. package/models/trace/extras/MainThreadActivity.d.ts +2 -0
  79. package/models/trace/extras/MainThreadActivity.js +72 -56
  80. package/models/trace/extras/MainThreadActivity.js.map +1 -7
  81. package/models/trace/extras/Metadata.d.ts +2 -0
  82. package/models/trace/extras/Metadata.js +42 -26
  83. package/models/trace/extras/Metadata.js.map +1 -7
  84. package/models/trace/extras/extras.js.map +1 -7
  85. package/models/trace/handlers/AnimationHandler.d.ts +8 -0
  86. package/models/trace/handlers/AnimationHandler.js +22 -20
  87. package/models/trace/handlers/AnimationHandler.js.map +1 -7
  88. package/models/trace/handlers/AuctionWorkletsHandler.d.ts +8 -0
  89. package/models/trace/handlers/AuctionWorkletsHandler.js +143 -89
  90. package/models/trace/handlers/AuctionWorkletsHandler.js.map +1 -7
  91. package/models/trace/handlers/FramesHandler.d.ts +76 -0
  92. package/models/trace/handlers/FramesHandler.js +424 -355
  93. package/models/trace/handlers/FramesHandler.js.map +1 -7
  94. package/models/trace/handlers/GPUHandler.d.ts +11 -0
  95. package/models/trace/handlers/GPUHandler.js +41 -37
  96. package/models/trace/handlers/GPUHandler.js.map +1 -7
  97. package/models/trace/handlers/InitiatorsHandler.d.ts +10 -0
  98. package/models/trace/handlers/InitiatorsHandler.js +164 -113
  99. package/models/trace/handlers/InitiatorsHandler.js.map +1 -7
  100. package/models/trace/handlers/InvalidationsHandler.d.ts +10 -0
  101. package/models/trace/handlers/InvalidationsHandler.js +101 -79
  102. package/models/trace/handlers/InvalidationsHandler.js.map +1 -7
  103. package/models/trace/handlers/LargestImagePaintHandler.d.ts +5 -0
  104. package/models/trace/handlers/LargestImagePaintHandler.js +32 -12
  105. package/models/trace/handlers/LargestImagePaintHandler.js.map +1 -7
  106. package/models/trace/handlers/LargestTextPaintHandler.d.ts +5 -0
  107. package/models/trace/handlers/LargestTextPaintHandler.js +20 -12
  108. package/models/trace/handlers/LargestTextPaintHandler.js.map +1 -7
  109. package/models/trace/handlers/LayerTreeHandler.d.ts +13 -0
  110. package/models/trace/handlers/LayerTreeHandler.js +96 -70
  111. package/models/trace/handlers/LayerTreeHandler.js.map +1 -7
  112. package/models/trace/handlers/LayoutShiftsHandler.d.ts +44 -0
  113. package/models/trace/handlers/LayoutShiftsHandler.js +304 -227
  114. package/models/trace/handlers/LayoutShiftsHandler.js.map +1 -7
  115. package/models/trace/handlers/MemoryHandler.d.ts +7 -0
  116. package/models/trace/handlers/MemoryHandler.js +14 -11
  117. package/models/trace/handlers/MemoryHandler.js.map +1 -7
  118. package/models/trace/handlers/MetaHandler.d.ts +37 -0
  119. package/models/trace/handlers/MetaHandler.js +314 -226
  120. package/models/trace/handlers/MetaHandler.js.map +1 -7
  121. package/models/trace/handlers/ModelHandlers.d.ts +21 -0
  122. package/models/trace/handlers/ModelHandlers.js +25 -22
  123. package/models/trace/handlers/ModelHandlers.js.map +1 -7
  124. package/models/trace/handlers/NetworkRequestsHandler.d.ts +17 -0
  125. package/models/trace/handlers/NetworkRequestsHandler.js +342 -218
  126. package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -7
  127. package/models/trace/handlers/PageLoadMetricsHandler.d.ts +67 -0
  128. package/models/trace/handlers/PageLoadMetricsHandler.js +357 -284
  129. package/models/trace/handlers/PageLoadMetricsHandler.js.map +1 -7
  130. package/models/trace/handlers/RendererHandler.d.ts +101 -0
  131. package/models/trace/handlers/RendererHandler.js +295 -191
  132. package/models/trace/handlers/RendererHandler.js.map +1 -7
  133. package/models/trace/handlers/SamplesHandler.d.ts +46 -0
  134. package/models/trace/handlers/SamplesHandler.js +195 -158
  135. package/models/trace/handlers/SamplesHandler.js.map +1 -7
  136. package/models/trace/handlers/ScreenshotsHandler.d.ts +7 -0
  137. package/models/trace/handlers/ScreenshotsHandler.js +63 -41
  138. package/models/trace/handlers/ScreenshotsHandler.js.map +1 -7
  139. package/models/trace/handlers/Threads.d.ts +33 -0
  140. package/models/trace/handlers/Threads.js +85 -67
  141. package/models/trace/handlers/Threads.js.map +1 -7
  142. package/models/trace/handlers/UserInteractionsHandler.d.ts +57 -0
  143. package/models/trace/handlers/UserInteractionsHandler.js +240 -141
  144. package/models/trace/handlers/UserInteractionsHandler.js.map +1 -7
  145. package/models/trace/handlers/UserTimingsHandler.d.ts +28 -0
  146. package/models/trace/handlers/UserTimingsHandler.js +91 -80
  147. package/models/trace/handlers/UserTimingsHandler.js.map +1 -7
  148. package/models/trace/handlers/WarningsHandler.d.ts +14 -0
  149. package/models/trace/handlers/WarningsHandler.js +100 -62
  150. package/models/trace/handlers/WarningsHandler.js.map +1 -7
  151. package/models/trace/handlers/WorkersHandler.d.ts +11 -0
  152. package/models/trace/handlers/WorkersHandler.js +40 -38
  153. package/models/trace/handlers/WorkersHandler.js.map +1 -7
  154. package/models/trace/handlers/handlers.d.ts +3 -0
  155. package/models/trace/handlers/handlers.js +7 -4
  156. package/models/trace/handlers/handlers.js.map +1 -7
  157. package/models/trace/handlers/types.d.ts +45 -0
  158. package/models/trace/handlers/types.js +15 -15
  159. package/models/trace/handlers/types.js.map +1 -7
  160. package/models/trace/helpers/SamplesIntegrator.d.ts +49 -0
  161. package/models/trace/helpers/SamplesIntegrator.js +381 -204
  162. package/models/trace/helpers/SamplesIntegrator.js.map +1 -7
  163. package/models/trace/helpers/Timing.d.ts +26 -0
  164. package/models/trace/helpers/Timing.js +131 -110
  165. package/models/trace/helpers/Timing.js.map +1 -7
  166. package/models/trace/helpers/Trace.d.ts +37 -0
  167. package/models/trace/helpers/Trace.js +200 -166
  168. package/models/trace/helpers/Trace.js.map +1 -7
  169. package/models/trace/helpers/TreeHelpers.d.ts +90 -0
  170. package/models/trace/helpers/TreeHelpers.js +203 -100
  171. package/models/trace/helpers/TreeHelpers.js.map +1 -7
  172. package/models/trace/helpers/helpers.d.ts +4 -0
  173. package/models/trace/helpers/helpers.js +8 -5
  174. package/models/trace/helpers/helpers.js.map +1 -7
  175. package/models/trace/root-causes/LayoutShift.d.ts +119 -0
  176. package/models/trace/root-causes/LayoutShift.js +470 -323
  177. package/models/trace/root-causes/LayoutShift.js.map +1 -7
  178. package/models/trace/root-causes/RootCauses.d.ts +14 -0
  179. package/models/trace/root-causes/RootCauses.js +9 -6
  180. package/models/trace/root-causes/RootCauses.js.map +1 -7
  181. package/models/trace/root-causes/root-causes.d.ts +1 -0
  182. package/models/trace/root-causes/root-causes.js +5 -2
  183. package/models/trace/root-causes/root-causes.js.map +1 -7
  184. package/models/trace/trace.d.ts +11 -0
  185. package/models/trace/trace.js +17 -23
  186. package/models/trace/trace.js.map +1 -7
  187. package/models/trace/types/Configuration.d.ts +33 -0
  188. package/models/trace/types/Configuration.js +25 -14
  189. package/models/trace/types/Configuration.js.map +1 -7
  190. package/models/trace/types/File.d.ts +23 -0
  191. package/models/trace/types/File.js +5 -6
  192. package/models/trace/types/File.js.map +1 -7
  193. package/models/trace/types/Timing.d.ts +25 -0
  194. package/models/trace/types/Timing.js +10 -11
  195. package/models/trace/types/Timing.js.map +1 -7
  196. package/models/trace/types/TraceEvents.d.ts +1571 -0
  197. package/models/trace/types/TraceEvents.js +174 -381
  198. package/models/trace/types/TraceEvents.js.map +1 -7
  199. package/models/trace/types/types.d.ts +4 -0
  200. package/models/trace/types/types.js +8 -5
  201. package/models/trace/types/types.js.map +1 -7
  202. package/package.json +1 -1
  203. package/TracingManager.js +0 -0
  204. package/core/platform/devtools_entrypoint-bundle-tsconfig-tsconfig.json +0 -40
  205. package/core/platform/platform.js.compressed +0 -0
  206. package/core/platform/platform.js.hash +0 -1
  207. package/core/platform/platform.prebundle.d.ts +0 -15
  208. package/core/platform/platform.prebundle.js +0 -50
  209. package/core/platform/platform.prebundle.js.map +0 -1
  210. package/core/platform/platform.prebundle.ts +0 -64
  211. package/extras/extras.js +0 -0
  212. package/models/trace/SDKServices.js +0 -104
  213. package/models/trace/SDKServices.js.map +0 -7
  214. package/models/trace/TraceProcessor.js +0 -133
  215. package/models/trace/TraceProcessor.js.map +0 -7
  216. package/models/trace/TreeManipulator.js +0 -85
  217. package/models/trace/TreeManipulator.js.map +0 -7
  218. package/models/trace/devtools_entrypoint-legacy-typescript-tsconfig.json +0 -43
  219. package/models/trace/frames/TimelineFrameModel.js +0 -392
  220. package/models/trace/frames/TimelineFrameModel.js.map +0 -7
  221. package/models/trace/frames/bundle-tsconfig.json +0 -1
  222. package/models/trace/frames/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -43
  223. package/models/trace/frames/frames-tsconfig.json +0 -58
  224. package/models/trace/frames/frames.js +0 -5
  225. package/models/trace/frames/frames.js.map +0 -7
  226. package/models/trace/handlers/Migration.js +0 -27
  227. package/models/trace/handlers/Migration.js.map +0 -7
  228. package/models/trace/handlers/UberFramesHandler.js +0 -293
  229. package/models/trace/handlers/UberFramesHandler.js.map +0 -7
  230. package/models/trace/legacy-tsconfig.json +0 -1
  231. package/models/trace/sdk_services/DOMNodeLookup.js +0 -41
  232. package/models/trace/sdk_services/DOMNodeLookup.js.map +0 -7
  233. package/models/trace/sdk_services/LayoutShifts.js +0 -68
  234. package/models/trace/sdk_services/LayoutShifts.js.map +0 -7
  235. package/models/trace/sdk_services/bundle-tsconfig.json +0 -1
  236. package/models/trace/sdk_services/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -41
  237. package/models/trace/sdk_services/sdk_services-tsconfig.json +0 -57
  238. package/models/trace/sdk_services/sdk_services.js +0 -7
  239. package/models/trace/sdk_services/sdk_services.js.map +0 -7
  240. package/models/trace/trace-legacy.js +0 -16
  241. package/models/trace/trace-legacy.js.map +0 -7
  242. package/models/trace/worker/Processor.js +0 -143
  243. package/models/trace/worker/Processor.js.map +0 -7
  244. package/models/trace/worker/Types.js +0 -1
  245. package/models/trace/worker/Types.js.map +0 -7
  246. package/models/trace/worker/bundle-tsconfig.json +0 -1
  247. package/models/trace/worker/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -41
  248. package/models/trace/worker/devtools_entrypoint-worker_entrypoint-typescript-tsconfig.json +0 -41
  249. package/models/trace/worker/processor-tsconfig.json +0 -45
  250. package/models/trace/worker/worker.js +0 -7
  251. package/models/trace/worker/worker.js.map +0 -7
  252. package/models/trace/worker/worker_entrypoint-tsconfig.json +0 -1
  253. package/models/trace/worker/worker_entrypoint.js +0 -36
  254. package/models/trace/worker/worker_entrypoint.js.map +0 -7
  255. package/trace.mjs +0 -6980
  256. package/trace.mjs.map +0 -8
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../../../front_end/models/trace/root-causes/LayoutShift.ts"],
4
- "sourcesContent": ["// Copyright 2023 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Platform from '../../../core/platform/platform.js';\nimport type * as Protocol from '../../../generated/protocol.js';\nimport {type TraceParseData} from '../handlers/types.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport {type RootCauseProtocolInterface} from './RootCauses.js';\n\nexport type CSSDimensions = {\n width?: string,\n height?: string,\n aspectRatio?: string,\n};\n\nexport interface UnsizedMedia {\n node: Protocol.DOM.Node;\n authoredDimensions?: CSSDimensions;\n computedDimensions: CSSDimensions;\n}\n\nexport interface InjectedIframe {\n iframe: Protocol.DOM.Node;\n}\n\nexport interface RootCauseRequest {\n request: Types.TraceEvents.SyntheticNetworkRequest;\n initiator?: Protocol.Network.Initiator;\n}\n\nexport interface FontChange extends RootCauseRequest {\n fontFace: Protocol.CSS.FontFace;\n}\n\nexport interface RenderBlockingRequest extends RootCauseRequest {}\n\nexport interface LayoutShiftRootCausesData {\n unsizedMedia: UnsizedMedia[];\n iframes: InjectedIframe[];\n fontChanges: FontChange[];\n renderBlockingRequests: RenderBlockingRequest[];\n scriptStackTrace: Types.TraceEvents.TraceEventCallFrame[];\n}\n\nconst fontRequestsByPrePaint = new Map<Types.TraceEvents.TraceEventPrePaint, FontChange[]|null>();\nconst renderBlocksByPrePaint = new Map<Types.TraceEvents.TraceEventPrePaint, RenderBlockingRequest[]|null>();\n\nfunction setDefaultValue(\n map: Map<Types.TraceEvents.TraceEventLayoutShift, LayoutShiftRootCausesData>,\n shift: Types.TraceEvents.TraceEventLayoutShift): void {\n Platform.MapUtilities.getWithDefault(map, shift, () => {\n return {\n unsizedMedia: [],\n iframes: [],\n fontChanges: [],\n renderBlockingRequests: [],\n scriptStackTrace: [],\n };\n });\n}\n\n// Important: we purposefully treat `potentially_blocking` as\n// non-render-blocking here because:\n// 1. An async script can run on the main thread at any point, including before\n// the page is loaded\n// 2. An async script will never block the parsing and rendering process of the\n// browser.\n// 3. Therefore, from a developer's point of view, there is nothing more they\n// can do if they've put `async` on, and within the context of Insights, we\n// shouldn't report an async script as render blocking.\n// In the future we may want to consider suggesting the use of `defer` over\n// `async`, as it doesn't have this concern, but for now we'll allow `async`\n// and not report it as an issue.\nconst NON_RENDER_BLOCKING_VALUES = new Set<Types.TraceEvents.RenderBlocking>([\n 'non_blocking',\n 'potentially_blocking',\n]);\nfunction networkRequestIsRenderBlockingInFrame(\n event: Types.TraceEvents.SyntheticNetworkRequest, frameId: string): boolean {\n const isRenderBlocking = !NON_RENDER_BLOCKING_VALUES.has(event.args.data.renderBlocking);\n return isRenderBlocking && event.args.data.frame === frameId;\n}\n\nexport class LayoutShiftRootCauses {\n #protocolInterface: RootCauseProtocolInterface;\n #rootCauseCacheMap = new Map<Types.TraceEvents.TraceEventLayoutShift, LayoutShiftRootCausesData>();\n\n constructor(protocolInterface: RootCauseProtocolInterface) {\n this.#protocolInterface = protocolInterface;\n }\n\n /**\n * Calculates the potential root causes for a given layout shift event. Once\n * calculated, this data is cached.\n * Note: because you need all layout shift data at once to calculate these\n * correctly, this function will parse the root causes for _all_ layout shift\n * events the first time that it's called. That then populates the cache for\n * each shift, so any subsequent calls are just a constant lookup.\n */\n async rootCausesForEvent(modelData: TraceParseData, event: Types.TraceEvents.TraceEventLayoutShift):\n Promise<Readonly<LayoutShiftRootCausesData>|null> {\n const cachedResult = this.#rootCauseCacheMap.get(event);\n if (cachedResult) {\n return cachedResult;\n }\n\n const allLayoutShifts = modelData.LayoutShifts.clusters.flatMap(cluster => cluster.events);\n // Make sure a value in the cache is set even for shifts that don't have a root cause,\n // so that we don't have to recompute when no root causes are found. In case a cause\n // for a shift is found, the default value is replaced.\n allLayoutShifts.forEach(shift => setDefaultValue(this.#rootCauseCacheMap, shift));\n\n // Populate the cache\n await this.blameShifts(\n allLayoutShifts,\n modelData,\n );\n\n const resultForEvent = this.#rootCauseCacheMap.get(event);\n if (!resultForEvent) {\n // No root causes available for this layout shift.\n return null;\n }\n return resultForEvent;\n }\n\n /**\n * Determines potential root causes for shifts\n */\n async blameShifts(\n layoutShifts: Types.TraceEvents.TraceEventLayoutShift[],\n modelData: TraceParseData,\n ): Promise<void> {\n await this.linkShiftsToLayoutInvalidations(layoutShifts, modelData);\n this.linkShiftsToLayoutEvents(layoutShifts, modelData);\n }\n\n /**\n * \"LayoutInvalidations\" are a set of trace events dispatched in Blink under the name\n * \"layoutInvalidationTracking\", which track invalidations on the \"Layout\"stage of the\n * rendering pipeline. This function utilizes this event to flag potential root causes\n * to layout shifts.\n */\n async linkShiftsToLayoutInvalidations(\n layoutShifts: Types.TraceEvents.TraceEventLayoutShift[], modelData: TraceParseData): Promise<void> {\n const {prePaintEvents, layoutInvalidationEvents, scheduleStyleInvalidationEvents, backendNodeIds} =\n modelData.LayoutShifts;\n\n // For the purposes of determining root causes of layout shifts, we\n // consider scheduleStyleInvalidationTracking and\n // LayoutInvalidationTracking events as events that could have been the\n // cause of the layout shift.\n const eventsForLayoutInvalidation: Array<Types.TraceEvents.TraceEventLayoutInvalidationTracking|\n Types.TraceEvents.TraceEventScheduleStyleInvalidationTracking> =\n [...layoutInvalidationEvents, ...scheduleStyleInvalidationEvents];\n\n const nodes = await this.#protocolInterface.pushNodesByBackendIdsToFrontend(backendNodeIds);\n const nodeIdsByBackendIdMap = new Map<Protocol.DOM.BackendNodeId, Protocol.DOM.NodeId>();\n for (let i = 0; i < backendNodeIds.length; i++) {\n nodeIdsByBackendIdMap.set(backendNodeIds[i], nodes[i]);\n }\n\n // Maps from PrePaint events to LayoutShifts that occured in each one.\n const shiftsByPrePaint = getShiftsByPrePaintEvents(layoutShifts, prePaintEvents);\n for (const layoutInvalidation of eventsForLayoutInvalidation) {\n // Get the first PrePaint event that happened after the current LayoutInvalidation event.\n const nextPrePaintIndex = Platform.ArrayUtilities.nearestIndexFromBeginning(\n prePaintEvents, prePaint => prePaint.ts > layoutInvalidation.ts);\n if (nextPrePaintIndex === null) {\n // No PrePaint event registered after this LayoutInvalidation. Continue.\n continue;\n }\n const nextPrePaint = prePaintEvents[nextPrePaintIndex];\n const subsequentShifts = shiftsByPrePaint.get(nextPrePaint);\n if (!subsequentShifts) {\n // The PrePaint after the current LayoutInvalidation doesn't contain shifts.\n continue;\n }\n const fontChangeRootCause = this.getFontChangeRootCause(layoutInvalidation, nextPrePaint, modelData);\n const renderBlockRootCause = this.getRenderBlockRootCause(layoutInvalidation, nextPrePaint, modelData);\n const layoutInvalidationNodeId = nodeIdsByBackendIdMap.get(layoutInvalidation.args.data.nodeId);\n const layoutInvalidationNode = layoutInvalidationNodeId !== undefined ?\n await this.#protocolInterface.getNode(layoutInvalidationNodeId) :\n null;\n let unsizedMediaRootCause: UnsizedMedia|null = null;\n let iframeRootCause: InjectedIframe|null = null;\n if (layoutInvalidationNode && layoutInvalidation.args.data.reason) {\n unsizedMediaRootCause =\n await this.getUnsizedMediaRootCause(layoutInvalidation.args.data.reason, layoutInvalidationNode);\n iframeRootCause = this.getIframeRootCause(layoutInvalidation.args.data.reason, layoutInvalidationNode);\n }\n\n if (!unsizedMediaRootCause && !iframeRootCause && !fontChangeRootCause && !renderBlockRootCause) {\n continue;\n }\n\n // Add found potential root causes to all the shifts in this PrePaint and populate the cache.\n for (const shift of subsequentShifts) {\n const rootCausesForShift = Platform.MapUtilities.getWithDefault(this.#rootCauseCacheMap, shift, () => {\n return {\n unsizedMedia: [],\n iframes: [],\n fontChanges: [],\n renderBlockingRequests: [],\n scriptStackTrace: [],\n };\n });\n if (unsizedMediaRootCause &&\n !rootCausesForShift.unsizedMedia.some(media => media.node.nodeId === unsizedMediaRootCause?.node.nodeId) &&\n shift.args.frame === layoutInvalidation.args.data.frame) {\n rootCausesForShift.unsizedMedia.push(unsizedMediaRootCause);\n }\n if (iframeRootCause &&\n !rootCausesForShift.iframes.some(\n injectedIframe => injectedIframe.iframe.nodeId === iframeRootCause?.iframe.nodeId)) {\n rootCausesForShift.iframes.push(iframeRootCause);\n }\n if (fontChangeRootCause) {\n // Unlike other root causes, we calculate fonts causing a shift only once,\n // which means we assign the built array instead of appending new objects\n // to it.\n rootCausesForShift.fontChanges = fontChangeRootCause;\n }\n if (renderBlockRootCause) {\n rootCausesForShift.renderBlockingRequests = renderBlockRootCause;\n }\n }\n }\n }\n\n /**\n * For every shift looks up the initiator of its corresponding Layout event. This initiator\n * is assigned by the RendererHandler and contains the stack trace of the point in a script\n * that caused a style recalculation or a relayout. This stack trace is added to the shift's\n * potential root causes.\n * Note that a Layout cannot always be linked to a script, in that case, we cannot add a\n * \"script causing reflow\" as a potential root cause to the corresponding shift.\n */\n linkShiftsToLayoutEvents(layoutShifts: Types.TraceEvents.TraceEventLayoutShift[], modelData: TraceParseData): void {\n const {prePaintEvents} = modelData.LayoutShifts;\n // Maps from PrePaint events to LayoutShifts that occured in each one.\n const shiftsByPrePaint = getShiftsByPrePaintEvents(layoutShifts, prePaintEvents);\n\n const eventTriggersLayout = ({name}: {name: string}): boolean => {\n const knownName = name as Types.TraceEvents.KnownEventName;\n return knownName === Types.TraceEvents.KnownEventName.Layout;\n };\n const layoutEvents = modelData.Renderer.allTraceEntries.filter(eventTriggersLayout);\n for (const layout of layoutEvents) {\n // Get the first PrePaint event that happened after the current layout event.\n const nextPrePaintIndex = Platform.ArrayUtilities.nearestIndexFromBeginning(\n prePaintEvents, prePaint => prePaint.ts > layout.ts + (layout.dur || 0));\n if (nextPrePaintIndex === null) {\n // No PrePaint event registered after this LayoutInvalidation. Continue.\n continue;\n }\n const nextPrePaint = prePaintEvents[nextPrePaintIndex];\n const subsequentShifts = shiftsByPrePaint.get(nextPrePaint);\n if (!subsequentShifts) {\n // The PrePaint after the current LayoutInvalidation doesn't contain shifts.\n continue;\n }\n const layoutNode = modelData.Renderer.entryToNode.get(layout);\n const initiator = layoutNode ? modelData.Initiators.eventToInitiator.get(layoutNode.entry) : null;\n const stackTrace = initiator?.args?.data?.stackTrace;\n if (!stackTrace) {\n continue;\n }\n // Add found potential root causes to all the shifts in this PrePaint and populate the cache.\n for (const shift of subsequentShifts) {\n const rootCausesForShift = Platform.MapUtilities.getWithDefault(this.#rootCauseCacheMap, shift, () => {\n return {\n unsizedMedia: [],\n iframes: [],\n fontChanges: [],\n renderBlockingRequests: [],\n scriptStackTrace: [],\n };\n });\n if (rootCausesForShift.scriptStackTrace.length === 0) {\n rootCausesForShift.scriptStackTrace = stackTrace;\n }\n }\n }\n }\n\n /**\n * Given a LayoutInvalidation trace event, determines if it was dispatched\n * because a media element without dimensions was resized.\n */\n async getUnsizedMediaRootCause(\n reason: Types.TraceEvents.LayoutInvalidationReason,\n layoutInvalidationNode: Protocol.DOM.Node): Promise<UnsizedMedia|null> {\n // Filter events to resizes only.\n if (reason !== Types.TraceEvents.LayoutInvalidationReason.SIZE_CHANGED) {\n return null;\n }\n const computedStylesList = await this.#protocolInterface.getComputedStyleForNode(layoutInvalidationNode.nodeId);\n const computedStyles = new Map(computedStylesList.map(item => [item.name, item.value]));\n if (computedStyles && !(await nodeIsUnfixedMedia(layoutInvalidationNode, computedStyles))) {\n return null;\n }\n const authoredDimensions = await this.getNodeAuthoredDimensions(layoutInvalidationNode);\n if (dimensionsAreExplicit(authoredDimensions)) {\n return null;\n }\n const computedDimensions = computedStyles ? getNodeComputedDimensions(computedStyles) : {};\n\n return {node: layoutInvalidationNode, authoredDimensions, computedDimensions};\n }\n\n /**\n * Given a LayoutInvalidation trace event, determines if it was dispatched\n * because a node, which is an ancestor to an iframe, was injected.\n */\n getIframeRootCause(reason: Types.TraceEvents.LayoutInvalidationReason, layoutInvalidationDOMNode: Protocol.DOM.Node):\n InjectedIframe|null {\n if (layoutInvalidationDOMNode.nodeName !== 'IFRAME' &&\n reason !== Types.TraceEvents.LayoutInvalidationReason.STYLE_CHANGED &&\n reason !== Types.TraceEvents.LayoutInvalidationReason.ADDED_TO_LAYOUT) {\n return null;\n }\n const iframe = firstIframeInDOMTree(layoutInvalidationDOMNode);\n if (!iframe) {\n return null;\n }\n return {iframe};\n }\n\n /**\n * Given a layout invalidation event and a sorted array, returns the subset of requests that arrived within a\n * 500ms window before the layout invalidation.\n */\n requestsInInvalidationWindow(\n layoutInvalidation: Types.TraceEvents.TraceEventLayoutInvalidationTracking|\n Types.TraceEvents.TraceEventScheduleStyleInvalidationTracking,\n modelData: TraceParseData): RootCauseRequest[] {\n const requestsSortedByEndTime = modelData.NetworkRequests.byTime.sort((req1, req2) => {\n const req1EndTime = req1.ts + req1.dur;\n const req2EndTime = req2.ts + req2.dur;\n return req1EndTime - req2EndTime;\n });\n\n const lastRequestIndex = Platform.ArrayUtilities.nearestIndexFromEnd(\n requestsSortedByEndTime, request => request.ts + request.dur < layoutInvalidation.ts);\n if (lastRequestIndex === null) {\n return [];\n }\n\n const MAX_DELTA_FOR_FONT_REQUEST = Helpers.Timing.secondsToMicroseconds(Types.Timing.Seconds(0.5));\n\n const requestsInInvalidationWindow: RootCauseRequest[] = [];\n\n // Get all requests finished within the valid window.\n for (let i = lastRequestIndex; i > -1; i--) {\n const previousRequest = requestsSortedByEndTime[i];\n const previousRequestEndTime = previousRequest.ts + previousRequest.dur;\n if (layoutInvalidation.ts - previousRequestEndTime < MAX_DELTA_FOR_FONT_REQUEST) {\n const requestInInvalidationWindow: RootCauseRequest = {request: previousRequest};\n\n const initiator = this.#protocolInterface.getInitiatorForRequest(\n previousRequest.args.data.url as Platform.DevToolsPath.UrlString);\n requestInInvalidationWindow.initiator = initiator || undefined;\n requestsInInvalidationWindow.push(requestInInvalidationWindow);\n } else {\n // No more requests fit in the time window.\n break;\n }\n }\n return requestsInInvalidationWindow;\n }\n\n /**\n * Given a LayoutInvalidation trace event, determines if it was dispatched\n * because fonts were changed and if so returns the information of all network\n * request with which the fonts were possibly fetched, if any. The computed\n * network requests are cached for the corresponding prepaint event, meaning\n * that other LayoutInvalidation events that correspond to the same prepaint\n * are not processed and the cached network requests for the prepaint is\n * returned instead.\n */\n getFontChangeRootCause(\n layoutInvalidation: Types.TraceEvents.TraceEventLayoutInvalidationTracking|\n Types.TraceEvents.TraceEventScheduleStyleInvalidationTracking,\n nextPrePaint: Types.TraceEvents.TraceEventPrePaint, modelData: TraceParseData): FontChange[]|null {\n if (layoutInvalidation.args.data.reason !== Types.TraceEvents.LayoutInvalidationReason.FONTS_CHANGED) {\n return null;\n }\n // Prevent computing the result of this function multiple times per PrePaint event.\n const fontRequestsForPrepaint = fontRequestsByPrePaint.get(nextPrePaint);\n if (fontRequestsForPrepaint !== undefined) {\n return fontRequestsForPrepaint;\n }\n\n const fontRequestsInThisPrepaint =\n this.getFontRequestsInInvalidationWindow(this.requestsInInvalidationWindow(layoutInvalidation, modelData));\n fontRequestsByPrePaint.set(nextPrePaint, fontRequestsInThisPrepaint);\n return fontRequestsInThisPrepaint;\n }\n\n /**\n * Given the requests that arrived within a 500ms window before the layout invalidation, returns the font\n * requests of them.\n */\n getFontRequestsInInvalidationWindow(requestsInInvalidationWindow: RootCauseRequest[]): FontChange[] {\n const fontRequests: FontChange[] = [];\n\n // Get all requests finished within the valid window.\n for (let i = 0; i < requestsInInvalidationWindow.length; i++) {\n const fontRequest = requestsInInvalidationWindow[i] as FontChange;\n if (!fontRequest.request.args.data.mimeType.startsWith('font')) {\n continue;\n }\n\n const fontFace = this.#protocolInterface.fontFaceForSource(fontRequest.request.args.data.url);\n if (!fontFace || fontFace.fontDisplay === 'optional') {\n // Setting font-display to optional is part of what the developer\n // can do to avoid layout shifts due to FOIT/FOUT, as such we cannot\n // suggest any actionable insight here.\n continue;\n }\n fontRequest.fontFace = fontFace;\n fontRequests.push(fontRequest);\n }\n return fontRequests;\n }\n\n /**\n * Given a LayoutInvalidation trace event, determines if it arrived within a 500ms window before the layout\n * invalidation and if so returns the information of all network request, if any. The computed network\n * requests are cached for the corresponding prepaint event, meaning that other LayoutInvalidation events\n * that correspond to the same prepaint are not processed and the cached network requests for the prepaint is\n * returned instead.\n */\n getRenderBlockRootCause(\n layoutInvalidation: Types.TraceEvents.TraceEventLayoutInvalidationTracking|\n Types.TraceEvents.TraceEventScheduleStyleInvalidationTracking,\n nextPrePaint: Types.TraceEvents.TraceEventPrePaint, modelData: TraceParseData): RenderBlockingRequest[]|null {\n // Prevent computing the result of this function multiple times per PrePaint event.\n const renderBlocksInPrepaint = renderBlocksByPrePaint.get(nextPrePaint);\n if (renderBlocksInPrepaint !== undefined) {\n return renderBlocksInPrepaint;\n }\n\n const renderBlocksInThisPrepaint =\n getRenderBlockRequestsInInvalidationWindow(this.requestsInInvalidationWindow(layoutInvalidation, modelData));\n renderBlocksByPrePaint.set(nextPrePaint, renderBlocksInThisPrepaint);\n return renderBlocksInThisPrepaint;\n }\n\n /**\n * Returns a function that retrieves the active value of a given\n * CSS property within the matched styles of the param node.\n * The first occurence within the matched styles is returned and the\n * value is looked up in the following order, which follows CSS\n * specificity:\n * 1. Inline styles.\n * 2. CSS rules matching this node, from all applicable stylesheets.\n * 3. Attribute defined styles.\n */\n async nodeMatchedStylesPropertyGetter(node: Protocol.DOM.Node): Promise<((property: string) => string | null)> {\n const response = await this.#protocolInterface.getMatchedStylesForNode(node.nodeId);\n\n function cssPropertyValueGetter(cssProperty: string): string|null {\n let prop = response.inlineStyle?.cssProperties.find(prop => prop.name === cssProperty);\n if (prop) {\n return prop.value;\n }\n\n for (const {rule} of response.matchedCSSRules || []) {\n const prop = rule.style.cssProperties.find(prop => prop.name === cssProperty);\n if (prop) {\n return prop.value;\n }\n }\n\n prop = response.attributesStyle?.cssProperties.find(prop => prop.name === cssProperty);\n if (prop) {\n return prop.value;\n }\n\n return null;\n }\n return cssPropertyValueGetter;\n }\n\n /**\n * Returns the CSS dimensions set to the node from its matched styles.\n */\n async getNodeAuthoredDimensions(node: Protocol.DOM.Node): Promise<CSSDimensions> {\n const authoredDimensions: CSSDimensions = {};\n\n const cssMatchedRulesGetter = await this.nodeMatchedStylesPropertyGetter(node);\n if (!cssMatchedRulesGetter) {\n return authoredDimensions;\n }\n\n const attributesFlat = node.attributes || [];\n const attributes = [];\n for (let i = 0; i < attributesFlat.length; i += 2) {\n attributes.push({name: attributesFlat[i], value: attributesFlat[i + 1]});\n }\n\n const htmlHeight = attributes.find(attr => attr.name === 'height' && htmlAttributeIsExplicit(attr));\n const htmlWidth = attributes.find(attr => attr.name === 'width' && htmlAttributeIsExplicit(attr));\n\n const cssExplicitAspectRatio = cssMatchedRulesGetter('aspect-ratio') || undefined;\n\n if (htmlHeight && htmlWidth && cssExplicitAspectRatio) {\n return {height: htmlHeight.value, width: htmlWidth.value, aspectRatio: cssExplicitAspectRatio};\n }\n\n const cssHeight = cssMatchedRulesGetter('height') || undefined;\n const cssWidth = cssMatchedRulesGetter('width') || undefined;\n return {height: cssHeight, width: cssWidth, aspectRatio: cssExplicitAspectRatio};\n }\n}\n\n/**\n * Given the requests that arrived within a 500ms window before the layout invalidation, returns the render\n * block requests of them.\n */\nfunction getRenderBlockRequestsInInvalidationWindow(requestsInInvalidationWindow: RootCauseRequest[]):\n RenderBlockingRequest[] {\n const renderBlockingRequests: RenderBlockingRequest[] = [];\n\n // Get all requests finished within the valid window.\n for (let i = 0; i < requestsInInvalidationWindow.length; i++) {\n const mainFrameId = requestsInInvalidationWindow[i].request.args.data.frame;\n if (!networkRequestIsRenderBlockingInFrame(requestsInInvalidationWindow[i].request, mainFrameId)) {\n continue;\n }\n renderBlockingRequests.push(requestsInInvalidationWindow[i] as RenderBlockingRequest);\n }\n return renderBlockingRequests;\n}\n\nfunction firstIframeInDOMTree(root: Protocol.DOM.Node): Protocol.DOM.Node|null {\n if (root.nodeName === 'IFRAME') {\n return root;\n }\n const children = root.children;\n if (!children) {\n return null;\n }\n for (const child of children) {\n const iFrameInChild = firstIframeInDOMTree(child);\n if (iFrameInChild) {\n return iFrameInChild;\n }\n }\n return null;\n}\n\nfunction cssPropertyIsExplicitlySet(propertyValue: string): boolean {\n return !['auto', 'initial', 'unset', 'inherit'].includes(propertyValue);\n}\n\nfunction htmlAttributeIsExplicit(attr: {value: string}): boolean {\n return parseInt(attr.value, 10) >= 0;\n}\n\nfunction computedStyleHasBackroundImage(computedStyle: Map<string, string>): boolean {\n const CSS_URL_REGEX = /^url\\(\"([^\"]+)\"\\)$/;\n const backgroundImage = computedStyle.get('background-image');\n if (!backgroundImage) {\n return false;\n }\n return CSS_URL_REGEX.test(backgroundImage);\n}\n\nfunction computedStyleHasFixedPosition(computedStyle: Map<string, string>): boolean {\n const position = computedStyle.get('position');\n if (!position) {\n return false;\n }\n return position === 'fixed' || position === 'absolute';\n}\n\nfunction getNodeComputedDimensions(computedStyle: Map<string, string>): CSSDimensions {\n const computedDimensions: CSSDimensions = {};\n computedDimensions.height = computedStyle.get('height');\n computedDimensions.width = computedStyle.get('width');\n computedDimensions.aspectRatio = computedStyle.get('aspect-ratio');\n return computedDimensions;\n}\n\n/**\n * Determines if a node is a media element and is not fixed positioned\n * (i.e. \"position: fixed;\" or \"position: absolute;\")\n */\nasync function nodeIsUnfixedMedia(node: Protocol.DOM.Node, computedStyle: Map<string, string>): Promise<boolean> {\n const localName = node.localName;\n const isBackgroundImage = computedStyleHasBackroundImage(computedStyle);\n if (localName !== 'img' && localName !== 'video' && !isBackgroundImage) {\n // Not a media element.\n return false;\n }\n const isFixed = computedStyleHasFixedPosition(computedStyle);\n return !isFixed;\n}\n\n/**\n * Determines if a CSS dimensions object explicitly defines both width and height\n * (i.e. not set to auto, inherit, etc.)\n */\nfunction dimensionsAreExplicit(dimensions: CSSDimensions): boolean {\n const {height, width, aspectRatio} = dimensions;\n\n const explicitHeight = Boolean(height && cssPropertyIsExplicitlySet(height));\n const explicitWidth = Boolean(width && cssPropertyIsExplicitlySet(width));\n const explicitAspectRatio = Boolean(aspectRatio && cssPropertyIsExplicitlySet(aspectRatio));\n\n const explicitWithAR = (explicitHeight || explicitWidth) && explicitAspectRatio;\n return (explicitHeight && explicitWidth) || explicitWithAR;\n}\n\n/**\n * Given an array of layout shift and PrePaint events, returns a mapping from\n * PrePaint events to layout shifts dispatched within it.\n */\nfunction getShiftsByPrePaintEvents(\n layoutShifts: Types.TraceEvents.TraceEventLayoutShift[],\n prePaintEvents: Types.TraceEvents.TraceEventPrePaint[],\n ): Map<Types.TraceEvents.TraceEventPrePaint, Types.TraceEvents.TraceEventLayoutShift[]> {\n // Maps from PrePaint events to LayoutShifts that occured in each one.\n const shiftsByPrePaint = new Map<Types.TraceEvents.TraceEventPrePaint, Types.TraceEvents.TraceEventLayoutShift[]>();\n\n // Associate all shifts to their corresponding PrePaint.\n for (const prePaintEvent of prePaintEvents) {\n const firstShiftIndex =\n Platform.ArrayUtilities.nearestIndexFromBeginning(layoutShifts, shift => shift.ts >= prePaintEvent.ts);\n if (firstShiftIndex === null) {\n // No layout shifts registered after this PrePaint start. Continue.\n continue;\n }\n for (let i = firstShiftIndex; i < layoutShifts.length; i++) {\n const shift = layoutShifts[i];\n if (shift.ts >= prePaintEvent.ts && shift.ts <= prePaintEvent.ts + prePaintEvent.dur) {\n const shiftsInPrePaint = Platform.MapUtilities.getWithDefault(shiftsByPrePaint, prePaintEvent, () => []);\n shiftsInPrePaint.push(shift);\n }\n if (shift.ts > prePaintEvent.ts + prePaintEvent.dur) {\n // Reached the end of this PrePaint. Continue to the next one.\n break;\n }\n }\n }\n return shiftsByPrePaint;\n}\n"],
5
- "mappings": "AAIA;AAGA;AACA;AAuCA,MAAM,yBAAyB,oBAAI;AACnC,MAAM,yBAAyB,oBAAI;AAEnC,yBACI,KACA,OAAsD;AACxD,WAAS,aAAa,eAAe,KAAK,OAAO,MAAM;AACrD,WAAO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B;AAE9E,QAAM,iBAAkB,mBAAkB,kBAAkB;AAC5D,SAAQ,kBAAkB,iBAAkB;AAAA;AAO9C,mCACI,cACA,gBACwF;AAE1F,QAAM,mBAAmB,oBAAI;AAG7B,aAAW,iBAAiB,gBAAgB;AAC1C,UAAM,kBACF,SAAS,eAAe,0BAA0B,cAAc,WAAS,MAAM,MAAM,cAAc;AACvG,QAAI,oBAAoB,MAAM;AAE5B;AAAA;AAEF,aAAS,IAAI,iBAAiB,IAAI,aAAa,QAAQ,KAAK;AAC1D,YAAM,QAAQ,aAAa;AAC3B,UAAI,MAAM,MAAM,cAAc,MAAM,MAAM,MAAM,cAAc,KAAK,cAAc,KAAK;AACpF,cAAM,mBAAmB,SAAS,aAAa,eAAe,kBAAkB,eAAe,MAAM;AACrG,yBAAiB,KAAK;AAAA;AAExB,UAAI,MAAM,KAAK,cAAc,KAAK,cAAc,KAAK;AAEnD;AAAA;AAAA;AAAA;AAIN,SAAO;AAAA;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"LayoutShift.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/root-causes/LayoutShift.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAG/D,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAuC3C,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAA2D,CAAC;AAClG,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAsE,CAAC;AAE7G,SAAS,eAAe,CACpB,GAA4E,EAC5E,KAA8C;IAChD,QAAQ,CAAC,YAAY,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE;QACpD,OAAO;YACL,YAAY,EAAE,EAAE;YAChB,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,EAAE;YACf,sBAAsB,EAAE,EAA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,eAAe,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC1D,MAAM,KAAK,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;YAC9B,IAAI,KAAK,CAAC,EAAE,IAAI,aAAa,CAAC,EAAE,IAAI,KAAK,CAAC,EAAE,IAAI,aAAa,CAAC,EAAE,GAAG,aAAa,CAAC,GAAG,EAAE;gBACpF,MAAM,gBAAgB,GAAG,QAAQ,CAAC,YAAY,CAAC,cAAc,CAAC,gBAAgB,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;gBACzG,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aAC9B;YACD,IAAI,KAAK,CAAC,EAAE,GAAG,aAAa,CAAC,EAAE,GAAG,aAAa,CAAC,GAAG,EAAE;gBACnD,8DAA8D;gBAC9D,MAAM;aACP;SACF;KACF;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["// Copyright 2023 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Platform from '../../../core/platform/platform.js';\nimport type * as Protocol from '../../../generated/protocol.js';\nimport {type TraceParseData} from '../handlers/types.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport {type RootCauseProtocolInterface} from './RootCauses.js';\n\nexport type CSSDimensions = {\n width?: string,\n height?: string,\n aspectRatio?: string,\n};\n\nexport interface UnsizedMedia {\n node: Protocol.DOM.Node;\n authoredDimensions?: CSSDimensions;\n computedDimensions: CSSDimensions;\n}\n\nexport interface InjectedIframe {\n iframe: Protocol.DOM.Node;\n}\n\nexport interface RootCauseRequest {\n request: Types.TraceEvents.SyntheticNetworkRequest;\n initiator?: Protocol.Network.Initiator;\n}\n\nexport interface FontChange extends RootCauseRequest {\n fontFace: Protocol.CSS.FontFace;\n}\n\nexport interface RenderBlockingRequest extends RootCauseRequest {}\n\nexport interface LayoutShiftRootCausesData {\n unsizedMedia: UnsizedMedia[];\n iframes: InjectedIframe[];\n fontChanges: FontChange[];\n renderBlockingRequests: RenderBlockingRequest[];\n scriptStackTrace: Types.TraceEvents.TraceEventCallFrame[];\n}\n\nconst fontRequestsByPrePaint = new Map<Types.TraceEvents.TraceEventPrePaint, FontChange[]|null>();\nconst renderBlocksByPrePaint = new Map<Types.TraceEvents.TraceEventPrePaint, RenderBlockingRequest[]|null>();\n\nfunction setDefaultValue(\n map: Map<Types.TraceEvents.TraceEventLayoutShift, LayoutShiftRootCausesData>,\n shift: Types.TraceEvents.TraceEventLayoutShift): void {\n Platform.MapUtilities.getWithDefault(map, shift, () => {\n return {\n unsizedMedia: [],\n iframes: [],\n fontChanges: [],\n renderBlockingRequests: [],\n scriptStackTrace: [],\n };\n });\n}\n\n// Important: we purposefully treat `potentially_blocking` as\n// non-render-blocking here because:\n// 1. An async script can run on the main thread at any point, including before\n// the page is loaded\n// 2. An async script will never block the parsing and rendering process of the\n// browser.\n// 3. Therefore, from a developer's point of view, there is nothing more they\n// can do if they've put `async` on, and within the context of Insights, we\n// shouldn't report an async script as render blocking.\n// In the future we may want to consider suggesting the use of `defer` over\n// `async`, as it doesn't have this concern, but for now we'll allow `async`\n// and not report it as an issue.\nconst NON_RENDER_BLOCKING_VALUES = new Set<Types.TraceEvents.RenderBlocking>([\n 'non_blocking',\n 'potentially_blocking',\n]);\nfunction networkRequestIsRenderBlockingInFrame(\n event: Types.TraceEvents.SyntheticNetworkRequest, frameId: string): boolean {\n const isRenderBlocking = !NON_RENDER_BLOCKING_VALUES.has(event.args.data.renderBlocking);\n return isRenderBlocking && event.args.data.frame === frameId;\n}\n\nexport class LayoutShiftRootCauses {\n #protocolInterface: RootCauseProtocolInterface;\n #rootCauseCacheMap = new Map<Types.TraceEvents.TraceEventLayoutShift, LayoutShiftRootCausesData>();\n\n constructor(protocolInterface: RootCauseProtocolInterface) {\n this.#protocolInterface = protocolInterface;\n }\n\n /**\n * Calculates the potential root causes for a given layout shift event. Once\n * calculated, this data is cached.\n * Note: because you need all layout shift data at once to calculate these\n * correctly, this function will parse the root causes for _all_ layout shift\n * events the first time that it's called. That then populates the cache for\n * each shift, so any subsequent calls are just a constant lookup.\n */\n async rootCausesForEvent(modelData: TraceParseData, event: Types.TraceEvents.TraceEventLayoutShift):\n Promise<Readonly<LayoutShiftRootCausesData>|null> {\n const cachedResult = this.#rootCauseCacheMap.get(event);\n if (cachedResult) {\n return cachedResult;\n }\n\n const allLayoutShifts = modelData.LayoutShifts.clusters.flatMap(cluster => cluster.events);\n // Make sure a value in the cache is set even for shifts that don't have a root cause,\n // so that we don't have to recompute when no root causes are found. In case a cause\n // for a shift is found, the default value is replaced.\n allLayoutShifts.forEach(shift => setDefaultValue(this.#rootCauseCacheMap, shift));\n\n // Populate the cache\n await this.blameShifts(\n allLayoutShifts,\n modelData,\n );\n\n const resultForEvent = this.#rootCauseCacheMap.get(event);\n if (!resultForEvent) {\n // No root causes available for this layout shift.\n return null;\n }\n return resultForEvent;\n }\n\n /**\n * Determines potential root causes for shifts\n */\n async blameShifts(\n layoutShifts: Types.TraceEvents.TraceEventLayoutShift[],\n modelData: TraceParseData,\n ): Promise<void> {\n await this.linkShiftsToLayoutInvalidations(layoutShifts, modelData);\n this.linkShiftsToLayoutEvents(layoutShifts, modelData);\n }\n\n /**\n * \"LayoutInvalidations\" are a set of trace events dispatched in Blink under the name\n * \"layoutInvalidationTracking\", which track invalidations on the \"Layout\"stage of the\n * rendering pipeline. This function utilizes this event to flag potential root causes\n * to layout shifts.\n */\n async linkShiftsToLayoutInvalidations(\n layoutShifts: Types.TraceEvents.TraceEventLayoutShift[], modelData: TraceParseData): Promise<void> {\n const {prePaintEvents, layoutInvalidationEvents, scheduleStyleInvalidationEvents, backendNodeIds} =\n modelData.LayoutShifts;\n\n // For the purposes of determining root causes of layout shifts, we\n // consider scheduleStyleInvalidationTracking and\n // LayoutInvalidationTracking events as events that could have been the\n // cause of the layout shift.\n const eventsForLayoutInvalidation: Array<Types.TraceEvents.TraceEventLayoutInvalidationTracking|\n Types.TraceEvents.TraceEventScheduleStyleInvalidationTracking> =\n [...layoutInvalidationEvents, ...scheduleStyleInvalidationEvents];\n\n const nodes = await this.#protocolInterface.pushNodesByBackendIdsToFrontend(backendNodeIds);\n const nodeIdsByBackendIdMap = new Map<Protocol.DOM.BackendNodeId, Protocol.DOM.NodeId>();\n for (let i = 0; i < backendNodeIds.length; i++) {\n nodeIdsByBackendIdMap.set(backendNodeIds[i], nodes[i]);\n }\n\n // Maps from PrePaint events to LayoutShifts that occured in each one.\n const shiftsByPrePaint = getShiftsByPrePaintEvents(layoutShifts, prePaintEvents);\n for (const layoutInvalidation of eventsForLayoutInvalidation) {\n // Get the first PrePaint event that happened after the current LayoutInvalidation event.\n const nextPrePaintIndex = Platform.ArrayUtilities.nearestIndexFromBeginning(\n prePaintEvents, prePaint => prePaint.ts > layoutInvalidation.ts);\n if (nextPrePaintIndex === null) {\n // No PrePaint event registered after this LayoutInvalidation. Continue.\n continue;\n }\n const nextPrePaint = prePaintEvents[nextPrePaintIndex];\n const subsequentShifts = shiftsByPrePaint.get(nextPrePaint);\n if (!subsequentShifts) {\n // The PrePaint after the current LayoutInvalidation doesn't contain shifts.\n continue;\n }\n const fontChangeRootCause = this.getFontChangeRootCause(layoutInvalidation, nextPrePaint, modelData);\n const renderBlockRootCause = this.getRenderBlockRootCause(layoutInvalidation, nextPrePaint, modelData);\n const layoutInvalidationNodeId = nodeIdsByBackendIdMap.get(layoutInvalidation.args.data.nodeId);\n const layoutInvalidationNode = layoutInvalidationNodeId !== undefined ?\n await this.#protocolInterface.getNode(layoutInvalidationNodeId) :\n null;\n let unsizedMediaRootCause: UnsizedMedia|null = null;\n let iframeRootCause: InjectedIframe|null = null;\n if (layoutInvalidationNode && layoutInvalidation.args.data.reason) {\n unsizedMediaRootCause =\n await this.getUnsizedMediaRootCause(layoutInvalidation.args.data.reason, layoutInvalidationNode);\n iframeRootCause = this.getIframeRootCause(layoutInvalidation.args.data.reason, layoutInvalidationNode);\n }\n\n if (!unsizedMediaRootCause && !iframeRootCause && !fontChangeRootCause && !renderBlockRootCause) {\n continue;\n }\n\n // Add found potential root causes to all the shifts in this PrePaint and populate the cache.\n for (const shift of subsequentShifts) {\n const rootCausesForShift = Platform.MapUtilities.getWithDefault(this.#rootCauseCacheMap, shift, () => {\n return {\n unsizedMedia: [],\n iframes: [],\n fontChanges: [],\n renderBlockingRequests: [],\n scriptStackTrace: [],\n };\n });\n if (unsizedMediaRootCause &&\n !rootCausesForShift.unsizedMedia.some(media => media.node.nodeId === unsizedMediaRootCause?.node.nodeId) &&\n shift.args.frame === layoutInvalidation.args.data.frame) {\n rootCausesForShift.unsizedMedia.push(unsizedMediaRootCause);\n }\n if (iframeRootCause &&\n !rootCausesForShift.iframes.some(\n injectedIframe => injectedIframe.iframe.nodeId === iframeRootCause?.iframe.nodeId)) {\n rootCausesForShift.iframes.push(iframeRootCause);\n }\n if (fontChangeRootCause) {\n // Unlike other root causes, we calculate fonts causing a shift only once,\n // which means we assign the built array instead of appending new objects\n // to it.\n rootCausesForShift.fontChanges = fontChangeRootCause;\n }\n if (renderBlockRootCause) {\n rootCausesForShift.renderBlockingRequests = renderBlockRootCause;\n }\n }\n }\n }\n\n /**\n * For every shift looks up the initiator of its corresponding Layout event. This initiator\n * is assigned by the RendererHandler and contains the stack trace of the point in a script\n * that caused a style recalculation or a relayout. This stack trace is added to the shift's\n * potential root causes.\n * Note that a Layout cannot always be linked to a script, in that case, we cannot add a\n * \"script causing reflow\" as a potential root cause to the corresponding shift.\n */\n linkShiftsToLayoutEvents(layoutShifts: Types.TraceEvents.TraceEventLayoutShift[], modelData: TraceParseData): void {\n const {prePaintEvents} = modelData.LayoutShifts;\n // Maps from PrePaint events to LayoutShifts that occured in each one.\n const shiftsByPrePaint = getShiftsByPrePaintEvents(layoutShifts, prePaintEvents);\n\n const eventTriggersLayout = ({name}: {name: string}): boolean => {\n const knownName = name as Types.TraceEvents.KnownEventName;\n return knownName === Types.TraceEvents.KnownEventName.Layout;\n };\n const layoutEvents = modelData.Renderer.allTraceEntries.filter(eventTriggersLayout);\n for (const layout of layoutEvents) {\n // Get the first PrePaint event that happened after the current layout event.\n const nextPrePaintIndex = Platform.ArrayUtilities.nearestIndexFromBeginning(\n prePaintEvents, prePaint => prePaint.ts > layout.ts + (layout.dur || 0));\n if (nextPrePaintIndex === null) {\n // No PrePaint event registered after this LayoutInvalidation. Continue.\n continue;\n }\n const nextPrePaint = prePaintEvents[nextPrePaintIndex];\n const subsequentShifts = shiftsByPrePaint.get(nextPrePaint);\n if (!subsequentShifts) {\n // The PrePaint after the current LayoutInvalidation doesn't contain shifts.\n continue;\n }\n const layoutNode = modelData.Renderer.entryToNode.get(layout);\n const initiator = layoutNode ? modelData.Initiators.eventToInitiator.get(layoutNode.entry) : null;\n const stackTrace = initiator?.args?.data?.stackTrace;\n if (!stackTrace) {\n continue;\n }\n // Add found potential root causes to all the shifts in this PrePaint and populate the cache.\n for (const shift of subsequentShifts) {\n const rootCausesForShift = Platform.MapUtilities.getWithDefault(this.#rootCauseCacheMap, shift, () => {\n return {\n unsizedMedia: [],\n iframes: [],\n fontChanges: [],\n renderBlockingRequests: [],\n scriptStackTrace: [],\n };\n });\n if (rootCausesForShift.scriptStackTrace.length === 0) {\n rootCausesForShift.scriptStackTrace = stackTrace;\n }\n }\n }\n }\n\n /**\n * Given a LayoutInvalidation trace event, determines if it was dispatched\n * because a media element without dimensions was resized.\n */\n async getUnsizedMediaRootCause(\n reason: Types.TraceEvents.LayoutInvalidationReason,\n layoutInvalidationNode: Protocol.DOM.Node): Promise<UnsizedMedia|null> {\n // Filter events to resizes only.\n if (reason !== Types.TraceEvents.LayoutInvalidationReason.SIZE_CHANGED) {\n return null;\n }\n const computedStylesList = await this.#protocolInterface.getComputedStyleForNode(layoutInvalidationNode.nodeId);\n const computedStyles = new Map(computedStylesList.map(item => [item.name, item.value]));\n if (computedStyles && !(await nodeIsUnfixedMedia(layoutInvalidationNode, computedStyles))) {\n return null;\n }\n const authoredDimensions = await this.getNodeAuthoredDimensions(layoutInvalidationNode);\n if (dimensionsAreExplicit(authoredDimensions)) {\n return null;\n }\n const computedDimensions = computedStyles ? getNodeComputedDimensions(computedStyles) : {};\n\n return {node: layoutInvalidationNode, authoredDimensions, computedDimensions};\n }\n\n /**\n * Given a LayoutInvalidation trace event, determines if it was dispatched\n * because a node, which is an ancestor to an iframe, was injected.\n */\n getIframeRootCause(reason: Types.TraceEvents.LayoutInvalidationReason, layoutInvalidationDOMNode: Protocol.DOM.Node):\n InjectedIframe|null {\n if (layoutInvalidationDOMNode.nodeName !== 'IFRAME' &&\n reason !== Types.TraceEvents.LayoutInvalidationReason.STYLE_CHANGED &&\n reason !== Types.TraceEvents.LayoutInvalidationReason.ADDED_TO_LAYOUT) {\n return null;\n }\n const iframe = firstIframeInDOMTree(layoutInvalidationDOMNode);\n if (!iframe) {\n return null;\n }\n return {iframe};\n }\n\n /**\n * Given a layout invalidation event and a sorted array, returns the subset of requests that arrived within a\n * 500ms window before the layout invalidation.\n */\n requestsInInvalidationWindow(\n layoutInvalidation: Types.TraceEvents.TraceEventLayoutInvalidationTracking|\n Types.TraceEvents.TraceEventScheduleStyleInvalidationTracking,\n modelData: TraceParseData): RootCauseRequest[] {\n const requestsSortedByEndTime = modelData.NetworkRequests.byTime.sort((req1, req2) => {\n const req1EndTime = req1.ts + req1.dur;\n const req2EndTime = req2.ts + req2.dur;\n return req1EndTime - req2EndTime;\n });\n\n const lastRequestIndex = Platform.ArrayUtilities.nearestIndexFromEnd(\n requestsSortedByEndTime, request => request.ts + request.dur < layoutInvalidation.ts);\n if (lastRequestIndex === null) {\n return [];\n }\n\n const MAX_DELTA_FOR_FONT_REQUEST = Helpers.Timing.secondsToMicroseconds(Types.Timing.Seconds(0.5));\n\n const requestsInInvalidationWindow: RootCauseRequest[] = [];\n\n // Get all requests finished within the valid window.\n for (let i = lastRequestIndex; i > -1; i--) {\n const previousRequest = requestsSortedByEndTime[i];\n const previousRequestEndTime = previousRequest.ts + previousRequest.dur;\n if (layoutInvalidation.ts - previousRequestEndTime < MAX_DELTA_FOR_FONT_REQUEST) {\n const requestInInvalidationWindow: RootCauseRequest = {request: previousRequest};\n\n const initiator = this.#protocolInterface.getInitiatorForRequest(\n previousRequest.args.data.url as Platform.DevToolsPath.UrlString);\n requestInInvalidationWindow.initiator = initiator || undefined;\n requestsInInvalidationWindow.push(requestInInvalidationWindow);\n } else {\n // No more requests fit in the time window.\n break;\n }\n }\n return requestsInInvalidationWindow;\n }\n\n /**\n * Given a LayoutInvalidation trace event, determines if it was dispatched\n * because fonts were changed and if so returns the information of all network\n * request with which the fonts were possibly fetched, if any. The computed\n * network requests are cached for the corresponding prepaint event, meaning\n * that other LayoutInvalidation events that correspond to the same prepaint\n * are not processed and the cached network requests for the prepaint is\n * returned instead.\n */\n getFontChangeRootCause(\n layoutInvalidation: Types.TraceEvents.TraceEventLayoutInvalidationTracking|\n Types.TraceEvents.TraceEventScheduleStyleInvalidationTracking,\n nextPrePaint: Types.TraceEvents.TraceEventPrePaint, modelData: TraceParseData): FontChange[]|null {\n if (layoutInvalidation.args.data.reason !== Types.TraceEvents.LayoutInvalidationReason.FONTS_CHANGED) {\n return null;\n }\n // Prevent computing the result of this function multiple times per PrePaint event.\n const fontRequestsForPrepaint = fontRequestsByPrePaint.get(nextPrePaint);\n if (fontRequestsForPrepaint !== undefined) {\n return fontRequestsForPrepaint;\n }\n\n const fontRequestsInThisPrepaint =\n this.getFontRequestsInInvalidationWindow(this.requestsInInvalidationWindow(layoutInvalidation, modelData));\n fontRequestsByPrePaint.set(nextPrePaint, fontRequestsInThisPrepaint);\n return fontRequestsInThisPrepaint;\n }\n\n /**\n * Given the requests that arrived within a 500ms window before the layout invalidation, returns the font\n * requests of them.\n */\n getFontRequestsInInvalidationWindow(requestsInInvalidationWindow: RootCauseRequest[]): FontChange[] {\n const fontRequests: FontChange[] = [];\n\n // Get all requests finished within the valid window.\n for (let i = 0; i < requestsInInvalidationWindow.length; i++) {\n const fontRequest = requestsInInvalidationWindow[i] as FontChange;\n if (!fontRequest.request.args.data.mimeType.startsWith('font')) {\n continue;\n }\n\n const fontFace = this.#protocolInterface.fontFaceForSource(fontRequest.request.args.data.url);\n if (!fontFace || fontFace.fontDisplay === 'optional') {\n // Setting font-display to optional is part of what the developer\n // can do to avoid layout shifts due to FOIT/FOUT, as such we cannot\n // suggest any actionable insight here.\n continue;\n }\n fontRequest.fontFace = fontFace;\n fontRequests.push(fontRequest);\n }\n return fontRequests;\n }\n\n /**\n * Given a LayoutInvalidation trace event, determines if it arrived within a 500ms window before the layout\n * invalidation and if so returns the information of all network request, if any. The computed network\n * requests are cached for the corresponding prepaint event, meaning that other LayoutInvalidation events\n * that correspond to the same prepaint are not processed and the cached network requests for the prepaint is\n * returned instead.\n */\n getRenderBlockRootCause(\n layoutInvalidation: Types.TraceEvents.TraceEventLayoutInvalidationTracking|\n Types.TraceEvents.TraceEventScheduleStyleInvalidationTracking,\n nextPrePaint: Types.TraceEvents.TraceEventPrePaint, modelData: TraceParseData): RenderBlockingRequest[]|null {\n // Prevent computing the result of this function multiple times per PrePaint event.\n const renderBlocksInPrepaint = renderBlocksByPrePaint.get(nextPrePaint);\n if (renderBlocksInPrepaint !== undefined) {\n return renderBlocksInPrepaint;\n }\n\n const renderBlocksInThisPrepaint =\n getRenderBlockRequestsInInvalidationWindow(this.requestsInInvalidationWindow(layoutInvalidation, modelData));\n renderBlocksByPrePaint.set(nextPrePaint, renderBlocksInThisPrepaint);\n return renderBlocksInThisPrepaint;\n }\n\n /**\n * Returns a function that retrieves the active value of a given\n * CSS property within the matched styles of the param node.\n * The first occurence within the matched styles is returned and the\n * value is looked up in the following order, which follows CSS\n * specificity:\n * 1. Inline styles.\n * 2. CSS rules matching this node, from all applicable stylesheets.\n * 3. Attribute defined styles.\n */\n async nodeMatchedStylesPropertyGetter(node: Protocol.DOM.Node): Promise<((property: string) => string | null)> {\n const response = await this.#protocolInterface.getMatchedStylesForNode(node.nodeId);\n\n function cssPropertyValueGetter(cssProperty: string): string|null {\n let prop = response.inlineStyle?.cssProperties.find(prop => prop.name === cssProperty);\n if (prop) {\n return prop.value;\n }\n\n for (const {rule} of response.matchedCSSRules || []) {\n const prop = rule.style.cssProperties.find(prop => prop.name === cssProperty);\n if (prop) {\n return prop.value;\n }\n }\n\n prop = response.attributesStyle?.cssProperties.find(prop => prop.name === cssProperty);\n if (prop) {\n return prop.value;\n }\n\n return null;\n }\n return cssPropertyValueGetter;\n }\n\n /**\n * Returns the CSS dimensions set to the node from its matched styles.\n */\n async getNodeAuthoredDimensions(node: Protocol.DOM.Node): Promise<CSSDimensions> {\n const authoredDimensions: CSSDimensions = {};\n\n const cssMatchedRulesGetter = await this.nodeMatchedStylesPropertyGetter(node);\n if (!cssMatchedRulesGetter) {\n return authoredDimensions;\n }\n\n const attributesFlat = node.attributes || [];\n const attributes = [];\n for (let i = 0; i < attributesFlat.length; i += 2) {\n attributes.push({name: attributesFlat[i], value: attributesFlat[i + 1]});\n }\n\n const htmlHeight = attributes.find(attr => attr.name === 'height' && htmlAttributeIsExplicit(attr));\n const htmlWidth = attributes.find(attr => attr.name === 'width' && htmlAttributeIsExplicit(attr));\n\n const cssExplicitAspectRatio = cssMatchedRulesGetter('aspect-ratio') || undefined;\n\n if (htmlHeight && htmlWidth && cssExplicitAspectRatio) {\n return {height: htmlHeight.value, width: htmlWidth.value, aspectRatio: cssExplicitAspectRatio};\n }\n\n const cssHeight = cssMatchedRulesGetter('height') || undefined;\n const cssWidth = cssMatchedRulesGetter('width') || undefined;\n return {height: cssHeight, width: cssWidth, aspectRatio: cssExplicitAspectRatio};\n }\n}\n\n/**\n * Given the requests that arrived within a 500ms window before the layout invalidation, returns the render\n * block requests of them.\n */\nfunction getRenderBlockRequestsInInvalidationWindow(requestsInInvalidationWindow: RootCauseRequest[]):\n RenderBlockingRequest[] {\n const renderBlockingRequests: RenderBlockingRequest[] = [];\n\n // Get all requests finished within the valid window.\n for (let i = 0; i < requestsInInvalidationWindow.length; i++) {\n const mainFrameId = requestsInInvalidationWindow[i].request.args.data.frame;\n if (!networkRequestIsRenderBlockingInFrame(requestsInInvalidationWindow[i].request, mainFrameId)) {\n continue;\n }\n renderBlockingRequests.push(requestsInInvalidationWindow[i] as RenderBlockingRequest);\n }\n return renderBlockingRequests;\n}\n\nfunction firstIframeInDOMTree(root: Protocol.DOM.Node): Protocol.DOM.Node|null {\n if (root.nodeName === 'IFRAME') {\n return root;\n }\n const children = root.children;\n if (!children) {\n return null;\n }\n for (const child of children) {\n const iFrameInChild = firstIframeInDOMTree(child);\n if (iFrameInChild) {\n return iFrameInChild;\n }\n }\n return null;\n}\n\nfunction cssPropertyIsExplicitlySet(propertyValue: string): boolean {\n return !['auto', 'initial', 'unset', 'inherit'].includes(propertyValue);\n}\n\nfunction htmlAttributeIsExplicit(attr: {value: string}): boolean {\n return parseInt(attr.value, 10) >= 0;\n}\n\nfunction computedStyleHasBackroundImage(computedStyle: Map<string, string>): boolean {\n const CSS_URL_REGEX = /^url\\(\"([^\"]+)\"\\)$/;\n const backgroundImage = computedStyle.get('background-image');\n if (!backgroundImage) {\n return false;\n }\n return CSS_URL_REGEX.test(backgroundImage);\n}\n\nfunction computedStyleHasFixedPosition(computedStyle: Map<string, string>): boolean {\n const position = computedStyle.get('position');\n if (!position) {\n return false;\n }\n return position === 'fixed' || position === 'absolute';\n}\n\nfunction getNodeComputedDimensions(computedStyle: Map<string, string>): CSSDimensions {\n const computedDimensions: CSSDimensions = {};\n computedDimensions.height = computedStyle.get('height');\n computedDimensions.width = computedStyle.get('width');\n computedDimensions.aspectRatio = computedStyle.get('aspect-ratio');\n return computedDimensions;\n}\n\n/**\n * Determines if a node is a media element and is not fixed positioned\n * (i.e. \"position: fixed;\" or \"position: absolute;\")\n */\nasync function nodeIsUnfixedMedia(node: Protocol.DOM.Node, computedStyle: Map<string, string>): Promise<boolean> {\n const localName = node.localName;\n const isBackgroundImage = computedStyleHasBackroundImage(computedStyle);\n if (localName !== 'img' && localName !== 'video' && !isBackgroundImage) {\n // Not a media element.\n return false;\n }\n const isFixed = computedStyleHasFixedPosition(computedStyle);\n return !isFixed;\n}\n\n/**\n * Determines if a CSS dimensions object explicitly defines both width and height\n * (i.e. not set to auto, inherit, etc.)\n */\nfunction dimensionsAreExplicit(dimensions: CSSDimensions): boolean {\n const {height, width, aspectRatio} = dimensions;\n\n const explicitHeight = Boolean(height && cssPropertyIsExplicitlySet(height));\n const explicitWidth = Boolean(width && cssPropertyIsExplicitlySet(width));\n const explicitAspectRatio = Boolean(aspectRatio && cssPropertyIsExplicitlySet(aspectRatio));\n\n const explicitWithAR = (explicitHeight || explicitWidth) && explicitAspectRatio;\n return (explicitHeight && explicitWidth) || explicitWithAR;\n}\n\n/**\n * Given an array of layout shift and PrePaint events, returns a mapping from\n * PrePaint events to layout shifts dispatched within it.\n */\nfunction getShiftsByPrePaintEvents(\n layoutShifts: Types.TraceEvents.TraceEventLayoutShift[],\n prePaintEvents: Types.TraceEvents.TraceEventPrePaint[],\n ): Map<Types.TraceEvents.TraceEventPrePaint, Types.TraceEvents.TraceEventLayoutShift[]> {\n // Maps from PrePaint events to LayoutShifts that occured in each one.\n const shiftsByPrePaint = new Map<Types.TraceEvents.TraceEventPrePaint, Types.TraceEvents.TraceEventLayoutShift[]>();\n\n // Associate all shifts to their corresponding PrePaint.\n for (const prePaintEvent of prePaintEvents) {\n const firstShiftIndex =\n Platform.ArrayUtilities.nearestIndexFromBeginning(layoutShifts, shift => shift.ts >= prePaintEvent.ts);\n if (firstShiftIndex === null) {\n // No layout shifts registered after this PrePaint start. Continue.\n continue;\n }\n for (let i = firstShiftIndex; i < layoutShifts.length; i++) {\n const shift = layoutShifts[i];\n if (shift.ts >= prePaintEvent.ts && shift.ts <= prePaintEvent.ts + prePaintEvent.dur) {\n const shiftsInPrePaint = Platform.MapUtilities.getWithDefault(shiftsByPrePaint, prePaintEvent, () => []);\n shiftsInPrePaint.push(shift);\n }\n if (shift.ts > prePaintEvent.ts + prePaintEvent.dur) {\n // Reached the end of this PrePaint. Continue to the next one.\n break;\n }\n }\n }\n return shiftsByPrePaint;\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import type * as Protocol from '../../../generated/protocol.js';
2
+ import { LayoutShiftRootCauses } from './LayoutShift.js';
3
+ export type RootCauseProtocolInterface = {
4
+ getInitiatorForRequest(url: string): Protocol.Network.Initiator | null;
5
+ pushNodesByBackendIdsToFrontend(backendNodeIds: Protocol.DOM.BackendNodeId[]): Promise<Protocol.DOM.NodeId[]>;
6
+ getNode(nodeId: Protocol.DOM.NodeId): Promise<Protocol.DOM.Node>;
7
+ getComputedStyleForNode(nodeId: Protocol.DOM.NodeId): Promise<Protocol.CSS.CSSComputedStyleProperty[]>;
8
+ getMatchedStylesForNode(nodeId: Protocol.DOM.NodeId): Promise<Protocol.CSS.GetMatchedStylesForNodeResponse>;
9
+ fontFaceForSource(url: string): Protocol.CSS.FontFace | undefined;
10
+ };
11
+ export declare class RootCauses {
12
+ readonly layoutShifts: LayoutShiftRootCauses;
13
+ constructor(protocolInterface: RootCauseProtocolInterface);
14
+ }
@@ -1,8 +1,11 @@
1
- import { LayoutShiftRootCauses } from "./LayoutShift.js";
1
+ // Copyright 2023 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+ import { LayoutShiftRootCauses } from './LayoutShift.js';
2
5
  export class RootCauses {
3
- layoutShifts;
4
- constructor(protocolInterface) {
5
- this.layoutShifts = new LayoutShiftRootCauses(protocolInterface);
6
- }
6
+ layoutShifts;
7
+ constructor(protocolInterface) {
8
+ this.layoutShifts = new LayoutShiftRootCauses(protocolInterface);
9
+ }
7
10
  }
8
- //# sourceMappingURL=RootCauses.js.map
11
+ //# sourceMappingURL=RootCauses.js.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../../../front_end/models/trace/root-causes/RootCauses.ts"],
4
- "sourcesContent": ["// Copyright 2023 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 Protocol from '../../../generated/protocol.js';\n\nimport {LayoutShiftRootCauses} from './LayoutShift.js';\n\nexport type RootCauseProtocolInterface = {\n getInitiatorForRequest(url: string): Protocol.Network.Initiator|null,\n pushNodesByBackendIdsToFrontend(backendNodeIds: Protocol.DOM.BackendNodeId[]): Promise<Protocol.DOM.NodeId[]>,\n getNode(nodeId: Protocol.DOM.NodeId): Promise<Protocol.DOM.Node>,\n getComputedStyleForNode(nodeId: Protocol.DOM.NodeId): Promise<Protocol.CSS.CSSComputedStyleProperty[]>,\n getMatchedStylesForNode(nodeId: Protocol.DOM.NodeId): Promise<Protocol.CSS.GetMatchedStylesForNodeResponse>,\n fontFaceForSource(url: string): Protocol.CSS.FontFace|undefined,\n};\n\nexport class RootCauses {\n readonly layoutShifts: LayoutShiftRootCauses;\n\n constructor(protocolInterface: RootCauseProtocolInterface) {\n this.layoutShifts = new LayoutShiftRootCauses(protocolInterface);\n }\n}\n"],
5
- "mappings": "AAMA;AAWO,wBAAiB;AAAA,EACb;AAAA,EAET,YAAY,mBAA+C;AACzD,SAAK,eAAe,IAAI,sBAAsB;AAAA;AAAA;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"RootCauses.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/root-causes/RootCauses.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAI7B,OAAO,EAAC,qBAAqB,EAAC,MAAM,kBAAkB,CAAC;AAWvD,MAAM,OAAO,UAAU;IACZ,YAAY,CAAwB;IAE7C,YAAY,iBAA6C;QACvD,IAAI,CAAC,YAAY,GAAG,IAAI,qBAAqB,CAAC,iBAAiB,CAAC,CAAC;IACnE,CAAC;CACF","sourcesContent":["// Copyright 2023 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 Protocol from '../../../generated/protocol.js';\n\nimport {LayoutShiftRootCauses} from './LayoutShift.js';\n\nexport type RootCauseProtocolInterface = {\n getInitiatorForRequest(url: string): Protocol.Network.Initiator|null,\n pushNodesByBackendIdsToFrontend(backendNodeIds: Protocol.DOM.BackendNodeId[]): Promise<Protocol.DOM.NodeId[]>,\n getNode(nodeId: Protocol.DOM.NodeId): Promise<Protocol.DOM.Node>,\n getComputedStyleForNode(nodeId: Protocol.DOM.NodeId): Promise<Protocol.CSS.CSSComputedStyleProperty[]>,\n getMatchedStylesForNode(nodeId: Protocol.DOM.NodeId): Promise<Protocol.CSS.GetMatchedStylesForNodeResponse>,\n fontFaceForSource(url: string): Protocol.CSS.FontFace|undefined,\n};\n\nexport class RootCauses {\n readonly layoutShifts: LayoutShiftRootCauses;\n\n constructor(protocolInterface: RootCauseProtocolInterface) {\n this.layoutShifts = new LayoutShiftRootCauses(protocolInterface);\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export * as RootCauses from './RootCauses.js';
@@ -1,2 +1,5 @@
1
- export * as RootCauses from "./RootCauses.js";
2
- //# sourceMappingURL=root-causes.js.map
1
+ // Copyright 2023 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+ export * as RootCauses from './RootCauses.js';
5
+ //# sourceMappingURL=root-causes.js.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../../../front_end/models/trace/root-causes/root-causes.ts"],
4
- "sourcesContent": ["// Copyright 2023 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\nexport * as RootCauses from './RootCauses.js';\n"],
5
- "mappings": "AAIA;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"root-causes.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/root-causes/root-causes.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC","sourcesContent":["// Copyright 2023 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\nexport * as RootCauses from './RootCauses.js';\n"]}
@@ -0,0 +1,11 @@
1
+ import * as EntriesFilter from './EntriesFilter.js';
2
+ import * as Extras from './extras/extras.js';
3
+ import * as Handlers from './handlers/handlers.js';
4
+ import * as Helpers from './helpers/helpers.js';
5
+ import * as Legacy from './LegacyTracingModel.js';
6
+ import * as TraceModel from './ModelImpl.js';
7
+ import * as Processor from './Processor.js';
8
+ import * as RootCauses from './root-causes/root-causes.js';
9
+ import * as TracingManager from './TracingManager.js';
10
+ import * as Types from './types/types.js';
11
+ export { EntriesFilter, Extras, Handlers, Helpers, Legacy, Processor, RootCauses, TraceModel, TracingManager, Types, };
@@ -1,23 +1,17 @@
1
- import * as EntriesFilter from "./EntriesFilter.js";
2
- import * as Extras from "./extras/extras.js";
3
- import * as Handlers from "./handlers/handlers.js";
4
- import * as Helpers from "./helpers/helpers.js";
5
- import * as Legacy from "./LegacyTracingModel.js";
6
- import * as TraceModel from "./ModelImpl.js";
7
- import * as Processor from "./Processor.js";
8
- import * as RootCauses from "./root-causes/root-causes.js";
9
- import * as TracingManager from "./TracingManager.js";
10
- import * as Types from "./types/types.js";
11
- export {
12
- EntriesFilter,
13
- Extras,
14
- Handlers,
15
- Helpers,
16
- Legacy,
17
- Processor,
18
- RootCauses,
19
- TraceModel,
20
- TracingManager,
21
- Types
22
- };
23
- //# sourceMappingURL=trace.js.map
1
+ // Copyright 2022 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+ import * as EntriesFilter from './EntriesFilter.js';
5
+ import * as Extras from './extras/extras.js';
6
+ import * as Handlers from './handlers/handlers.js';
7
+ import * as Helpers from './helpers/helpers.js';
8
+ // Purposefully use a shorter name here so references to this are
9
+ // Legacy.TracingModel.
10
+ import * as Legacy from './LegacyTracingModel.js';
11
+ import * as TraceModel from './ModelImpl.js';
12
+ import * as Processor from './Processor.js';
13
+ import * as RootCauses from './root-causes/root-causes.js';
14
+ import * as TracingManager from './TracingManager.js';
15
+ import * as Types from './types/types.js';
16
+ export { EntriesFilter, Extras, Handlers, Helpers, Legacy, Processor, RootCauses, TraceModel, TracingManager, Types, };
17
+ //# sourceMappingURL=trace.js.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../../front_end/models/trace/trace.ts"],
4
- "sourcesContent": ["// Copyright 2022 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as EntriesFilter from './EntriesFilter.js';\nimport * as Extras from './extras/extras.js';\nimport * as Handlers from './handlers/handlers.js';\nimport * as Helpers from './helpers/helpers.js';\n// Purposefully use a shorter name here so references to this are\n// Legacy.TracingModel.\nimport * as Legacy from './LegacyTracingModel.js';\nimport * as TraceModel from './ModelImpl.js';\nimport * as Processor from './Processor.js';\nimport * as RootCauses from './root-causes/root-causes.js';\nimport * as TracingManager from './TracingManager.js';\nimport * as Types from './types/types.js';\n\nexport {\n EntriesFilter,\n Extras,\n Handlers,\n Helpers,\n Legacy,\n Processor,\n RootCauses,\n TraceModel,\n TracingManager,\n Types,\n};\n"],
5
- "mappings": "AAIA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"trace.js","sourceRoot":"","sources":["../../../../../../front_end/models/trace/trace.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,iEAAiE;AACjE,uBAAuB;AACvB,OAAO,KAAK,MAAM,MAAM,yBAAyB,CAAC;AAClD,OAAO,KAAK,UAAU,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EACL,aAAa,EACb,MAAM,EACN,QAAQ,EACR,OAAO,EACP,MAAM,EACN,SAAS,EACT,UAAU,EACV,UAAU,EACV,cAAc,EACd,KAAK,GACN,CAAC","sourcesContent":["// Copyright 2022 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as EntriesFilter from './EntriesFilter.js';\nimport * as Extras from './extras/extras.js';\nimport * as Handlers from './handlers/handlers.js';\nimport * as Helpers from './helpers/helpers.js';\n// Purposefully use a shorter name here so references to this are\n// Legacy.TracingModel.\nimport * as Legacy from './LegacyTracingModel.js';\nimport * as TraceModel from './ModelImpl.js';\nimport * as Processor from './Processor.js';\nimport * as RootCauses from './root-causes/root-causes.js';\nimport * as TracingManager from './TracingManager.js';\nimport * as Types from './types/types.js';\n\nexport {\n EntriesFilter,\n Extras,\n Handlers,\n Helpers,\n Legacy,\n Processor,\n RootCauses,\n TraceModel,\n TracingManager,\n Types,\n};\n"]}
@@ -0,0 +1,33 @@
1
+ export type Configuration = Readonly<{
2
+ settings: {};
3
+ experiments: {
4
+ /**
5
+ * Include V8 RCS in the timeline
6
+ */
7
+ timelineV8RuntimeCallStats: boolean;
8
+ /**
9
+ * Show all events: disable the default filtering which hides and excludes some events.
10
+ */
11
+ timelineShowAllEvents: boolean;
12
+ };
13
+ processing: {
14
+ /**
15
+ * How long the processor should pause between event chunks.
16
+ */
17
+ pauseDuration: number;
18
+ /**
19
+ * How many events should be processed before yielding to the main thread for a pause.
20
+ */
21
+ eventsPerChunk: number;
22
+ };
23
+ }>;
24
+ export declare const DEFAULT: Configuration;
25
+ /**
26
+ * Generates a key that can be used to represent this config in a cache. This is
27
+ * used mainly in tests, where we want to avoid re-parsing a file if we have
28
+ * already processed it with the same configuration. This cache key purposefully
29
+ * does not include all settings in the configuration; the processing settings
30
+ * do not impact the actual resulting data. Only new flags in the config that
31
+ * alter parsing should be added to this cache key.
32
+ */
33
+ export declare function configToCacheKey(config: Configuration): string;
@@ -1,18 +1,29 @@
1
+ // Copyright 2023 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
1
4
  export const DEFAULT = {
2
- settings: {},
3
- experiments: {
4
- timelineV8RuntimeCallStats: false,
5
- timelineShowAllEvents: false
6
- },
7
- processing: {
8
- eventsPerChunk: 15e3,
9
- pauseDuration: 1
10
- }
5
+ settings: {},
6
+ experiments: {
7
+ timelineV8RuntimeCallStats: false,
8
+ timelineShowAllEvents: false,
9
+ },
10
+ processing: {
11
+ eventsPerChunk: 15_000,
12
+ pauseDuration: 1,
13
+ },
11
14
  };
15
+ /**
16
+ * Generates a key that can be used to represent this config in a cache. This is
17
+ * used mainly in tests, where we want to avoid re-parsing a file if we have
18
+ * already processed it with the same configuration. This cache key purposefully
19
+ * does not include all settings in the configuration; the processing settings
20
+ * do not impact the actual resulting data. Only new flags in the config that
21
+ * alter parsing should be added to this cache key.
22
+ */
12
23
  export function configToCacheKey(config) {
13
- return [
14
- `experiments.timelineShowAllEvents:${config.experiments.timelineShowAllEvents}`,
15
- `experiments.timelineV8RuntimeCallStats:${config.experiments.timelineV8RuntimeCallStats}`
16
- ].join("-");
24
+ return [
25
+ `experiments.timelineShowAllEvents:${config.experiments.timelineShowAllEvents}`,
26
+ `experiments.timelineV8RuntimeCallStats:${config.experiments.timelineV8RuntimeCallStats}`,
27
+ ].join('-');
17
28
  }
18
- //# sourceMappingURL=Configuration.js.map
29
+ //# sourceMappingURL=Configuration.js.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../../../front_end/models/trace/types/Configuration.ts"],
4
- "sourcesContent": ["// Copyright 2023 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\nexport type Configuration = Readonly<{\n settings: {\n // Currently empty but defining here as we will migrate more settings into this.\n },\n experiments: {\n /**\n * Include V8 RCS in the timeline\n */\n timelineV8RuntimeCallStats: boolean,\n /**\n * Show all events: disable the default filtering which hides and excludes some events.\n */\n timelineShowAllEvents: boolean,\n },\n processing: {\n /**\n * How long the processor should pause between event chunks.\n */\n pauseDuration: number,\n /**\n * How many events should be processed before yielding to the main thread for a pause.\n */\n eventsPerChunk: number,\n },\n}>;\n\nexport const DEFAULT: Configuration = {\n settings: {},\n experiments: {\n timelineV8RuntimeCallStats: false,\n timelineShowAllEvents: false,\n },\n processing: {\n eventsPerChunk: 15_000,\n pauseDuration: 1,\n },\n};\n\n/**\n * Generates a key that can be used to represent this config in a cache. This is\n * used mainly in tests, where we want to avoid re-parsing a file if we have\n * already processed it with the same configuration. This cache key purposefully\n * does not include all settings in the configuration; the processing settings\n * do not impact the actual resulting data. Only new flags in the config that\n * alter parsing should be added to this cache key.\n */\nexport function configToCacheKey(config: Configuration): string {\n return [\n `experiments.timelineShowAllEvents:${config.experiments.timelineShowAllEvents}`,\n `experiments.timelineV8RuntimeCallStats:${config.experiments.timelineV8RuntimeCallStats}`,\n ].join('-');\n}\n"],
5
- "mappings": "AA8BO,aAAM,UAAyB;AAAA,EACpC,UAAU;AAAA,EACV,aAAa;AAAA,IACX,4BAA4B;AAAA,IAC5B,uBAAuB;AAAA;AAAA,EAEzB,YAAY;AAAA,IACV,gBAAgB;AAAA,IAChB,eAAe;AAAA;AAAA;AAYZ,iCAA0B,QAA+B;AAC9D,SAAO;AAAA,IACL,qCAAqC,OAAO,YAAY;AAAA,IACxD,0CAA0C,OAAO,YAAY;AAAA,IAC7D,KAAK;AAAA;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/types/Configuration.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AA4B7B,MAAM,CAAC,MAAM,OAAO,GAAkB;IACpC,QAAQ,EAAE,EAAE;IACZ,WAAW,EAAE;QACX,0BAA0B,EAAE,KAAK;QACjC,qBAAqB,EAAE,KAAK;KAC7B;IACD,UAAU,EAAE;QACV,cAAc,EAAE,MAAM;QACtB,aAAa,EAAE,CAAC;KACjB;CACF,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAqB;IACpD,OAAO;QACL,qCAAqC,MAAM,CAAC,WAAW,CAAC,qBAAqB,EAAE;QAC/E,0CAA0C,MAAM,CAAC,WAAW,CAAC,0BAA0B,EAAE;KAC1F,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACd,CAAC","sourcesContent":["// Copyright 2023 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\nexport type Configuration = Readonly<{\n settings: {\n // Currently empty but defining here as we will migrate more settings into this.\n },\n experiments: {\n /**\n * Include V8 RCS in the timeline\n */\n timelineV8RuntimeCallStats: boolean,\n /**\n * Show all events: disable the default filtering which hides and excludes some events.\n */\n timelineShowAllEvents: boolean,\n },\n processing: {\n /**\n * How long the processor should pause between event chunks.\n */\n pauseDuration: number,\n /**\n * How many events should be processed before yielding to the main thread for a pause.\n */\n eventsPerChunk: number,\n },\n}>;\n\nexport const DEFAULT: Configuration = {\n settings: {},\n experiments: {\n timelineV8RuntimeCallStats: false,\n timelineShowAllEvents: false,\n },\n processing: {\n eventsPerChunk: 15_000,\n pauseDuration: 1,\n },\n};\n\n/**\n * Generates a key that can be used to represent this config in a cache. This is\n * used mainly in tests, where we want to avoid re-parsing a file if we have\n * already processed it with the same configuration. This cache key purposefully\n * does not include all settings in the configuration; the processing settings\n * do not impact the actual resulting data. Only new flags in the config that\n * alter parsing should be added to this cache key.\n */\nexport function configToCacheKey(config: Configuration): string {\n return [\n `experiments.timelineShowAllEvents:${config.experiments.timelineShowAllEvents}`,\n `experiments.timelineV8RuntimeCallStats:${config.experiments.timelineV8RuntimeCallStats}`,\n ].join('-');\n}\n"]}
@@ -0,0 +1,23 @@
1
+ import { type TraceEventData } from './TraceEvents.js';
2
+ export type TraceFile = {
3
+ traceEvents: readonly TraceEventData[];
4
+ metadata: MetaData;
5
+ };
6
+ export declare const enum DataOrigin {
7
+ CPUProfile = "CPUProfile",
8
+ TraceEvents = "TraceEvents"
9
+ }
10
+ /**
11
+ * Trace metadata that we persist to the file. This will allow us to
12
+ * store specifics for the trace, e.g., which tracks should be visible
13
+ * on load.
14
+ */
15
+ export interface MetaData {
16
+ source?: 'DevTools';
17
+ startTime?: string;
18
+ networkThrottling?: string;
19
+ cpuThrottling?: number;
20
+ hardwareConcurrency?: number;
21
+ dataOrigin?: DataOrigin;
22
+ }
23
+ export type Contents = TraceFile | TraceEventData[];
@@ -1,6 +1,5 @@
1
- export var DataOrigin = /* @__PURE__ */ ((DataOrigin2) => {
2
- DataOrigin2["CPUProfile"] = "CPUProfile";
3
- DataOrigin2["TraceEvents"] = "TraceEvents";
4
- return DataOrigin2;
5
- })(DataOrigin || {});
6
- //# sourceMappingURL=File.js.map
1
+ // Copyright 2023 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+ export {};
5
+ //# sourceMappingURL=File.js.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../../../front_end/models/trace/types/File.ts"],
4
- "sourcesContent": ["// Copyright 2023 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 TraceEventData} from './TraceEvents.js';\nexport type TraceFile = {\n traceEvents: readonly TraceEventData[],\n metadata: MetaData,\n};\n\nexport const enum DataOrigin {\n CPUProfile = 'CPUProfile',\n TraceEvents = 'TraceEvents',\n}\n\n/**\n * Trace metadata that we persist to the file. This will allow us to\n * store specifics for the trace, e.g., which tracks should be visible\n * on load.\n */\nexport interface MetaData {\n source?: 'DevTools';\n startTime?: string;\n networkThrottling?: string;\n cpuThrottling?: number;\n hardwareConcurrency?: number;\n dataOrigin?: DataOrigin;\n}\n\nexport type Contents = TraceFile|TraceEventData[];\n"],
5
- "mappings": "AAUO,WAAW,aAAX,kBAAW,gBAAX;AACL,8BAAa;AACb,+BAAc;AAFE;AAAA;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"File.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/types/File.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B","sourcesContent":["// Copyright 2023 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 TraceEventData} from './TraceEvents.js';\nexport type TraceFile = {\n traceEvents: readonly TraceEventData[],\n metadata: MetaData,\n};\n\nexport const enum DataOrigin {\n CPUProfile = 'CPUProfile',\n TraceEvents = 'TraceEvents',\n}\n\n/**\n * Trace metadata that we persist to the file. This will allow us to\n * store specifics for the trace, e.g., which tracks should be visible\n * on load.\n */\nexport interface MetaData {\n source?: 'DevTools';\n startTime?: string;\n networkThrottling?: string;\n cpuThrottling?: number;\n hardwareConcurrency?: number;\n dataOrigin?: DataOrigin;\n}\n\nexport type Contents = TraceFile|TraceEventData[];\n"]}
@@ -0,0 +1,25 @@
1
+ export type MicroSeconds = number & {
2
+ _tag: 'MicroSeconds';
3
+ };
4
+ export declare function MicroSeconds(value: number): MicroSeconds;
5
+ export type MilliSeconds = number & {
6
+ _tag: 'MilliSeconds';
7
+ };
8
+ export declare function MilliSeconds(value: number): MilliSeconds;
9
+ export type Seconds = number & {
10
+ _tag: 'Seconds';
11
+ };
12
+ export declare function Seconds(value: number): Seconds;
13
+ export declare const enum TimeUnit {
14
+ MICROSECONDS = 0,
15
+ MILLISECONDS = 1,
16
+ SECONDS = 2,
17
+ MINUTES = 3
18
+ }
19
+ export interface TraceWindow<TimeFormat extends MicroSeconds | MilliSeconds> {
20
+ min: TimeFormat;
21
+ max: TimeFormat;
22
+ range: TimeFormat;
23
+ }
24
+ export type TraceWindowMicroSeconds = TraceWindow<MicroSeconds>;
25
+ export type TraceWindowMilliSeconds = TraceWindow<MilliSeconds>;
@@ -1,17 +1,16 @@
1
+ // Copyright 2022 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1
5
  export function MicroSeconds(value) {
2
- return value;
6
+ return value;
3
7
  }
8
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4
9
  export function MilliSeconds(value) {
5
- return value;
10
+ return value;
6
11
  }
12
+ // eslint-disable-next-line @typescript-eslint/naming-convention
7
13
  export function Seconds(value) {
8
- return value;
14
+ return value;
9
15
  }
10
- export var TimeUnit = /* @__PURE__ */ ((TimeUnit2) => {
11
- TimeUnit2[TimeUnit2["MICROSECONDS"] = 0] = "MICROSECONDS";
12
- TimeUnit2[TimeUnit2["MILLISECONDS"] = 1] = "MILLISECONDS";
13
- TimeUnit2[TimeUnit2["SECONDS"] = 2] = "SECONDS";
14
- TimeUnit2[TimeUnit2["MINUTES"] = 3] = "MINUTES";
15
- return TimeUnit2;
16
- })(TimeUnit || {});
17
- //# sourceMappingURL=Timing.js.map
16
+ //# sourceMappingURL=Timing.js.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../../../front_end/models/trace/types/Timing.ts"],
4
- "sourcesContent": ["// Copyright 2022 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n/* eslint-disable no-unused-private-class-members */\n\nexport type MicroSeconds = number&{_tag: 'MicroSeconds'};\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MicroSeconds(value: number): MicroSeconds {\n return value as MicroSeconds;\n}\n\nexport type MilliSeconds = number&{_tag: 'MilliSeconds'};\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MilliSeconds(value: number): MilliSeconds {\n return value as MilliSeconds;\n}\nexport type Seconds = number&{_tag: 'Seconds'};\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function Seconds(value: number): Seconds {\n return value as Seconds;\n}\n\nexport const enum TimeUnit {\n MICROSECONDS = 0,\n MILLISECONDS = 1,\n SECONDS = 2,\n MINUTES = 3,\n}\n\n// Other types.\n\nexport interface TraceWindow<TimeFormat extends MicroSeconds|MilliSeconds> {\n min: TimeFormat;\n max: TimeFormat;\n range: TimeFormat;\n}\n\nexport type TraceWindowMicroSeconds = TraceWindow<MicroSeconds>;\nexport type TraceWindowMilliSeconds = TraceWindow<MilliSeconds>;\n"],
5
- "mappings": "AAQO,6BAAsB,OAA6B;AACxD,SAAO;AAAA;AAKF,6BAAsB,OAA6B;AACxD,SAAO;AAAA;AAIF,wBAAiB,OAAwB;AAC9C,SAAO;AAAA;AAGF,WAAW,WAAX,kBAAW,cAAX;AACL,wCAAe,KAAf;AACA,wCAAe,KAAf;AACA,mCAAU,KAAV;AACA,mCAAU,KAAV;AAJgB;AAAA;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"Timing.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/types/Timing.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAK7B,gEAAgE;AAChE,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,KAAqB,CAAC;AAC/B,CAAC;AAGD,gEAAgE;AAChE,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,KAAqB,CAAC;AAC/B,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,OAAO,CAAC,KAAa;IACnC,OAAO,KAAgB,CAAC;AAC1B,CAAC","sourcesContent":["// Copyright 2022 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n/* eslint-disable no-unused-private-class-members */\n\nexport type MicroSeconds = number&{_tag: 'MicroSeconds'};\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MicroSeconds(value: number): MicroSeconds {\n return value as MicroSeconds;\n}\n\nexport type MilliSeconds = number&{_tag: 'MilliSeconds'};\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MilliSeconds(value: number): MilliSeconds {\n return value as MilliSeconds;\n}\nexport type Seconds = number&{_tag: 'Seconds'};\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function Seconds(value: number): Seconds {\n return value as Seconds;\n}\n\nexport const enum TimeUnit {\n MICROSECONDS = 0,\n MILLISECONDS = 1,\n SECONDS = 2,\n MINUTES = 3,\n}\n\n// Other types.\n\nexport interface TraceWindow<TimeFormat extends MicroSeconds|MilliSeconds> {\n min: TimeFormat;\n max: TimeFormat;\n range: TimeFormat;\n}\n\nexport type TraceWindowMicroSeconds = TraceWindow<MicroSeconds>;\nexport type TraceWindowMilliSeconds = TraceWindow<MilliSeconds>;\n"]}