devtools-tracing 1.0.0

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 (397) hide show
  1. package/generate.ts +643 -0
  2. package/index.ts +16 -0
  3. package/lib/front_end/core/common/App.ts +7 -0
  4. package/lib/front_end/core/common/AppProvider.ts +32 -0
  5. package/lib/front_end/core/common/Base64.ts +47 -0
  6. package/lib/front_end/core/common/CharacterIdMap.ts +30 -0
  7. package/lib/front_end/core/common/Color.ts +2506 -0
  8. package/lib/front_end/core/common/ColorConverter.ts +402 -0
  9. package/lib/front_end/core/common/ColorUtils.ts +252 -0
  10. package/lib/front_end/core/common/Console.ts +114 -0
  11. package/lib/front_end/core/common/Debouncer.ts +15 -0
  12. package/lib/front_end/core/common/EventTarget.ts +52 -0
  13. package/lib/front_end/core/common/Gzip.ts +74 -0
  14. package/lib/front_end/core/common/JavaScriptMetaData.ts +29 -0
  15. package/lib/front_end/core/common/Lazy.ts +31 -0
  16. package/lib/front_end/core/common/Linkifier.ts +55 -0
  17. package/lib/front_end/core/common/MapWithDefault.ts +26 -0
  18. package/lib/front_end/core/common/Mutex.ts +55 -0
  19. package/lib/front_end/core/common/Object.ts +145 -0
  20. package/lib/front_end/core/common/ParsedURL.ts +554 -0
  21. package/lib/front_end/core/common/Progress.ts +180 -0
  22. package/lib/front_end/core/common/QueryParamHandler.ts +7 -0
  23. package/lib/front_end/core/common/ResolverBase.ts +85 -0
  24. package/lib/front_end/core/common/ResourceType.ts +588 -0
  25. package/lib/front_end/core/common/ReturnToPanel.ts +17 -0
  26. package/lib/front_end/core/common/Revealer.ts +192 -0
  27. package/lib/front_end/core/common/Runnable.ts +41 -0
  28. package/lib/front_end/core/common/SegmentedRange.ts +87 -0
  29. package/lib/front_end/core/common/SettingRegistration.ts +339 -0
  30. package/lib/front_end/core/common/Settings.ts +1497 -0
  31. package/lib/front_end/core/common/SimpleHistoryManager.ts +124 -0
  32. package/lib/front_end/core/common/StringOutputStream.ts +26 -0
  33. package/lib/front_end/core/common/TextDictionary.ts +48 -0
  34. package/lib/front_end/core/common/Throttler.ts +99 -0
  35. package/lib/front_end/core/common/Trie.ts +152 -0
  36. package/lib/front_end/core/common/Worker.ts +60 -0
  37. package/lib/front_end/core/common/common.ts +81 -0
  38. package/lib/front_end/core/host/AidaClient.ts +733 -0
  39. package/lib/front_end/core/host/GdpClient.ts +316 -0
  40. package/lib/front_end/core/host/InspectorFrontendHost.ts +648 -0
  41. package/lib/front_end/core/host/InspectorFrontendHostAPI.ts +551 -0
  42. package/lib/front_end/core/host/Platform.ts +76 -0
  43. package/lib/front_end/core/host/ResourceLoader.ts +282 -0
  44. package/lib/front_end/core/host/UserMetrics.ts +1230 -0
  45. package/lib/front_end/core/host/host.ts +23 -0
  46. package/lib/front_end/core/i18n/ByteUtilities.ts +82 -0
  47. package/lib/front_end/core/i18n/DevToolsLocale.ts +87 -0
  48. package/lib/front_end/core/i18n/NumberFormatter.ts +82 -0
  49. package/lib/front_end/core/i18n/i18n.ts +17 -0
  50. package/lib/front_end/core/i18n/i18nImpl.ts +204 -0
  51. package/lib/front_end/core/i18n/i18nTypes.ts +10 -0
  52. package/lib/front_end/core/i18n/locales.js +14 -0
  53. package/lib/front_end/core/i18n/time-utilities.ts +174 -0
  54. package/lib/front_end/core/platform/ArrayUtilities.ts +271 -0
  55. package/lib/front_end/core/platform/Brand.ts +23 -0
  56. package/lib/front_end/core/platform/Constructor.ts +10 -0
  57. package/lib/front_end/core/platform/DOMUtilities.ts +138 -0
  58. package/lib/front_end/core/platform/DateUtilities.ts +15 -0
  59. package/lib/front_end/core/platform/DevToolsPath.ts +53 -0
  60. package/lib/front_end/core/platform/KeyboardUtilities.ts +38 -0
  61. package/lib/front_end/core/platform/MapUtilities.ts +95 -0
  62. package/lib/front_end/core/platform/MimeType.ts +175 -0
  63. package/lib/front_end/core/platform/NumberUtilities.ts +80 -0
  64. package/lib/front_end/core/platform/StringUtilities.ts +588 -0
  65. package/lib/front_end/core/platform/Timing.ts +17 -0
  66. package/lib/front_end/core/platform/TypedArrayUtilities.ts +189 -0
  67. package/lib/front_end/core/platform/TypescriptUtilities.ts +86 -0
  68. package/lib/front_end/core/platform/UIString.ts +39 -0
  69. package/lib/front_end/core/platform/UserVisibleError.ts +28 -0
  70. package/lib/front_end/core/platform/platform.ts +45 -0
  71. package/lib/front_end/core/protocol_client/ConnectionTransport.ts +26 -0
  72. package/lib/front_end/core/protocol_client/InspectorBackend.ts +1050 -0
  73. package/lib/front_end/core/protocol_client/NodeURL.ts +42 -0
  74. package/lib/front_end/core/protocol_client/protocol_client.ts +13 -0
  75. package/lib/front_end/core/root/Runtime.ts +609 -0
  76. package/lib/front_end/core/root/root.ts +6 -0
  77. package/lib/front_end/core/sdk/AccessibilityModel.ts +353 -0
  78. package/lib/front_end/core/sdk/AnimationModel.ts +1041 -0
  79. package/lib/front_end/core/sdk/AutofillModel.ts +184 -0
  80. package/lib/front_end/core/sdk/CPUProfilerModel.ts +148 -0
  81. package/lib/front_end/core/sdk/CPUThrottlingManager.ts +282 -0
  82. package/lib/front_end/core/sdk/CSSContainerQuery.ts +139 -0
  83. package/lib/front_end/core/sdk/CSSFontFace.ts +40 -0
  84. package/lib/front_end/core/sdk/CSSLayer.ts +30 -0
  85. package/lib/front_end/core/sdk/CSSMatchedStyles.ts +1646 -0
  86. package/lib/front_end/core/sdk/CSSMedia.ts +121 -0
  87. package/lib/front_end/core/sdk/CSSMetadata.ts +1647 -0
  88. package/lib/front_end/core/sdk/CSSModel.ts +1128 -0
  89. package/lib/front_end/core/sdk/CSSProperty.ts +384 -0
  90. package/lib/front_end/core/sdk/CSSPropertyParser.ts +681 -0
  91. package/lib/front_end/core/sdk/CSSPropertyParserMatchers.ts +1395 -0
  92. package/lib/front_end/core/sdk/CSSQuery.ts +72 -0
  93. package/lib/front_end/core/sdk/CSSRule.ts +465 -0
  94. package/lib/front_end/core/sdk/CSSScope.ts +30 -0
  95. package/lib/front_end/core/sdk/CSSStartingStyle.ts +29 -0
  96. package/lib/front_end/core/sdk/CSSStyleDeclaration.ts +313 -0
  97. package/lib/front_end/core/sdk/CSSStyleSheetHeader.ts +196 -0
  98. package/lib/front_end/core/sdk/CSSSupports.ts +33 -0
  99. package/lib/front_end/core/sdk/CategorizedBreakpoint.ts +64 -0
  100. package/lib/front_end/core/sdk/ChildTargetManager.ts +314 -0
  101. package/lib/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +62 -0
  102. package/lib/front_end/core/sdk/Connections.ts +293 -0
  103. package/lib/front_end/core/sdk/ConsoleModel.ts +808 -0
  104. package/lib/front_end/core/sdk/ConsoleModelTypes.ts +15 -0
  105. package/lib/front_end/core/sdk/Cookie.ts +319 -0
  106. package/lib/front_end/core/sdk/CookieModel.ts +239 -0
  107. package/lib/front_end/core/sdk/CookieParser.ts +185 -0
  108. package/lib/front_end/core/sdk/DOMDebuggerModel.ts +787 -0
  109. package/lib/front_end/core/sdk/DOMModel.ts +1961 -0
  110. package/lib/front_end/core/sdk/DebuggerModel.ts +1605 -0
  111. package/lib/front_end/core/sdk/EmulationModel.ts +648 -0
  112. package/lib/front_end/core/sdk/EnhancedTracesParser.ts +515 -0
  113. package/lib/front_end/core/sdk/EventBreakpointsModel.ts +183 -0
  114. package/lib/front_end/core/sdk/FrameAssociated.ts +11 -0
  115. package/lib/front_end/core/sdk/FrameManager.ts +259 -0
  116. package/lib/front_end/core/sdk/HeapProfilerModel.ts +225 -0
  117. package/lib/front_end/core/sdk/HttpReasonPhraseStrings.ts +77 -0
  118. package/lib/front_end/core/sdk/IOModel.ts +91 -0
  119. package/lib/front_end/core/sdk/IsolateManager.ts +257 -0
  120. package/lib/front_end/core/sdk/IssuesModel.ts +70 -0
  121. package/lib/front_end/core/sdk/LayerTreeBase.ts +169 -0
  122. package/lib/front_end/core/sdk/LogModel.ts +56 -0
  123. package/lib/front_end/core/sdk/NetworkManager.ts +2823 -0
  124. package/lib/front_end/core/sdk/NetworkRequest.ts +2253 -0
  125. package/lib/front_end/core/sdk/OverlayColorGenerator.ts +52 -0
  126. package/lib/front_end/core/sdk/OverlayModel.ts +1011 -0
  127. package/lib/front_end/core/sdk/OverlayPersistentHighlighter.ts +522 -0
  128. package/lib/front_end/core/sdk/PageLoad.ts +35 -0
  129. package/lib/front_end/core/sdk/PageResourceLoader.ts +435 -0
  130. package/lib/front_end/core/sdk/PaintProfiler.ts +110 -0
  131. package/lib/front_end/core/sdk/PerformanceMetricsModel.ts +84 -0
  132. package/lib/front_end/core/sdk/PreloadingModel.ts +863 -0
  133. package/lib/front_end/core/sdk/RehydratingConnection.ts +386 -0
  134. package/lib/front_end/core/sdk/RehydratingObject.ts +66 -0
  135. package/lib/front_end/core/sdk/RemoteObject.ts +1160 -0
  136. package/lib/front_end/core/sdk/Resource.ts +232 -0
  137. package/lib/front_end/core/sdk/ResourceTreeModel.ts +1160 -0
  138. package/lib/front_end/core/sdk/RuntimeModel.ts +732 -0
  139. package/lib/front_end/core/sdk/SDKModel.ts +65 -0
  140. package/lib/front_end/core/sdk/ScopeTreeCache.ts +45 -0
  141. package/lib/front_end/core/sdk/ScreenCaptureModel.ts +255 -0
  142. package/lib/front_end/core/sdk/Script.ts +534 -0
  143. package/lib/front_end/core/sdk/SecurityOriginManager.ts +76 -0
  144. package/lib/front_end/core/sdk/ServerSentEvents.ts +80 -0
  145. package/lib/front_end/core/sdk/ServerSentEventsProtocol.ts +122 -0
  146. package/lib/front_end/core/sdk/ServerTiming.ts +260 -0
  147. package/lib/front_end/core/sdk/ServiceWorkerCacheModel.ts +377 -0
  148. package/lib/front_end/core/sdk/ServiceWorkerManager.ts +605 -0
  149. package/lib/front_end/core/sdk/SourceMap.ts +867 -0
  150. package/lib/front_end/core/sdk/SourceMapCache.ts +54 -0
  151. package/lib/front_end/core/sdk/SourceMapFunctionRanges.ts +156 -0
  152. package/lib/front_end/core/sdk/SourceMapManager.ts +239 -0
  153. package/lib/front_end/core/sdk/SourceMapScopeChainEntry.ts +189 -0
  154. package/lib/front_end/core/sdk/SourceMapScopesInfo.ts +508 -0
  155. package/lib/front_end/core/sdk/StorageBucketsModel.ts +204 -0
  156. package/lib/front_end/core/sdk/StorageKeyManager.ts +98 -0
  157. package/lib/front_end/core/sdk/Target.ts +332 -0
  158. package/lib/front_end/core/sdk/TargetManager.ts +453 -0
  159. package/lib/front_end/core/sdk/TraceObject.ts +61 -0
  160. package/lib/front_end/core/sdk/WebAuthnModel.ts +104 -0
  161. package/lib/front_end/core/sdk/sdk.ts +174 -0
  162. package/lib/front_end/entrypoints/formatter_worker/FormatterActions.ts +59 -0
  163. package/lib/front_end/generated/InspectorBackendCommands.js +1617 -0
  164. package/lib/front_end/generated/SupportedCSSProperties.js +7512 -0
  165. package/lib/front_end/generated/protocol-proxy-api.d.ts +5022 -0
  166. package/lib/front_end/generated/protocol.ts +22014 -0
  167. package/lib/front_end/models/cpu_profile/CPUProfileDataModel.ts +571 -0
  168. package/lib/front_end/models/cpu_profile/ProfileTreeModel.ts +103 -0
  169. package/lib/front_end/models/cpu_profile/cpu_profile.ts +11 -0
  170. package/lib/front_end/models/formatter/FormatterWorkerPool.ts +219 -0
  171. package/lib/front_end/models/formatter/ScriptFormatter.ts +112 -0
  172. package/lib/front_end/models/formatter/formatter.ts +8 -0
  173. package/lib/front_end/models/text_utils/CodeMirrorUtils.ts +37 -0
  174. package/lib/front_end/models/text_utils/ContentData.ts +199 -0
  175. package/lib/front_end/models/text_utils/ContentProvider.ts +68 -0
  176. package/lib/front_end/models/text_utils/StaticContentProvider.ts +49 -0
  177. package/lib/front_end/models/text_utils/StreamingContentData.ts +108 -0
  178. package/lib/front_end/models/text_utils/Text.ts +90 -0
  179. package/lib/front_end/models/text_utils/TextCursor.ts +44 -0
  180. package/lib/front_end/models/text_utils/TextRange.ts +266 -0
  181. package/lib/front_end/models/text_utils/TextUtils.ts +401 -0
  182. package/lib/front_end/models/text_utils/WasmDisassembly.ts +87 -0
  183. package/lib/front_end/models/text_utils/text_utils.ts +27 -0
  184. package/lib/front_end/models/trace/EntityMapper.ts +141 -0
  185. package/lib/front_end/models/trace/EventsSerializer.ts +101 -0
  186. package/lib/front_end/models/trace/LanternComputationData.ts +438 -0
  187. package/lib/front_end/models/trace/ModelImpl.ts +236 -0
  188. package/lib/front_end/models/trace/Name.ts +136 -0
  189. package/lib/front_end/models/trace/Processor.ts +652 -0
  190. package/lib/front_end/models/trace/Styles.ts +1138 -0
  191. package/lib/front_end/models/trace/extras/FilmStrip.ts +78 -0
  192. package/lib/front_end/models/trace/extras/MainThreadActivity.ts +86 -0
  193. package/lib/front_end/models/trace/extras/ScriptDuplication.ts +236 -0
  194. package/lib/front_end/models/trace/extras/StackTraceForEvent.ts +203 -0
  195. package/lib/front_end/models/trace/extras/ThirdParties.ts +164 -0
  196. package/lib/front_end/models/trace/extras/TraceFilter.ts +62 -0
  197. package/lib/front_end/models/trace/extras/TraceTree.ts +701 -0
  198. package/lib/front_end/models/trace/extras/extras.ts +11 -0
  199. package/lib/front_end/models/trace/handlers/AnimationFramesHandler.ts +128 -0
  200. package/lib/front_end/models/trace/handlers/AnimationHandler.ts +36 -0
  201. package/lib/front_end/models/trace/handlers/AsyncJSCallsHandler.ts +239 -0
  202. package/lib/front_end/models/trace/handlers/AuctionWorkletsHandler.ts +183 -0
  203. package/lib/front_end/models/trace/handlers/DOMStatsHandler.ts +31 -0
  204. package/lib/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +306 -0
  205. package/lib/front_end/models/trace/handlers/FlowsHandler.ts +175 -0
  206. package/lib/front_end/models/trace/handlers/FramesHandler.ts +571 -0
  207. package/lib/front_end/models/trace/handlers/GPUHandler.ts +50 -0
  208. package/lib/front_end/models/trace/handlers/ImagePaintingHandler.ts +183 -0
  209. package/lib/front_end/models/trace/handlers/InitiatorsHandler.ts +193 -0
  210. package/lib/front_end/models/trace/handlers/InvalidationsHandler.ts +168 -0
  211. package/lib/front_end/models/trace/handlers/LargestImagePaintHandler.ts +109 -0
  212. package/lib/front_end/models/trace/handlers/LargestTextPaintHandler.ts +35 -0
  213. package/lib/front_end/models/trace/handlers/LayerTreeHandler.ts +123 -0
  214. package/lib/front_end/models/trace/handlers/LayoutShiftsHandler.ts +573 -0
  215. package/lib/front_end/models/trace/handlers/MemoryHandler.ts +31 -0
  216. package/lib/front_end/models/trace/handlers/MetaHandler.ts +525 -0
  217. package/lib/front_end/models/trace/handlers/ModelHandlers.ts +34 -0
  218. package/lib/front_end/models/trace/handlers/NetworkRequestsHandler.ts +672 -0
  219. package/lib/front_end/models/trace/handlers/PageFramesHandler.ts +52 -0
  220. package/lib/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +460 -0
  221. package/lib/front_end/models/trace/handlers/RendererHandler.ts +428 -0
  222. package/lib/front_end/models/trace/handlers/SamplesHandler.ts +271 -0
  223. package/lib/front_end/models/trace/handlers/ScreenshotsHandler.ts +122 -0
  224. package/lib/front_end/models/trace/handlers/ScriptsHandler.ts +336 -0
  225. package/lib/front_end/models/trace/handlers/SelectorStatsHandler.ts +110 -0
  226. package/lib/front_end/models/trace/handlers/Threads.ts +139 -0
  227. package/lib/front_end/models/trace/handlers/UserInteractionsHandler.ts +400 -0
  228. package/lib/front_end/models/trace/handlers/UserTimingsHandler.ts +233 -0
  229. package/lib/front_end/models/trace/handlers/WarningsHandler.ts +162 -0
  230. package/lib/front_end/models/trace/handlers/WorkersHandler.ts +45 -0
  231. package/lib/front_end/models/trace/handlers/handlers.ts +8 -0
  232. package/lib/front_end/models/trace/handlers/helpers.ts +196 -0
  233. package/lib/front_end/models/trace/handlers/types.ts +75 -0
  234. package/lib/front_end/models/trace/helpers/Extensions.ts +54 -0
  235. package/lib/front_end/models/trace/helpers/Network.ts +129 -0
  236. package/lib/front_end/models/trace/helpers/SamplesIntegrator.ts +544 -0
  237. package/lib/front_end/models/trace/helpers/SyntheticEvents.ts +87 -0
  238. package/lib/front_end/models/trace/helpers/Timing.ts +248 -0
  239. package/lib/front_end/models/trace/helpers/Trace.ts +928 -0
  240. package/lib/front_end/models/trace/helpers/TreeHelpers.ts +320 -0
  241. package/lib/front_end/models/trace/helpers/helpers.ts +11 -0
  242. package/lib/front_end/models/trace/insights/CLSCulprits.ts +668 -0
  243. package/lib/front_end/models/trace/insights/Cache.ts +269 -0
  244. package/lib/front_end/models/trace/insights/Common.ts +453 -0
  245. package/lib/front_end/models/trace/insights/DOMSize.ts +223 -0
  246. package/lib/front_end/models/trace/insights/DocumentLatency.ts +319 -0
  247. package/lib/front_end/models/trace/insights/DuplicatedJavaScript.ts +126 -0
  248. package/lib/front_end/models/trace/insights/FontDisplay.ts +119 -0
  249. package/lib/front_end/models/trace/insights/ForcedReflow.ts +220 -0
  250. package/lib/front_end/models/trace/insights/INPBreakdown.ts +171 -0
  251. package/lib/front_end/models/trace/insights/ImageDelivery.ts +348 -0
  252. package/lib/front_end/models/trace/insights/LCPBreakdown.ts +268 -0
  253. package/lib/front_end/models/trace/insights/LCPDiscovery.ts +237 -0
  254. package/lib/front_end/models/trace/insights/LegacyJavaScript.ts +138 -0
  255. package/lib/front_end/models/trace/insights/Models.ts +22 -0
  256. package/lib/front_end/models/trace/insights/ModernHTTP.ts +257 -0
  257. package/lib/front_end/models/trace/insights/NetworkDependencyTree.ts +726 -0
  258. package/lib/front_end/models/trace/insights/RenderBlocking.ts +257 -0
  259. package/lib/front_end/models/trace/insights/SlowCSSSelector.ts +175 -0
  260. package/lib/front_end/models/trace/insights/Statistics.ts +101 -0
  261. package/lib/front_end/models/trace/insights/ThirdParties.ts +130 -0
  262. package/lib/front_end/models/trace/insights/Viewport.ts +138 -0
  263. package/lib/front_end/models/trace/insights/insights.ts +10 -0
  264. package/lib/front_end/models/trace/insights/types.ts +157 -0
  265. package/lib/front_end/models/trace/lantern/core/LanternError.ts +7 -0
  266. package/lib/front_end/models/trace/lantern/core/NetworkAnalyzer.ts +619 -0
  267. package/lib/front_end/models/trace/lantern/core/core.ts +6 -0
  268. package/lib/front_end/models/trace/lantern/graph/BaseNode.ts +345 -0
  269. package/lib/front_end/models/trace/lantern/graph/CPUNode.ts +80 -0
  270. package/lib/front_end/models/trace/lantern/graph/NetworkNode.ts +101 -0
  271. package/lib/front_end/models/trace/lantern/graph/PageDependencyGraph.ts +636 -0
  272. package/lib/front_end/models/trace/lantern/graph/graph.ts +8 -0
  273. package/lib/front_end/models/trace/lantern/lantern.ts +17 -0
  274. package/lib/front_end/models/trace/lantern/metrics/FirstContentfulPaint.ts +187 -0
  275. package/lib/front_end/models/trace/lantern/metrics/Interactive.ts +88 -0
  276. package/lib/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +92 -0
  277. package/lib/front_end/models/trace/lantern/metrics/MaxPotentialFID.ts +72 -0
  278. package/lib/front_end/models/trace/lantern/metrics/Metric.ts +126 -0
  279. package/lib/front_end/models/trace/lantern/metrics/SpeedIndex.ts +126 -0
  280. package/lib/front_end/models/trace/lantern/metrics/TBTUtils.ts +82 -0
  281. package/lib/front_end/models/trace/lantern/metrics/TotalBlockingTime.ts +112 -0
  282. package/lib/front_end/models/trace/lantern/metrics/metrics.ts +12 -0
  283. package/lib/front_end/models/trace/lantern/simulation/ConnectionPool.ts +150 -0
  284. package/lib/front_end/models/trace/lantern/simulation/Constants.ts +46 -0
  285. package/lib/front_end/models/trace/lantern/simulation/DNSCache.ts +61 -0
  286. package/lib/front_end/models/trace/lantern/simulation/SimulationTimingMap.ts +196 -0
  287. package/lib/front_end/models/trace/lantern/simulation/Simulator.ts +556 -0
  288. package/lib/front_end/models/trace/lantern/simulation/TCPConnection.ts +192 -0
  289. package/lib/front_end/models/trace/lantern/simulation/simulation.ts +10 -0
  290. package/lib/front_end/models/trace/lantern/types/Lantern.ts +220 -0
  291. package/lib/front_end/models/trace/lantern/types/types.ts +5 -0
  292. package/lib/front_end/models/trace/trace.ts +33 -0
  293. package/lib/front_end/models/trace/types/Configuration.ts +110 -0
  294. package/lib/front_end/models/trace/types/Extensions.ts +136 -0
  295. package/lib/front_end/models/trace/types/File.ts +281 -0
  296. package/lib/front_end/models/trace/types/Overlays.ts +138 -0
  297. package/lib/front_end/models/trace/types/Timing.ts +30 -0
  298. package/lib/front_end/models/trace/types/TraceEvents.ts +3277 -0
  299. package/lib/front_end/models/trace/types/types.ts +10 -0
  300. package/lib/front_end/third_party/i18n/LICENSE +202 -0
  301. package/lib/front_end/third_party/i18n/README.chromium +15 -0
  302. package/lib/front_end/third_party/i18n/i18n-impl.ts +61 -0
  303. package/lib/front_end/third_party/i18n/i18n.ts +11 -0
  304. package/lib/front_end/third_party/i18n/localized-string-set.ts +129 -0
  305. package/lib/front_end/third_party/intl-messageformat/LICENSE +33 -0
  306. package/lib/front_end/third_party/intl-messageformat/README.chromium +24 -0
  307. package/lib/front_end/third_party/intl-messageformat/intl-messageformat-tsconfig.json +16 -0
  308. package/lib/front_end/third_party/intl-messageformat/intl-messageformat.ts +6 -0
  309. package/lib/front_end/third_party/intl-messageformat/package/LICENSE.md +33 -0
  310. package/lib/front_end/third_party/intl-messageformat/package/README.md +3 -0
  311. package/lib/front_end/third_party/intl-messageformat/package/index.d.ts +6 -0
  312. package/lib/front_end/third_party/intl-messageformat/package/index.d.ts.map +1 -0
  313. package/lib/front_end/third_party/intl-messageformat/package/index.js +13 -0
  314. package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.d.ts +5 -0
  315. package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.js +1710 -0
  316. package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.iife.js +1815 -0
  317. package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts +6 -0
  318. package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts.map +1 -0
  319. package/lib/front_end/third_party/intl-messageformat/package/lib/index.js +10 -0
  320. package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts +34 -0
  321. package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts.map +1 -0
  322. package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.js +229 -0
  323. package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts +28 -0
  324. package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts.map +1 -0
  325. package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.js +48 -0
  326. package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts +34 -0
  327. package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts.map +1 -0
  328. package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.js +179 -0
  329. package/lib/front_end/third_party/intl-messageformat/package/package.json +42 -0
  330. package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts +34 -0
  331. package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts.map +1 -0
  332. package/lib/front_end/third_party/intl-messageformat/package/src/core.js +230 -0
  333. package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts +28 -0
  334. package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts.map +1 -0
  335. package/lib/front_end/third_party/intl-messageformat/package/src/error.js +51 -0
  336. package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts +34 -0
  337. package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts.map +1 -0
  338. package/lib/front_end/third_party/intl-messageformat/package/src/formatters.js +182 -0
  339. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/error.d.ts +79 -0
  340. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/index.d.ts +15 -0
  341. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/parser.d.ts +153 -0
  342. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/types.d.ts +139 -0
  343. package/lib/front_end/third_party/legacy-javascript/LICENSE +202 -0
  344. package/lib/front_end/third_party/legacy-javascript/README.chromium +13 -0
  345. package/lib/front_end/third_party/legacy-javascript/legacy-javascript-tsconfig.json +8 -0
  346. package/lib/front_end/third_party/legacy-javascript/legacy-javascript.ts +3 -0
  347. package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.d.ts +18 -0
  348. package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.js +943 -0
  349. package/lib/front_end/third_party/legacy-javascript/package.json +8 -0
  350. package/lib/front_end/third_party/legacy-javascript/rebuild.sh +9 -0
  351. package/lib/front_end/third_party/third-party-web/LICENSE +20 -0
  352. package/lib/front_end/third_party/third-party-web/README.chromium +13 -0
  353. package/lib/front_end/third_party/third-party-web/lib/nostats-subset.d.ts +2 -0
  354. package/lib/front_end/third_party/third-party-web/lib/nostats-subset.js +149 -0
  355. package/lib/front_end/third_party/third-party-web/package/LICENSE +20 -0
  356. package/lib/front_end/third_party/third-party-web/package/README.md +929 -0
  357. package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive-nostats.json +1 -0
  358. package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive.json +1 -0
  359. package/lib/front_end/third_party/third-party-web/package/dist/entities-nostats.json +1 -0
  360. package/lib/front_end/third_party/third-party-web/package/dist/entities.json +1 -0
  361. package/lib/front_end/third_party/third-party-web/package/facades.md +46 -0
  362. package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.d.ts +1 -0
  363. package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.js +1 -0
  364. package/lib/front_end/third_party/third-party-web/package/httparchive-subset.d.ts +1 -0
  365. package/lib/front_end/third_party/third-party-web/package/httparchive-subset.js +1 -0
  366. package/lib/front_end/third_party/third-party-web/package/lib/__snapshots__/index.test.js.snap +1006 -0
  367. package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.js +139 -0
  368. package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.test.js +44 -0
  369. package/lib/front_end/third_party/third-party-web/package/lib/entities.test.js +27 -0
  370. package/lib/front_end/third_party/third-party-web/package/lib/index.d.ts +34 -0
  371. package/lib/front_end/third_party/third-party-web/package/lib/index.js +3 -0
  372. package/lib/front_end/third_party/third-party-web/package/lib/index.test.js +246 -0
  373. package/lib/front_end/third_party/third-party-web/package/lib/markdown/faqs.partial.md +36 -0
  374. package/lib/front_end/third_party/third-party-web/package/lib/markdown/goals.partial.md +9 -0
  375. package/lib/front_end/third_party/third-party-web/package/lib/markdown/methodology.partial.md +5 -0
  376. package/lib/front_end/third_party/third-party-web/package/lib/markdown/template.md +151 -0
  377. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-02-01.md +1 -0
  378. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-03-01.md +1 -0
  379. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-06.md +1 -0
  380. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-13.md +14 -0
  381. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2021-01-01.md +1 -0
  382. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2024-07-01.md +3 -0
  383. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.d.ts +1 -0
  384. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.js +3 -0
  385. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.d.ts +1 -0
  386. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.js +3 -0
  387. package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.d.ts +1 -0
  388. package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.js +3 -0
  389. package/lib/front_end/third_party/third-party-web/package/nostats-subset.d.ts +1 -0
  390. package/lib/front_end/third_party/third-party-web/package/nostats-subset.js +1 -0
  391. package/lib/front_end/third_party/third-party-web/package/package.json +46 -0
  392. package/lib/front_end/third_party/third-party-web/package.json +8 -0
  393. package/lib/front_end/third_party/third-party-web/rebuild.sh +13 -0
  394. package/lib/front_end/third_party/third-party-web/third-party-web-tsconfig.json +8 -0
  395. package/lib/front_end/third_party/third-party-web/third-party-web.ts +3 -0
  396. package/package.json +24 -0
  397. package/patches/chrome-devtools-frontend+1.0.1533544.patch +187 -0
@@ -0,0 +1,1138 @@
1
+ // Copyright 2023 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import * as i18n from '../../core/i18n/i18n.js';
6
+ import type * as Platform from '../../core/platform/platform.js';
7
+
8
+ import * as Handlers from './handlers/handlers.js';
9
+ import * as Helpers from './helpers/helpers.js';
10
+ import * as Types from './types/types.js';
11
+
12
+ const UIStrings = {
13
+ /**
14
+ * @description Category in the Summary view of the Performance panel to indicate time spent to load resources
15
+ */
16
+ loading: 'Loading',
17
+ /**
18
+ * @description Text in Timeline for the Experience title
19
+ */
20
+ experience: 'Experience',
21
+ /**
22
+ * @description Category in the Summary view of the Performance panel to indicate time spent in script execution
23
+ */
24
+ scripting: 'Scripting',
25
+ /**
26
+ * @description Category in the Summary view of the Performance panel to indicate time spent in rendering the web page
27
+ */
28
+ rendering: 'Rendering',
29
+ /**
30
+ * @description Category in the Summary view of the Performance panel to indicate time spent to visually represent the web page
31
+ */
32
+ painting: 'Painting',
33
+ /**
34
+ * @description Event category in the Performance panel for time spent in the GPU
35
+ */
36
+ gpu: 'GPU',
37
+ /**
38
+ * @description Text in Timeline UIUtils of the Performance panel
39
+ */
40
+ async: 'Async',
41
+ /**
42
+ * @description Category in the Summary view of the Performance panel to indicate time spent in the rest of the system
43
+ */
44
+ system: 'System',
45
+ /**
46
+ * @description Category in the Summary view of the Performance panel to indicate idle time
47
+ */
48
+ idle: 'Idle',
49
+ /**
50
+ * @description Text in Timeline UIUtils of the Performance panel
51
+ */
52
+ task: 'Task',
53
+ /**
54
+ * @description Text in Timeline UIUtils of the Performance panel
55
+ */
56
+ consoleTaskRun: 'Run console task',
57
+ /**
58
+ * @description Text for other types of items
59
+ */
60
+ other: 'Other',
61
+ /**
62
+ * @description Text that refers to the animation of the web page
63
+ */
64
+ animation: 'Animation',
65
+ /**
66
+ * @description Text that refers to some events
67
+ */
68
+ event: 'Event',
69
+ /**
70
+ * @description Text in Timeline UIUtils of the Performance panel
71
+ */
72
+ requestMainThreadFrame: 'Request main thread frame',
73
+ /**
74
+ * @description Text in Timeline UIUtils of the Performance panel
75
+ */
76
+ frameStart: 'Frame start',
77
+ /**
78
+ * @description Text in Timeline UIUtils of the Performance panel
79
+ */
80
+ onMessage: 'On message',
81
+ /**
82
+ * @description Text in Timeline UIUtils of the Performance panel
83
+ */
84
+ schedulePostMessage: 'Schedule postMessage',
85
+ /**
86
+ * @description Text in Timeline UIUtils of the Performance panel
87
+ */
88
+ messaging: 'Messaging',
89
+ /**
90
+ * @description Text in Timeline UIUtils of the Performance panel
91
+ */
92
+ frameStartMainThread: 'Frame start (main thread)',
93
+ /**
94
+ * @description Text in Timeline UIUtils of the Performance panel
95
+ */
96
+ drawFrame: 'Draw frame',
97
+ /**
98
+ * @description Noun for an event in the Performance panel. This marks time
99
+ * spent in an operation that only happens when the profiler is active.
100
+ */
101
+ profilingOverhead: 'Profiling overhead',
102
+ /**
103
+ * @description The process the browser uses to determine a target element for a
104
+ *pointer event. Typically, this is determined by considering the pointer's
105
+ *location and also the visual layout of elements on the screen.
106
+ */
107
+ hitTest: 'Hit test',
108
+ /**
109
+ * @description Noun for an event in the Performance panel. The browser has decided
110
+ *that the styles for some elements need to be recalculated and scheduled that
111
+ *recalculation process at some time in the future.
112
+ */
113
+ scheduleStyleRecalculation: 'Schedule style recalculation',
114
+ /**
115
+ * @description Text in Timeline UIUtils of the Performance panel
116
+ */
117
+ recalculateStyle: 'Recalculate style',
118
+ /**
119
+ * @description Text in Timeline UIUtils of the Performance panel
120
+ */
121
+ invalidateLayout: 'Invalidate Layout',
122
+ /**
123
+ * @description Noun for an event in the Performance panel. Layerize is a step
124
+ *where we calculate which layers to create.
125
+ */
126
+ layerize: 'Layerize',
127
+ /**
128
+ * @description Text in Timeline UIUtils of the Performance panel
129
+ */
130
+ layout: 'Layout',
131
+ /**
132
+ * @description Noun for an event in the Performance panel. Paint setup is a
133
+ *step before the 'Paint' event. A paint event is when the browser draws pixels
134
+ *to the screen. This step is the setup beforehand.
135
+ */
136
+ paintSetup: 'Paint setup',
137
+ /**
138
+ * @description Noun for a paint event in the Performance panel, where an image
139
+ *was being painted. A paint event is when the browser draws pixels to the
140
+ *screen, in this case specifically for an image in a website.
141
+ */
142
+ paintImage: 'Paint image',
143
+ /**
144
+ * @description Noun for an event in the Performance panel. Pre-paint is a
145
+ *step before the 'Paint' event. A paint event is when the browser records the
146
+ *instructions for drawing the page. This step is the setup beforehand.
147
+ */
148
+ prePaint: 'Pre-paint',
149
+ /**
150
+ * @description Text in Timeline UIUtils of the Performance panel
151
+ */
152
+ updateLayer: 'Update layer',
153
+ /**
154
+ * @description Text in Timeline UIUtils of the Performance panel
155
+ */
156
+ updateLayerTree: 'Update layer tree',
157
+ /**
158
+ * @description Noun for a paint event in the Performance panel. A paint event is when the browser draws pixels to the screen.
159
+ */
160
+ paint: 'Paint',
161
+ /**
162
+ * @description Text in Timeline UIUtils of the Performance panel
163
+ */
164
+ rasterizePaint: 'Rasterize paint',
165
+ /**
166
+ * @description The action to scroll
167
+ */
168
+ scroll: 'Scroll',
169
+ /**
170
+ * @description Noun for an event in the Performance panel. Commit is a step
171
+ *where we send (also known as "commit") layers to the compositor thread. This
172
+ *step follows the "Layerize" step which is what calculates which layers to
173
+ *create.
174
+ */
175
+ commit: 'Commit',
176
+ /**
177
+ * @description Text in Timeline UIUtils of the Performance panel
178
+ */
179
+ compositeLayers: 'Composite layers',
180
+ /**
181
+ * @description Text in Timeline UIUtils of the Performance panel
182
+ */
183
+ computeIntersections: 'Compute intersections',
184
+ /**
185
+ * @description Text in Timeline UIUtils of the Performance panel
186
+ */
187
+ parseHtml: 'Parse HTML',
188
+ /**
189
+ * @description Text in Timeline UIUtils of the Performance panel
190
+ */
191
+ parseStylesheet: 'Parse stylesheet',
192
+ /**
193
+ * @description Text in Timeline UIUtils of the Performance panel
194
+ */
195
+ installTimer: 'Install timer',
196
+ /**
197
+ * @description Text in Timeline UIUtils of the Performance panel
198
+ */
199
+ removeTimer: 'Remove timer',
200
+ /**
201
+ * @description Text in Timeline UIUtils of the Performance panel
202
+ */
203
+ timerFired: 'Timer fired',
204
+ /**
205
+ * @description Text for an event. Shown in the timeline in the Performance panel.
206
+ * XHR refers to XmlHttpRequest, a Web API. This particular Web API has a property
207
+ * named 'readyState' (https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState). When
208
+ * the 'readyState' property changes the text is shown.
209
+ */
210
+ xhrReadyStateChange: '`XHR` `readyState` change',
211
+ /**
212
+ * @description Text for an event. Shown in the timeline in the Performance panel.
213
+ * XHR refers to XmlHttpRequest, a Web API. (see https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest)
214
+ * The text is shown when a XmlHttpRequest load event happens on the inspected page.
215
+ */
216
+ xhrLoad: '`XHR` load',
217
+ /**
218
+ * @description Text in Timeline UIUtils of the Performance panel
219
+ */
220
+ compileScript: 'Compile script',
221
+ /**
222
+ * @description Text in Timeline UIUtils of the Performance panel
223
+ */
224
+ cacheScript: 'Cache script code',
225
+ /**
226
+ * @description Text in Timeline UIUtils of the Performance panel
227
+ */
228
+ compileCode: 'Compile code',
229
+ /**
230
+ * @description Text in Timeline UIUtils of the Performance panel
231
+ */
232
+ optimizeCode: 'Optimize code',
233
+ /**
234
+ * @description Text in Timeline UIUtils of the Performance panel
235
+ */
236
+ evaluateScript: 'Evaluate script',
237
+ /**
238
+ * @description Text in Timeline UIUtils of the Performance panel
239
+ */
240
+ compileModule: 'Compile module',
241
+ /**
242
+ * @description Text in Timeline UIUtils of the Performance panel
243
+ */
244
+ cacheModule: 'Cache module code',
245
+ /**
246
+ * @description Text for an event. Shown in the timeline in the Performance panel.
247
+ * "Module" refers to JavaScript modules: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
248
+ * JavaScript modules are a way to organize JavaScript code.
249
+ * "Evaluate" is the phase when the JavaScript code of a module is executed.
250
+ */
251
+ evaluateModule: 'Evaluate module',
252
+ /**
253
+ * @description Noun indicating that a compile task (type: streaming) happened.
254
+ */
255
+ streamingCompileTask: 'Streaming compile task',
256
+ /**
257
+ * @description Text in Timeline UIUtils of the Performance panel
258
+ */
259
+ waitingForNetwork: 'Waiting for network',
260
+ /**
261
+ * @description Text in Timeline UIUtils of the Performance panel
262
+ */
263
+ parseAndCompile: 'Parse and compile',
264
+ /**
265
+ * @description Text in Timeline UIUtils of the Performance panel.
266
+ * "Code Cache" refers to JavaScript bytecode cache: https://v8.dev/blog/code-caching-for-devs
267
+ * "Deserialize" refers to the process of reading the code cache.
268
+ */
269
+ deserializeCodeCache: 'Deserialize code cache',
270
+ /**
271
+ * @description Text in Timeline UIUtils of the Performance panel
272
+ */
273
+ streamingWasmResponse: 'Streaming Wasm response',
274
+ /**
275
+ * @description Text in Timeline UIUtils of the Performance panel
276
+ */
277
+ compiledWasmModule: 'Compiled Wasm module',
278
+ /**
279
+ * @description Text in Timeline UIUtils of the Performance panel
280
+ */
281
+ cachedWasmModule: 'Cached Wasm module',
282
+ /**
283
+ * @description Text in Timeline UIUtils of the Performance panel
284
+ */
285
+ wasmModuleCacheHit: 'Wasm module cache hit',
286
+ /**
287
+ * @description Text in Timeline UIUtils of the Performance panel
288
+ */
289
+ wasmModuleCacheInvalid: 'Wasm module cache invalid',
290
+ /**
291
+ * @description Text in Timeline UIUtils of the Performance panel
292
+ */
293
+ frameStartedLoading: 'Frame started loading',
294
+ /**
295
+ * @description Text in Timeline UIUtils of the Performance panel
296
+ */
297
+ onloadEvent: 'Onload event',
298
+ /**
299
+ * @description Text in Timeline UIUtils of the Performance panel
300
+ */
301
+ domcontentloadedEvent: 'DOMContentLoaded event',
302
+ /**
303
+ * @description Text in Timeline UIUtils of the Performance panel
304
+ */
305
+ firstPaint: 'First Paint',
306
+ /**
307
+ * @description Text in Timeline UIUtils of the Performance panel
308
+ */
309
+ firstContentfulPaint: 'First Contentful Paint',
310
+ /**
311
+ * @description Text in Timeline UIUtils of the Performance panel
312
+ */
313
+ largestContentfulPaint: 'Largest Contentful Paint',
314
+ /**
315
+ * @description Text for timestamps of items
316
+ */
317
+ timestamp: 'Timestamp',
318
+ /**
319
+ * @description Noun for a 'time' event that happens in the Console (a tool in
320
+ * DevTools). The user can trigger console time events from their code, and
321
+ * they will show up in the Performance panel. Time events are used to measure
322
+ * the duration of something, e.g. the user will emit two time events at the
323
+ * start and end of some interesting task.
324
+ */
325
+ consoleTime: 'Console time',
326
+ /**
327
+ * @description Text in Timeline UIUtils of the Performance panel
328
+ */
329
+ userTiming: 'User timing',
330
+ /**
331
+ * @description Name for an event shown in the Performance panel. When a network
332
+ * request is about to be sent by the browser, the time is recorded and DevTools
333
+ * is notified that a network request will be sent momentarily.
334
+ */
335
+ willSendRequest: 'Will send request',
336
+ /**
337
+ * @description Text in Timeline UIUtils of the Performance panel
338
+ */
339
+ sendRequest: 'Send request',
340
+ /**
341
+ * @description Text in Timeline UIUtils of the Performance panel
342
+ */
343
+ receiveResponse: 'Receive response',
344
+ /**
345
+ * @description Text in Timeline UIUtils of the Performance panel
346
+ */
347
+ finishLoading: 'Finish loading',
348
+ /**
349
+ * @description Text in Timeline UIUtils of the Performance panel
350
+ */
351
+ receiveData: 'Receive data',
352
+ /**
353
+ * @description Event category in the Performance panel for time spent to execute microtasks in JavaScript
354
+ */
355
+ runMicrotasks: 'Run microtasks',
356
+ /**
357
+ * @description Text in Timeline UIUtils of the Performance panel
358
+ */
359
+ functionCall: 'Function call',
360
+ /**
361
+ * @description Text in Timeline UIUtils of the Performance panel
362
+ */
363
+ gcEvent: 'GC event',
364
+ /**
365
+ * @description Event category in the Performance panel for time spent to perform a full Garbage Collection pass
366
+ */
367
+ majorGc: 'Major GC',
368
+ /**
369
+ * @description Event category in the Performance panel for time spent to perform a quick Garbage Collection pass
370
+ */
371
+ minorGc: 'Minor GC',
372
+ /**
373
+ * @description Text for the request animation frame event
374
+ */
375
+ requestAnimationFrame: 'Request animation frame',
376
+ /**
377
+ * @description Text to cancel the animation frame
378
+ */
379
+ cancelAnimationFrame: 'Cancel animation frame',
380
+ /**
381
+ * @description Text for the event that an animation frame is fired
382
+ */
383
+ animationFrameFired: 'Animation frame fired',
384
+ /**
385
+ * @description Text in Timeline UIUtils of the Performance panel
386
+ */
387
+ requestIdleCallback: 'Request idle callback',
388
+ /**
389
+ * @description Text in Timeline UIUtils of the Performance panel
390
+ */
391
+ cancelIdleCallback: 'Cancel idle callback',
392
+ /**
393
+ * @description Text in Timeline UIUtils of the Performance panel
394
+ */
395
+ fireIdleCallback: 'Fire idle callback',
396
+ /**
397
+ * @description Text in Timeline UIUtils of the Performance panel
398
+ */
399
+ createWebsocket: 'Create WebSocket',
400
+ /**
401
+ * @description Text in Timeline UIUtils of the Performance panel
402
+ */
403
+ sendWebsocketHandshake: 'Send WebSocket handshake',
404
+ /**
405
+ * @description Text in Timeline UIUtils of the Performance panel
406
+ */
407
+ receiveWebsocketHandshake: 'Receive WebSocket handshake',
408
+ /**
409
+ * @description Text in Timeline Flame Chart Data Provider of the Performance panel
410
+ */
411
+ wsMessageReceived: 'Receive WebSocket message',
412
+ /**
413
+ * @description Text in Timeline Flame Chart Data Provider of the Performance panel
414
+ */
415
+ wsMessageSent: 'Send WebSocket message',
416
+ /**
417
+ * @description Text in Timeline UIUtils of the Performance panel
418
+ */
419
+ destroyWebsocket: 'Destroy WebSocket',
420
+ /**
421
+ * @description Event category in the Performance panel for time spent in the embedder of the WebView
422
+ */
423
+ embedderCallback: 'Embedder callback',
424
+ /**
425
+ * @description Event category in the Performance panel for time spent decoding an image
426
+ */
427
+ imageDecode: 'Image decode',
428
+ /**
429
+ * @description Event category in the Performance panel for time spent to perform Garbage Collection for the Document Object Model
430
+ */
431
+ domGc: 'DOM GC',
432
+ /**
433
+ * @description Event category in the Performance panel for time spent to perform Garbage Collection for C++: https://chromium.googlesource.com/v8/v8/+/main/include/cppgc/README.md
434
+ */
435
+ cppGc: 'CPP GC',
436
+ /**
437
+ * @description Event category in the Performance panel for time spent to perform encryption
438
+ */
439
+ encrypt: 'Encrypt',
440
+ /**
441
+ * @description Text in Timeline UIUtils of the Performance panel
442
+ */
443
+ encryptReply: 'Encrypt reply',
444
+ /**
445
+ * @description Event category in the Performance panel for time spent to perform decryption
446
+ */
447
+ decrypt: 'Decrypt',
448
+ /**
449
+ * @description Text in Timeline UIUtils of the Performance panel
450
+ */
451
+ decryptReply: 'Decrypt reply',
452
+ /**
453
+ * @description Noun phrase meaning 'the browser was preparing the digest'.
454
+ * Digest: https://developer.mozilla.org/en-US/docs/Glossary/Digest
455
+ */
456
+ digest: 'Digest',
457
+ /**
458
+ * @description Noun phrase meaning 'the browser was preparing the digest
459
+ *reply'. Digest: https://developer.mozilla.org/en-US/docs/Glossary/Digest
460
+ */
461
+ digestReply: 'Digest reply',
462
+ /**
463
+ * @description The 'sign' stage of a web crypto event. Shown when displaying what the website was doing at a particular point in time.
464
+ */
465
+ sign: 'Sign',
466
+ /**
467
+ * @description Noun phrase for an event of the Web Crypto API. The event is recorded when the signing process is concluded.
468
+ * Signature: https://developer.mozilla.org/en-US/docs/Glossary/Signature/Security
469
+ */
470
+ signReply: 'Sign reply',
471
+ /**
472
+ * @description Text in Timeline UIUtils of the Performance panel
473
+ */
474
+ verify: 'Verify',
475
+ /**
476
+ * @description Text in Timeline UIUtils of the Performance panel
477
+ */
478
+ verifyReply: 'Verify reply',
479
+ /**
480
+ * @description Text in Timeline UIUtils of the Performance panel
481
+ */
482
+ asyncTask: 'Async task',
483
+ /**
484
+ * @description Text in Timeline for Layout Shift records
485
+ */
486
+ layoutShift: 'Layout shift',
487
+ /**
488
+ * @description Text in Timeline for Layout Shift records
489
+ */
490
+ layoutShiftCluster: 'Layout shift cluster',
491
+ /**
492
+ * @description Text in Timeline for an Event Timing record
493
+ */
494
+ eventTiming: 'Event timing',
495
+ /**
496
+ * @description Event category in the Performance panel for JavaScript nodes in CPUProfile
497
+ */
498
+ jsFrame: 'JS frame',
499
+ /**
500
+ * @description Text in UIDevtools Utils of the Performance panel
501
+ */
502
+ rasterizing: 'Rasterizing',
503
+ /**
504
+ * @description Text in UIDevtools Utils of the Performance panel
505
+ */
506
+ drawing: 'Drawing',
507
+ /**
508
+ * @description Label for an event in the Performance panel indicating that a
509
+ * callback function has been scheduled to run at a later time using the
510
+ * postTask API.
511
+ */
512
+ schedulePostTaskCallback: 'Schedule postTask',
513
+ /**
514
+ * @description Label for an event in the Performance panel indicating that a
515
+ * callback function that was scheduled to run using the postTask API was
516
+ * fired (invoked).
517
+ */
518
+ runPostTaskCallback: 'Fire postTask',
519
+ /**
520
+ * @description Label for an event in the Performance panel indicating that a
521
+ * callback function that was scheduled to run at a later time using the
522
+ * postTask API was cancelled, so will no longer run.
523
+ */
524
+ abortPostTaskCallback: 'Cancel postTask',
525
+ } as const;
526
+
527
+ export enum EventCategory {
528
+ DRAWING = 'drawing',
529
+ RASTERIZING = 'rasterizing',
530
+ LAYOUT = 'layout',
531
+ LOADING = 'loading',
532
+ EXPERIENCE = 'experience',
533
+ SCRIPTING = 'scripting',
534
+ MESSAGING = 'messaging',
535
+ RENDERING = 'rendering',
536
+ PAINTING = 'painting',
537
+ GPU = 'gpu',
538
+ ASYNC = 'async',
539
+ OTHER = 'other',
540
+ IDLE = 'idle',
541
+ }
542
+
543
+ let mainEventCategories: EventCategory[];
544
+
545
+ const str_ = i18n.i18n.registerUIStrings('models/trace/Styles.ts', UIStrings);
546
+ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
547
+
548
+ export class TimelineRecordStyle {
549
+ title: string;
550
+ category: TimelineCategory;
551
+ hidden: boolean;
552
+
553
+ constructor(title: string, category: TimelineCategory, hidden: boolean|undefined = false) {
554
+ this.title = title;
555
+ this.category = category;
556
+ this.hidden = hidden;
557
+ }
558
+ }
559
+ export class TimelineCategory {
560
+ name: EventCategory;
561
+ title: Platform.UIString.LocalizedString;
562
+ visible: boolean;
563
+ #hidden?: boolean;
564
+ #cssVariable: `--app-color-${string}`;
565
+
566
+ constructor(
567
+ name: EventCategory, title: Platform.UIString.LocalizedString, visible: boolean,
568
+ cssVariable: `--app-color-${string}`) {
569
+ this.name = name;
570
+ this.title = title;
571
+ this.visible = visible;
572
+ this.#cssVariable = cssVariable;
573
+ this.hidden = false;
574
+ }
575
+
576
+ get hidden(): boolean {
577
+ return Boolean(this.#hidden);
578
+ }
579
+
580
+ get cssVariable(): string {
581
+ return this.#cssVariable;
582
+ }
583
+
584
+ getCSSValue(): string {
585
+ return `var(${this.#cssVariable})`;
586
+ }
587
+
588
+ set hidden(hidden: boolean) {
589
+ this.#hidden = hidden;
590
+ }
591
+ }
592
+
593
+ export type CategoryPalette = Record<EventCategory, TimelineCategory>;
594
+
595
+ type EventStylesMap = Partial<Record<Types.Events.Name, TimelineRecordStyle>>;
596
+
597
+ /**
598
+ * This object defines the styles for the categories used in the
599
+ * timeline (loading, rendering, scripting, etc.).
600
+ */
601
+ let categoryStyles: CategoryPalette|null;
602
+
603
+ /**
604
+ * This map defines the styles for events shown in the panel. This
605
+ * includes its color (which on the event's category, the label it's
606
+ * displayed with and flag to know weather it's visible in the flamechart
607
+ * or not).
608
+ * The thread appenders use this map to determine if an event should be
609
+ * shown in the flame chart. If an event is not in the map, then it
610
+ * won't be shown, but it also won't be shown if it's marked as "hidden"
611
+ * in its styles.
612
+ *
613
+ * The map is also used in other places, like the event's details view.
614
+ */
615
+ let eventStylesMap: EventStylesMap|null;
616
+
617
+ export function getEventStyle(eventName: Types.Events.Name): TimelineRecordStyle|undefined {
618
+ return maybeInitSylesMap()[eventName];
619
+ }
620
+
621
+ export function stringIsEventCategory(it: string): it is EventCategory {
622
+ return (Object.values(EventCategory) as string[]).includes(it);
623
+ }
624
+
625
+ export function getCategoryStyles(): CategoryPalette {
626
+ if (categoryStyles) {
627
+ return categoryStyles;
628
+ }
629
+ categoryStyles = {
630
+ loading: new TimelineCategory(EventCategory.LOADING, i18nString(UIStrings.loading), true, '--app-color-loading'),
631
+ experience: new TimelineCategory(
632
+ EventCategory.EXPERIENCE, i18nString(UIStrings.experience), false, '--app-color-rendering'),
633
+ messaging:
634
+ new TimelineCategory(EventCategory.MESSAGING, i18nString(UIStrings.messaging), true, '--app-color-messaging'),
635
+ scripting:
636
+ new TimelineCategory(EventCategory.SCRIPTING, i18nString(UIStrings.scripting), true, '--app-color-scripting'),
637
+ rendering:
638
+ new TimelineCategory(EventCategory.RENDERING, i18nString(UIStrings.rendering), true, '--app-color-rendering'),
639
+ painting:
640
+ new TimelineCategory(EventCategory.PAINTING, i18nString(UIStrings.painting), true, '--app-color-painting'),
641
+ gpu: new TimelineCategory(EventCategory.GPU, i18nString(UIStrings.gpu), false, '--app-color-painting'),
642
+ async: new TimelineCategory(EventCategory.ASYNC, i18nString(UIStrings.async), false, '--app-color-async'),
643
+ other: new TimelineCategory(EventCategory.OTHER, i18nString(UIStrings.system), false, '--app-color-system'),
644
+ idle: new TimelineCategory(EventCategory.IDLE, i18nString(UIStrings.idle), false, '--app-color-idle'),
645
+ layout: new TimelineCategory(EventCategory.LAYOUT, i18nString(UIStrings.layout), false, '--app-color-loading'),
646
+ rasterizing: new TimelineCategory(
647
+ EventCategory.RASTERIZING, i18nString(UIStrings.rasterizing), false, '--app-color-scripting'),
648
+ drawing: new TimelineCategory(EventCategory.DRAWING, i18nString(UIStrings.drawing), false, '--app-color-rendering'),
649
+ };
650
+ return categoryStyles;
651
+ }
652
+
653
+ export function maybeInitSylesMap(): EventStylesMap {
654
+ if (eventStylesMap) {
655
+ return eventStylesMap;
656
+ }
657
+ const defaultCategoryStyles = getCategoryStyles();
658
+
659
+ eventStylesMap = {
660
+ [Types.Events.Name.RUN_TASK]: new TimelineRecordStyle(i18nString(UIStrings.task), defaultCategoryStyles.other),
661
+
662
+ [Types.Events.Name.PROFILE_CALL]:
663
+ new TimelineRecordStyle(i18nString(UIStrings.jsFrame), defaultCategoryStyles.scripting),
664
+
665
+ [Types.Events.Name.JS_SAMPLE]:
666
+ new TimelineRecordStyle(Types.Events.Name.JS_SAMPLE, defaultCategoryStyles.scripting),
667
+
668
+ [Types.Events.Name.PROGRAM]: new TimelineRecordStyle(i18nString(UIStrings.other), defaultCategoryStyles.other),
669
+
670
+ [Types.Events.Name.START_PROFILING]:
671
+ new TimelineRecordStyle(i18nString(UIStrings.profilingOverhead), defaultCategoryStyles.other),
672
+
673
+ [Types.Events.Name.ANIMATION]:
674
+ new TimelineRecordStyle(i18nString(UIStrings.animation), defaultCategoryStyles.rendering),
675
+
676
+ [Types.Events.Name.EVENT_DISPATCH]:
677
+ new TimelineRecordStyle(i18nString(UIStrings.event), defaultCategoryStyles.scripting),
678
+
679
+ [Types.Events.Name.REQUEST_MAIN_THREAD_FRAME]: new TimelineRecordStyle(
680
+ i18nString(UIStrings.requestMainThreadFrame),
681
+ defaultCategoryStyles.rendering,
682
+ true,
683
+ ),
684
+
685
+ [Types.Events.Name.BEGIN_FRAME]: new TimelineRecordStyle(
686
+ i18nString(UIStrings.frameStart),
687
+ defaultCategoryStyles.rendering,
688
+ true,
689
+ ),
690
+
691
+ [Types.Events.Name.BEGIN_MAIN_THREAD_FRAME]: new TimelineRecordStyle(
692
+ i18nString(UIStrings.frameStartMainThread),
693
+ defaultCategoryStyles.rendering,
694
+ true,
695
+ ),
696
+
697
+ [Types.Events.Name.DRAW_FRAME]: new TimelineRecordStyle(
698
+ i18nString(UIStrings.drawFrame),
699
+ defaultCategoryStyles.rendering,
700
+ true,
701
+ ),
702
+
703
+ [Types.Events.Name.HIT_TEST]:
704
+ new TimelineRecordStyle(i18nString(UIStrings.hitTest), defaultCategoryStyles.rendering),
705
+
706
+ [Types.Events.Name.SCHEDULE_STYLE_RECALCULATION]: new TimelineRecordStyle(
707
+ i18nString(UIStrings.scheduleStyleRecalculation),
708
+ defaultCategoryStyles.rendering,
709
+ ),
710
+
711
+ [Types.Events.Name.RECALC_STYLE]:
712
+ new TimelineRecordStyle(i18nString(UIStrings.recalculateStyle), defaultCategoryStyles.rendering),
713
+
714
+ [Types.Events.Name.INVALIDATE_LAYOUT]: new TimelineRecordStyle(
715
+ i18nString(UIStrings.invalidateLayout),
716
+ defaultCategoryStyles.rendering,
717
+ true,
718
+ ),
719
+
720
+ [Types.Events.Name.LAYERIZE]:
721
+ new TimelineRecordStyle(i18nString(UIStrings.layerize), defaultCategoryStyles.rendering),
722
+
723
+ [Types.Events.Name.LAYOUT]: new TimelineRecordStyle(i18nString(UIStrings.layout), defaultCategoryStyles.rendering),
724
+
725
+ [Types.Events.Name.PAINT_SETUP]:
726
+ new TimelineRecordStyle(i18nString(UIStrings.paintSetup), defaultCategoryStyles.painting),
727
+
728
+ [Types.Events.Name.PAINT_IMAGE]: new TimelineRecordStyle(
729
+ i18nString(UIStrings.paintImage),
730
+ defaultCategoryStyles.painting,
731
+ true,
732
+ ),
733
+
734
+ [Types.Events.Name.UPDATE_LAYER]: new TimelineRecordStyle(
735
+ i18nString(UIStrings.updateLayer),
736
+ defaultCategoryStyles.painting,
737
+ true,
738
+ ),
739
+
740
+ [Types.Events.Name.UPDATE_LAYER_TREE]:
741
+ new TimelineRecordStyle(i18nString(UIStrings.updateLayerTree), defaultCategoryStyles.rendering),
742
+
743
+ [Types.Events.Name.PAINT]: new TimelineRecordStyle(i18nString(UIStrings.paint), defaultCategoryStyles.painting),
744
+
745
+ [Types.Events.Name.PRE_PAINT]:
746
+ new TimelineRecordStyle(i18nString(UIStrings.prePaint), defaultCategoryStyles.rendering),
747
+
748
+ [Types.Events.Name.RASTER_TASK]:
749
+ new TimelineRecordStyle(i18nString(UIStrings.rasterizePaint), defaultCategoryStyles.painting),
750
+
751
+ [Types.Events.Name.SCROLL_LAYER]:
752
+ new TimelineRecordStyle(i18nString(UIStrings.scroll), defaultCategoryStyles.rendering),
753
+
754
+ [Types.Events.Name.COMMIT]: new TimelineRecordStyle(i18nString(UIStrings.commit), defaultCategoryStyles.painting),
755
+
756
+ [Types.Events.Name.COMPOSITE_LAYERS]:
757
+ new TimelineRecordStyle(i18nString(UIStrings.compositeLayers), defaultCategoryStyles.painting),
758
+
759
+ [Types.Events.Name.COMPUTE_INTERSECTION]: new TimelineRecordStyle(
760
+ i18nString(UIStrings.computeIntersections),
761
+ defaultCategoryStyles.rendering,
762
+ ),
763
+
764
+ [Types.Events.Name.PARSE_HTML]:
765
+ new TimelineRecordStyle(i18nString(UIStrings.parseHtml), defaultCategoryStyles.loading),
766
+
767
+ [Types.Events.Name.PARSE_AUTHOR_STYLE_SHEET]:
768
+ new TimelineRecordStyle(i18nString(UIStrings.parseStylesheet), defaultCategoryStyles.loading),
769
+
770
+ [Types.Events.Name.TIMER_INSTALL]:
771
+ new TimelineRecordStyle(i18nString(UIStrings.installTimer), defaultCategoryStyles.scripting),
772
+
773
+ [Types.Events.Name.TIMER_REMOVE]:
774
+ new TimelineRecordStyle(i18nString(UIStrings.removeTimer), defaultCategoryStyles.scripting),
775
+
776
+ [Types.Events.Name.TIMER_FIRE]:
777
+ new TimelineRecordStyle(i18nString(UIStrings.timerFired), defaultCategoryStyles.scripting),
778
+
779
+ [Types.Events.Name.XHR_READY_STATE_CHANGED]: new TimelineRecordStyle(
780
+ i18nString(UIStrings.xhrReadyStateChange),
781
+ defaultCategoryStyles.scripting,
782
+ ),
783
+
784
+ [Types.Events.Name.XHR_LOAD]:
785
+ new TimelineRecordStyle(i18nString(UIStrings.xhrLoad), defaultCategoryStyles.scripting),
786
+
787
+ [Types.Events.Name.COMPILE]:
788
+ new TimelineRecordStyle(i18nString(UIStrings.compileScript), defaultCategoryStyles.scripting),
789
+
790
+ [Types.Events.Name.CACHE_SCRIPT]:
791
+ new TimelineRecordStyle(i18nString(UIStrings.cacheScript), defaultCategoryStyles.scripting),
792
+
793
+ [Types.Events.Name.COMPILE_CODE]:
794
+ new TimelineRecordStyle(i18nString(UIStrings.compileCode), defaultCategoryStyles.scripting),
795
+
796
+ [Types.Events.Name.OPTIMIZE_CODE]:
797
+ new TimelineRecordStyle(i18nString(UIStrings.optimizeCode), defaultCategoryStyles.scripting),
798
+
799
+ [Types.Events.Name.EVALUATE_SCRIPT]:
800
+ new TimelineRecordStyle(i18nString(UIStrings.evaluateScript), defaultCategoryStyles.scripting),
801
+
802
+ [Types.Events.Name.COMPILE_MODULE]:
803
+ new TimelineRecordStyle(i18nString(UIStrings.compileModule), defaultCategoryStyles.scripting),
804
+
805
+ [Types.Events.Name.CACHE_MODULE]:
806
+ new TimelineRecordStyle(i18nString(UIStrings.cacheModule), defaultCategoryStyles.scripting),
807
+
808
+ [Types.Events.Name.EVALUATE_MODULE]:
809
+ new TimelineRecordStyle(i18nString(UIStrings.evaluateModule), defaultCategoryStyles.scripting),
810
+
811
+ [Types.Events.Name.STREAMING_COMPILE_SCRIPT]:
812
+ new TimelineRecordStyle(i18nString(UIStrings.streamingCompileTask), defaultCategoryStyles.other),
813
+
814
+ [Types.Events.Name.STREAMING_COMPILE_SCRIPT_WAITING]:
815
+ new TimelineRecordStyle(i18nString(UIStrings.waitingForNetwork), defaultCategoryStyles.idle),
816
+
817
+ [Types.Events.Name.STREAMING_COMPILE_SCRIPT_PARSING]:
818
+ new TimelineRecordStyle(i18nString(UIStrings.parseAndCompile), defaultCategoryStyles.scripting),
819
+
820
+ [Types.Events.Name.BACKGROUND_DESERIALIZE]: new TimelineRecordStyle(
821
+ i18nString(UIStrings.deserializeCodeCache),
822
+ defaultCategoryStyles.scripting,
823
+ ),
824
+
825
+ [Types.Events.Name.FINALIZE_DESERIALIZATION]:
826
+ new TimelineRecordStyle(i18nString(UIStrings.profilingOverhead), defaultCategoryStyles.other),
827
+
828
+ [Types.Events.Name.WASM_STREAM_FROM_RESPONSE_CALLBACK]: new TimelineRecordStyle(
829
+ i18nString(UIStrings.streamingWasmResponse),
830
+ defaultCategoryStyles.scripting,
831
+ ),
832
+
833
+ [Types.Events.Name.WASM_COMPILED_MODULE]:
834
+ new TimelineRecordStyle(i18nString(UIStrings.compiledWasmModule), defaultCategoryStyles.scripting),
835
+
836
+ [Types.Events.Name.WASM_CACHED_MODULE]:
837
+ new TimelineRecordStyle(i18nString(UIStrings.cachedWasmModule), defaultCategoryStyles.scripting),
838
+
839
+ [Types.Events.Name.WASM_MODULE_CACHE_HIT]:
840
+ new TimelineRecordStyle(i18nString(UIStrings.wasmModuleCacheHit), defaultCategoryStyles.scripting),
841
+
842
+ [Types.Events.Name.WASM_MODULE_CACHE_INVALID]: new TimelineRecordStyle(
843
+ i18nString(UIStrings.wasmModuleCacheInvalid),
844
+ defaultCategoryStyles.scripting,
845
+ ),
846
+
847
+ [Types.Events.Name.FRAME_STARTED_LOADING]: new TimelineRecordStyle(
848
+ i18nString(UIStrings.frameStartedLoading),
849
+ defaultCategoryStyles.loading,
850
+ true,
851
+ ),
852
+
853
+ [Types.Events.Name.MARK_LOAD]: new TimelineRecordStyle(
854
+ i18nString(UIStrings.onloadEvent),
855
+ defaultCategoryStyles.scripting,
856
+ true,
857
+ ),
858
+
859
+ [Types.Events.Name.MARK_DOM_CONTENT]: new TimelineRecordStyle(
860
+ i18nString(UIStrings.domcontentloadedEvent),
861
+ defaultCategoryStyles.scripting,
862
+ true,
863
+ ),
864
+
865
+ [Types.Events.Name.MARK_FIRST_PAINT]: new TimelineRecordStyle(
866
+ i18nString(UIStrings.firstPaint),
867
+ defaultCategoryStyles.painting,
868
+ true,
869
+ ),
870
+
871
+ [Types.Events.Name.MARK_FCP]: new TimelineRecordStyle(
872
+ i18nString(UIStrings.firstContentfulPaint),
873
+ defaultCategoryStyles.rendering,
874
+ true,
875
+ ),
876
+
877
+ [Types.Events.Name.MARK_LCP_CANDIDATE]: new TimelineRecordStyle(
878
+ i18nString(UIStrings.largestContentfulPaint),
879
+ defaultCategoryStyles.rendering,
880
+ true,
881
+ ),
882
+
883
+ [Types.Events.Name.TIME_STAMP]:
884
+ new TimelineRecordStyle(i18nString(UIStrings.timestamp), defaultCategoryStyles.scripting),
885
+
886
+ [Types.Events.Name.CONSOLE_TIME]:
887
+ new TimelineRecordStyle(i18nString(UIStrings.consoleTime), defaultCategoryStyles.scripting),
888
+
889
+ [Types.Events.Name.USER_TIMING]:
890
+ new TimelineRecordStyle(i18nString(UIStrings.userTiming), defaultCategoryStyles.scripting),
891
+
892
+ [Types.Events.Name.RESOURCE_WILL_SEND_REQUEST]:
893
+ new TimelineRecordStyle(i18nString(UIStrings.willSendRequest), defaultCategoryStyles.loading),
894
+
895
+ [Types.Events.Name.RESOURCE_SEND_REQUEST]:
896
+ new TimelineRecordStyle(i18nString(UIStrings.sendRequest), defaultCategoryStyles.loading),
897
+
898
+ [Types.Events.Name.RESOURCE_RECEIVE_RESPONSE]:
899
+ new TimelineRecordStyle(i18nString(UIStrings.receiveResponse), defaultCategoryStyles.loading),
900
+
901
+ [Types.Events.Name.RESOURCE_FINISH]:
902
+ new TimelineRecordStyle(i18nString(UIStrings.finishLoading), defaultCategoryStyles.loading),
903
+
904
+ [Types.Events.Name.RESOURCE_RECEIVE_DATA]:
905
+ new TimelineRecordStyle(i18nString(UIStrings.receiveData), defaultCategoryStyles.loading),
906
+
907
+ [Types.Events.Name.RUN_MICROTASKS]:
908
+ new TimelineRecordStyle(i18nString(UIStrings.runMicrotasks), defaultCategoryStyles.scripting),
909
+
910
+ [Types.Events.Name.FUNCTION_CALL]:
911
+ new TimelineRecordStyle(i18nString(UIStrings.functionCall), defaultCategoryStyles.scripting),
912
+
913
+ [Types.Events.Name.GC]: new TimelineRecordStyle(i18nString(UIStrings.gcEvent), defaultCategoryStyles.scripting),
914
+
915
+ [Types.Events.Name.MAJOR_GC]:
916
+ new TimelineRecordStyle(i18nString(UIStrings.majorGc), defaultCategoryStyles.scripting),
917
+
918
+ [Types.Events.Name.MINOR_GC]:
919
+ new TimelineRecordStyle(i18nString(UIStrings.minorGc), defaultCategoryStyles.scripting),
920
+
921
+ [Types.Events.Name.CPPGC_SWEEP]:
922
+ new TimelineRecordStyle(i18nString(UIStrings.cppGc), defaultCategoryStyles.scripting),
923
+
924
+ [Types.Events.Name.REQUEST_ANIMATION_FRAME]: new TimelineRecordStyle(
925
+ i18nString(UIStrings.requestAnimationFrame),
926
+ defaultCategoryStyles.scripting,
927
+ ),
928
+
929
+ [Types.Events.Name.CANCEL_ANIMATION_FRAME]: new TimelineRecordStyle(
930
+ i18nString(UIStrings.cancelAnimationFrame),
931
+ defaultCategoryStyles.scripting,
932
+ ),
933
+
934
+ [Types.Events.Name.FIRE_ANIMATION_FRAME]: new TimelineRecordStyle(
935
+ i18nString(UIStrings.animationFrameFired),
936
+ defaultCategoryStyles.scripting,
937
+ ),
938
+
939
+ [Types.Events.Name.REQUEST_IDLE_CALLBACK]: new TimelineRecordStyle(
940
+ i18nString(UIStrings.requestIdleCallback),
941
+ defaultCategoryStyles.scripting,
942
+ ),
943
+
944
+ [Types.Events.Name.CANCEL_IDLE_CALLBACK]:
945
+ new TimelineRecordStyle(i18nString(UIStrings.cancelIdleCallback), defaultCategoryStyles.scripting),
946
+
947
+ [Types.Events.Name.FIRE_IDLE_CALLBACK]:
948
+ new TimelineRecordStyle(i18nString(UIStrings.fireIdleCallback), defaultCategoryStyles.scripting),
949
+
950
+ [Types.Events.Name.WEB_SOCKET_CREATE]:
951
+ new TimelineRecordStyle(i18nString(UIStrings.createWebsocket), defaultCategoryStyles.scripting),
952
+
953
+ [Types.Events.Name.WEB_SOCKET_SEND_HANDSHAKE_REQUEST]: new TimelineRecordStyle(
954
+ i18nString(UIStrings.sendWebsocketHandshake),
955
+ defaultCategoryStyles.scripting,
956
+ ),
957
+
958
+ [Types.Events.Name.WEB_SOCKET_RECEIVE_HANDSHAKE_REQUEST]: new TimelineRecordStyle(
959
+ i18nString(UIStrings.receiveWebsocketHandshake),
960
+ defaultCategoryStyles.scripting,
961
+ ),
962
+
963
+ [Types.Events.Name.WEB_SOCKET_DESTROY]:
964
+ new TimelineRecordStyle(i18nString(UIStrings.destroyWebsocket), defaultCategoryStyles.scripting),
965
+ [Types.Events.Name.WEB_SOCKET_SEND]: new TimelineRecordStyle(
966
+ i18nString(UIStrings.wsMessageSent),
967
+ defaultCategoryStyles.scripting,
968
+ ),
969
+ [Types.Events.Name.WEB_SOCKET_RECEIVE]: new TimelineRecordStyle(
970
+ i18nString(UIStrings.wsMessageReceived),
971
+ defaultCategoryStyles.scripting,
972
+ ),
973
+
974
+ [Types.Events.Name.EMBEDDER_CALLBACK]:
975
+ new TimelineRecordStyle(i18nString(UIStrings.embedderCallback), defaultCategoryStyles.scripting),
976
+
977
+ [Types.Events.Name.DECODE_IMAGE]:
978
+ new TimelineRecordStyle(i18nString(UIStrings.imageDecode), defaultCategoryStyles.painting),
979
+
980
+ [Types.Events.Name.GPU_TASK]: new TimelineRecordStyle(i18nString(UIStrings.gpu), defaultCategoryStyles.gpu),
981
+
982
+ [Types.Events.Name.GC_COLLECT_GARBARGE]:
983
+ new TimelineRecordStyle(i18nString(UIStrings.domGc), defaultCategoryStyles.scripting),
984
+
985
+ [Types.Events.Name.CRYPTO_DO_ENCRYPT]:
986
+ new TimelineRecordStyle(i18nString(UIStrings.encrypt), defaultCategoryStyles.scripting),
987
+
988
+ [Types.Events.Name.CRYPTO_DO_ENCRYPT_REPLY]:
989
+ new TimelineRecordStyle(i18nString(UIStrings.encryptReply), defaultCategoryStyles.scripting),
990
+
991
+ [Types.Events.Name.CRYPTO_DO_DECRYPT]:
992
+ new TimelineRecordStyle(i18nString(UIStrings.decrypt), defaultCategoryStyles.scripting),
993
+
994
+ [Types.Events.Name.CRYPTO_DO_DECRYPT_REPLY]:
995
+ new TimelineRecordStyle(i18nString(UIStrings.decryptReply), defaultCategoryStyles.scripting),
996
+
997
+ [Types.Events.Name.CRYPTO_DO_DIGEST]:
998
+ new TimelineRecordStyle(i18nString(UIStrings.digest), defaultCategoryStyles.scripting),
999
+
1000
+ [Types.Events.Name.CRYPTO_DO_DIGEST_REPLY]:
1001
+ new TimelineRecordStyle(i18nString(UIStrings.digestReply), defaultCategoryStyles.scripting),
1002
+
1003
+ [Types.Events.Name.CRYPTO_DO_SIGN]:
1004
+ new TimelineRecordStyle(i18nString(UIStrings.sign), defaultCategoryStyles.scripting),
1005
+
1006
+ [Types.Events.Name.CRYPTO_DO_SIGN_REPLY]:
1007
+ new TimelineRecordStyle(i18nString(UIStrings.signReply), defaultCategoryStyles.scripting),
1008
+
1009
+ [Types.Events.Name.CRYPTO_DO_VERIFY]:
1010
+ new TimelineRecordStyle(i18nString(UIStrings.verify), defaultCategoryStyles.scripting),
1011
+
1012
+ [Types.Events.Name.CRYPTO_DO_VERIFY_REPLY]:
1013
+ new TimelineRecordStyle(i18nString(UIStrings.verifyReply), defaultCategoryStyles.scripting),
1014
+
1015
+ [Types.Events.Name.ASYNC_TASK]:
1016
+ new TimelineRecordStyle(i18nString(UIStrings.asyncTask), defaultCategoryStyles.async),
1017
+
1018
+ [Types.Events.Name.LAYOUT_SHIFT]: new TimelineRecordStyle(
1019
+ i18nString(UIStrings.layoutShift), defaultCategoryStyles.experience,
1020
+ /* Mark LayoutShifts as hidden; in the timeline we render
1021
+ * SyntheticLayoutShifts so those are the ones visible to the user */
1022
+ true),
1023
+
1024
+ [Types.Events.Name.SYNTHETIC_LAYOUT_SHIFT]:
1025
+ new TimelineRecordStyle(i18nString(UIStrings.layoutShift), defaultCategoryStyles.experience),
1026
+
1027
+ [Types.Events.Name.SYNTHETIC_LAYOUT_SHIFT_CLUSTER]:
1028
+ new TimelineRecordStyle(i18nString(UIStrings.layoutShiftCluster), defaultCategoryStyles.experience),
1029
+
1030
+ [Types.Events.Name.EVENT_TIMING]:
1031
+ new TimelineRecordStyle(i18nString(UIStrings.eventTiming), defaultCategoryStyles.experience),
1032
+
1033
+ [Types.Events.Name.HANDLE_POST_MESSAGE]:
1034
+ new TimelineRecordStyle(i18nString(UIStrings.onMessage), defaultCategoryStyles.messaging),
1035
+
1036
+ [Types.Events.Name.SCHEDULE_POST_MESSAGE]:
1037
+ new TimelineRecordStyle(i18nString(UIStrings.schedulePostMessage), defaultCategoryStyles.messaging),
1038
+
1039
+ [Types.Events.Name.SCHEDULE_POST_TASK_CALLBACK]:
1040
+ new TimelineRecordStyle(i18nString(UIStrings.schedulePostTaskCallback), defaultCategoryStyles.scripting),
1041
+
1042
+ [Types.Events.Name.RUN_POST_TASK_CALLBACK]:
1043
+ new TimelineRecordStyle(i18nString(UIStrings.runPostTaskCallback), defaultCategoryStyles.scripting),
1044
+
1045
+ [Types.Events.Name.ABORT_POST_TASK_CALLBACK]:
1046
+ new TimelineRecordStyle(i18nString(UIStrings.abortPostTaskCallback), defaultCategoryStyles.scripting),
1047
+ [Types.Events.Name.V8_CONSOLE_RUN_TASK]:
1048
+ new TimelineRecordStyle(i18nString(UIStrings.consoleTaskRun), defaultCategoryStyles.scripting),
1049
+ };
1050
+
1051
+ // TODO(crbug.com/410884528): remove assertion after deduped eventStylesMap for VISIBLE_TRACE_EVENT_TYPES.
1052
+ const visibleEventStyles =
1053
+ Object.entries(eventStylesMap).filter(([, style]) => style.hidden === false).map(([
1054
+ key,
1055
+ ]) => key);
1056
+ const visibleTraceEventsComplete = visibleEventStyles.every(eventType => {
1057
+ return Helpers.Trace.VISIBLE_TRACE_EVENT_TYPES.has(eventType as Types.Events.Name);
1058
+ });
1059
+
1060
+ const eventStylesMapKeys = Object.keys(eventStylesMap) as Types.Events.Name[];
1061
+ const eventStylesComplete = Array.from(Helpers.Trace.VISIBLE_TRACE_EVENT_TYPES).every(eventType => {
1062
+ return eventStylesMapKeys.includes(eventType);
1063
+ });
1064
+
1065
+ if (!visibleTraceEventsComplete || !eventStylesComplete) {
1066
+ throw new Error('eventStylesMap and VISIBLE_TRACE_EVENT_TYPES are out of sync!');
1067
+ }
1068
+ return eventStylesMap;
1069
+ }
1070
+
1071
+ export function setEventStylesMap(eventStyles: EventStylesMap): void {
1072
+ eventStylesMap = eventStyles;
1073
+ }
1074
+
1075
+ export function setCategories(cats: CategoryPalette): void {
1076
+ categoryStyles = cats;
1077
+ }
1078
+
1079
+ export function visibleTypes(): string[] {
1080
+ const eventStyles = maybeInitSylesMap();
1081
+ const result = [];
1082
+ for (const name in eventStyles) {
1083
+ // Typescript cannot infer that `name` is a key of eventStyles
1084
+ const nameAsKey = name as keyof typeof eventStyles;
1085
+ if (!eventStyles[nameAsKey]?.hidden) {
1086
+ result.push(name);
1087
+ }
1088
+ }
1089
+ return result;
1090
+ }
1091
+
1092
+ export function getTimelineMainEventCategories(): EventCategory[] {
1093
+ if (mainEventCategories) {
1094
+ return mainEventCategories;
1095
+ }
1096
+ mainEventCategories = [
1097
+ EventCategory.IDLE,
1098
+ EventCategory.LOADING,
1099
+ EventCategory.PAINTING,
1100
+ EventCategory.RENDERING,
1101
+ EventCategory.SCRIPTING,
1102
+ EventCategory.OTHER,
1103
+ ];
1104
+ return mainEventCategories;
1105
+ }
1106
+
1107
+ export function setTimelineMainEventCategories(categories: EventCategory[]): void {
1108
+ mainEventCategories = categories;
1109
+ }
1110
+
1111
+ export function markerDetailsForEvent(event: Types.Events.Event): {
1112
+ color: string,
1113
+ title: string,
1114
+ } {
1115
+ let title = '';
1116
+ let color = 'var(--color-text-primary)';
1117
+ if (Types.Events.isFirstContentfulPaint(event)) {
1118
+ color = 'var(--sys-color-green-bright)';
1119
+ title = Handlers.ModelHandlers.PageLoadMetrics.MetricName.FCP;
1120
+ }
1121
+ if (Types.Events.isLargestContentfulPaintCandidate(event)) {
1122
+ color = 'var(--sys-color-green)';
1123
+ title = Handlers.ModelHandlers.PageLoadMetrics.MetricName.LCP;
1124
+ }
1125
+ if (Types.Events.isNavigationStart(event)) {
1126
+ color = 'var(--color-text-primary)';
1127
+ title = Handlers.ModelHandlers.PageLoadMetrics.MetricName.NAV;
1128
+ }
1129
+ if (Types.Events.isMarkDOMContent(event)) {
1130
+ color = 'var(--color-text-disabled)';
1131
+ title = Handlers.ModelHandlers.PageLoadMetrics.MetricName.DCL;
1132
+ }
1133
+ if (Types.Events.isMarkLoad(event)) {
1134
+ color = 'var(--color-text-disabled)';
1135
+ title = Handlers.ModelHandlers.PageLoadMetrics.MetricName.L;
1136
+ }
1137
+ return {color, title};
1138
+ }