@paulirish/trace_engine 0.0.66 → 0.0.67-beta.1

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 (788) hide show
  1. package/README.md +62 -22
  2. package/analyze-trace.mjs +6 -144
  3. package/core/common/Base64.d.ts +12 -0
  4. package/core/common/CharacterIdMap.d.ts +5 -0
  5. package/core/common/Color.d.ts +357 -0
  6. package/core/common/ColorConverter.d.ts +26 -0
  7. package/core/common/ColorUtils.d.ts +45 -0
  8. package/core/common/Console.d.ts +54 -0
  9. package/core/common/Debouncer.d.ts +8 -0
  10. package/core/common/EventTarget.d.ts +22 -0
  11. package/core/common/Gzip.d.ts +23 -0
  12. package/core/common/JavaScriptMetaData.d.ts +20 -0
  13. package/core/common/Lazy.d.ts +4 -0
  14. package/core/common/MapWithDefault.d.ts +9 -0
  15. package/core/common/Mutex.d.ts +13 -0
  16. package/core/common/Object.d.ts +20 -0
  17. package/core/common/ParsedURL.d.ts +87 -0
  18. package/core/common/Progress.d.ts +47 -0
  19. package/core/common/ResolverBase.d.ts +29 -0
  20. package/core/common/ResourceType.d.ts +52 -0
  21. package/core/common/ReturnToPanel.d.ts +10 -0
  22. package/core/common/Revealer.d.ts +66 -0
  23. package/core/common/Runnable.d.ts +14 -0
  24. package/core/common/SegmentedRange.d.ts +14 -0
  25. package/core/common/SettingRegistration.d.ts +136 -0
  26. package/core/common/Settings.d.ts +226 -0
  27. package/core/common/SimpleHistoryManager.d.ts +20 -0
  28. package/core/common/Srcset.d.ts +16 -0
  29. package/core/common/StringOutputStream.d.ts +10 -0
  30. package/core/common/TextDictionary.d.ts +11 -0
  31. package/core/common/Throttler.d.ts +12 -0
  32. package/core/common/Trie.d.ts +24 -0
  33. package/core/common/VersionController.d.ts +85 -0
  34. package/core/common/common.d.ts +33 -1
  35. package/core/host/AidaClient.d.ts +73 -0
  36. package/core/host/AidaClientTypes.d.ts +355 -0
  37. package/core/host/AidaGcaTranslation.d.ts +10 -0
  38. package/core/host/DispatchHttpRequestClient.d.ts +14 -0
  39. package/core/host/GcaClient.d.ts +14 -0
  40. package/core/host/GcaTypes.d.ts +411 -0
  41. package/core/host/GdpClient.d.ts +84 -0
  42. package/core/host/InspectorFrontendHost.d.ts +29 -0
  43. package/core/host/InspectorFrontendHostAPI.d.ts +425 -0
  44. package/core/host/InspectorFrontendHostStub.d.ts +151 -0
  45. package/core/host/Platform.d.ts +11 -0
  46. package/core/host/ResourceLoader.d.ts +15 -0
  47. package/core/host/UserMetrics.d.ts +116 -0
  48. package/core/host/UserMetricsEnums.d.ts +883 -0
  49. package/core/host/host.d.ts +13 -1
  50. package/core/i18n/ByteUtilities.d.ts +11 -0
  51. package/core/i18n/DevToolsLocale.d.ts +41 -0
  52. package/core/i18n/NumberFormatter.d.ts +11 -0
  53. package/core/i18n/i18n.d.ts +10 -0
  54. package/core/i18n/i18nImpl.d.ts +64 -0
  55. package/core/i18n/i18nTypes.d.ts +5 -0
  56. package/core/i18n/locales.d.ts +15 -0
  57. package/core/i18n/time-utilities.d.ts +16 -0
  58. package/core/platform/StringUtilities.d.ts +0 -21
  59. package/core/protocol_client/CDPConnection.d.ts +77 -0
  60. package/core/protocol_client/ConnectionTransport.d.ts +9 -0
  61. package/core/protocol_client/DevToolsCDPConnection.d.ts +16 -0
  62. package/core/protocol_client/InspectorBackend.d.ts +223 -0
  63. package/core/protocol_client/protocol_client.d.ts +5 -0
  64. package/core/root/DevToolsContext.d.ts +34 -0
  65. package/core/root/ExperimentNames.d.ts +8 -0
  66. package/core/root/Runtime.d.ts +351 -0
  67. package/core/root/root.d.ts +4 -1
  68. package/core/sdk/AccessibilityModel.d.ts +76 -0
  69. package/core/sdk/AnimationModel.d.ts +161 -0
  70. package/core/sdk/AutofillModel.d.ts +23 -0
  71. package/core/sdk/CPUProfilerModel.d.ts +46 -0
  72. package/core/sdk/CPUThrottlingManager.d.ts +47 -0
  73. package/core/sdk/CSSContainerQuery.d.ts +42 -0
  74. package/core/sdk/CSSFontFace.d.ts +10 -0
  75. package/core/sdk/CSSLayer.d.ts +9 -0
  76. package/core/sdk/CSSLocation.d.ts +14 -0
  77. package/core/sdk/CSSMatchedStyles.d.ts +138 -0
  78. package/core/sdk/CSSMedia.d.ts +36 -0
  79. package/core/sdk/CSSMetadata.d.ts +87 -0
  80. package/core/sdk/CSSModel.d.ts +180 -0
  81. package/core/sdk/CSSNavigation.d.ts +10 -0
  82. package/core/sdk/CSSProperty.d.ts +53 -0
  83. package/core/sdk/CSSPropertyParser.d.ts +131 -0
  84. package/core/sdk/CSSPropertyParserMatchers.d.ts +442 -0
  85. package/core/sdk/CSSQuery.d.ts +22 -0
  86. package/core/sdk/CSSRule.d.ts +132 -0
  87. package/core/sdk/CSSScope.d.ts +9 -0
  88. package/core/sdk/CSSStartingStyle.d.ts +9 -0
  89. package/core/sdk/CSSStyleDeclaration.d.ts +38 -0
  90. package/core/sdk/CSSStyleSheetHeader.d.ts +53 -0
  91. package/core/sdk/CSSSupports.d.ts +10 -0
  92. package/core/sdk/CategorizedBreakpoint.d.ts +42 -0
  93. package/core/sdk/ChildTargetManager.d.ts +40 -0
  94. package/core/sdk/CompilerSourceMappingContentProvider.d.ts +12 -0
  95. package/core/sdk/Connections.d.ts +36 -0
  96. package/core/sdk/ConsoleModel.d.ts +127 -0
  97. package/core/sdk/ConsoleModelTypes.d.ts +6 -0
  98. package/core/sdk/Cookie.d.ts +68 -0
  99. package/core/sdk/CookieModel.d.ts +31 -0
  100. package/core/sdk/CookieParser.d.ts +14 -0
  101. package/core/sdk/CrashReportContextModel.d.ts +8 -0
  102. package/core/sdk/DOMDebuggerModel.d.ts +127 -0
  103. package/core/sdk/DOMModel.d.ts +436 -0
  104. package/core/sdk/DOMStorageModel.d.ts +79 -0
  105. package/core/sdk/DebuggerModel.d.ts +272 -0
  106. package/core/sdk/EmulationModel.d.ts +95 -0
  107. package/core/sdk/EnhancedTracesParser.d.ts +105 -0
  108. package/core/sdk/EventBreakpointsModel.d.ts +66 -0
  109. package/core/sdk/FrameAssociated.d.ts +6 -0
  110. package/core/sdk/FrameManager.d.ts +68 -0
  111. package/core/sdk/HeapProfilerModel.d.ts +75 -0
  112. package/core/sdk/HttpReasonPhraseStrings.d.ts +5 -0
  113. package/core/sdk/IOModel.d.ts +10 -0
  114. package/core/sdk/IsolateManager.d.ts +53 -0
  115. package/core/sdk/IssuesModel.d.ts +28 -0
  116. package/core/sdk/LayerTreeBase.d.ts +70 -0
  117. package/core/sdk/LogModel.d.ts +20 -0
  118. package/core/sdk/NetworkManager.d.ts +418 -0
  119. package/core/sdk/NetworkRequest.d.ts +469 -0
  120. package/core/sdk/NetworkRequestAccess.d.ts +91 -0
  121. package/core/sdk/OverlayColorGenerator.d.ts +14 -0
  122. package/core/sdk/OverlayModel.d.ts +186 -0
  123. package/core/sdk/OverlayPersistentHighlighter.d.ts +116 -0
  124. package/core/sdk/PageFunctions.d.ts +22 -0
  125. package/core/sdk/PageLoad.d.ts +14 -0
  126. package/core/sdk/PageResourceLoader.d.ts +111 -0
  127. package/core/sdk/PaintProfiler.d.ts +43 -0
  128. package/core/sdk/PerformanceMetricsModel.d.ts +12 -0
  129. package/core/sdk/PreloadingModel.d.ts +146 -0
  130. package/core/sdk/RehydratingConnection.d.ts +73 -0
  131. package/core/sdk/RehydratingObject.d.ts +59 -0
  132. package/core/sdk/RemoteObject.d.ts +210 -0
  133. package/core/sdk/Resource.d.ts +36 -0
  134. package/core/sdk/ResourceTreeModel.d.ts +278 -0
  135. package/core/sdk/RuntimeModel.d.ts +163 -0
  136. package/core/sdk/SDKModel.d.ts +30 -0
  137. package/core/sdk/SDKSettings.d.ts +53 -0
  138. package/core/sdk/ScopeTreeCache.d.ts +21 -0
  139. package/core/sdk/ScreenCaptureModel.d.ts +69 -0
  140. package/core/sdk/Script.d.ts +134 -0
  141. package/core/sdk/SecurityOrigin.d.ts +108 -0
  142. package/core/sdk/SecurityOriginManager.d.ts +23 -0
  143. package/core/sdk/ServerSentEvents.d.ts +18 -0
  144. package/core/sdk/ServerSentEventsProtocol.d.ts +18 -0
  145. package/core/sdk/ServerTiming.d.ts +24 -0
  146. package/core/sdk/ServiceWorkerCacheModel.d.ts +71 -0
  147. package/core/sdk/ServiceWorkerManager.d.ts +125 -0
  148. package/core/sdk/SourceMap.d.ts +197 -0
  149. package/core/sdk/SourceMapCache.d.ts +12 -0
  150. package/core/sdk/SourceMapFunctionRanges.d.ts +26 -0
  151. package/core/sdk/SourceMapManager.d.ts +46 -0
  152. package/core/sdk/SourceMapRangeMappings.d.ts +15 -0
  153. package/core/sdk/SourceMapScopeChainEntry.d.ts +23 -0
  154. package/core/sdk/SourceMapScopesInfo.d.ts +109 -0
  155. package/core/sdk/StorageBucketsModel.d.ts +48 -0
  156. package/core/sdk/StorageKeyManager.d.ts +38 -0
  157. package/core/sdk/Target.d.ts +79 -0
  158. package/core/sdk/TargetManager.d.ts +92 -0
  159. package/core/sdk/TraceObject.d.ts +43 -0
  160. package/core/sdk/WebAuthnModel.d.ts +29 -0
  161. package/core/sdk/sdk.d.ts +97 -1
  162. package/core/text_utils/CodeMirrorUtils.d.ts +3 -0
  163. package/core/text_utils/ContentData.d.ts +94 -0
  164. package/core/text_utils/ContentProvider.d.ts +42 -0
  165. package/core/text_utils/StaticContentProvider.d.ts +13 -0
  166. package/core/text_utils/StreamingContentData.d.ts +49 -0
  167. package/core/text_utils/Text.d.ts +19 -0
  168. package/core/text_utils/TextCursor.d.ts +9 -0
  169. package/core/text_utils/TextRange.d.ts +81 -0
  170. package/core/text_utils/TextUtils.d.ts +97 -0
  171. package/core/text_utils/WasmDisassembly.d.ts +29 -0
  172. package/core/text_utils/text_utils.d.ts +11 -0
  173. package/entrypoints/formatter_actions/formatter_actions.d.ts +48 -0
  174. package/generated/InspectorBackendCommands.d.ts +14 -0
  175. package/generated/SupportedCSSProperties.d.ts +18 -0
  176. package/generated/protocol-mapping.d.ts +5930 -0
  177. package/generated/protocol-proxy-api.d.ts +5396 -0
  178. package/generated/protocol.d.ts +26 -72
  179. package/index.d.ts +2 -0
  180. package/index.js +6 -0
  181. package/locales/af.json +171 -174
  182. package/locales/am.json +351 -354
  183. package/locales/ar.json +352 -355
  184. package/locales/as.json +350 -353
  185. package/locales/az.json +341 -344
  186. package/locales/be.json +351 -354
  187. package/locales/bg.json +351 -354
  188. package/locales/bn.json +351 -354
  189. package/locales/bs.json +253 -256
  190. package/locales/ca.json +283 -286
  191. package/locales/cs.json +336 -339
  192. package/locales/cy.json +144 -147
  193. package/locales/da.json +232 -235
  194. package/locales/de.json +251 -254
  195. package/locales/el.json +336 -339
  196. package/locales/en-GB.json +132 -135
  197. package/locales/en-US.json +294 -297
  198. package/locales/es-419.json +282 -285
  199. package/locales/es.json +282 -285
  200. package/locales/et.json +236 -239
  201. package/locales/eu.json +131 -134
  202. package/locales/fa.json +351 -354
  203. package/locales/fi.json +283 -286
  204. package/locales/fil.json +128 -131
  205. package/locales/fr-CA.json +310 -313
  206. package/locales/fr.json +309 -312
  207. package/locales/gl.json +264 -267
  208. package/locales/gu.json +352 -355
  209. package/locales/he.json +352 -355
  210. package/locales/hi.json +336 -339
  211. package/locales/hr.json +257 -260
  212. package/locales/hu.json +342 -345
  213. package/locales/hy.json +351 -354
  214. package/locales/id.json +128 -131
  215. package/locales/is.json +304 -307
  216. package/locales/it.json +221 -224
  217. package/locales/ja.json +351 -354
  218. package/locales/ka.json +352 -355
  219. package/locales/kk.json +352 -355
  220. package/locales/km.json +351 -354
  221. package/locales/kn.json +352 -355
  222. package/locales/ko.json +351 -354
  223. package/locales/ky.json +350 -353
  224. package/locales/lo.json +352 -355
  225. package/locales/lt.json +323 -326
  226. package/locales/lv.json +317 -320
  227. package/locales/mk.json +352 -355
  228. package/locales/ml.json +351 -354
  229. package/locales/mn.json +351 -354
  230. package/locales/mr.json +351 -354
  231. package/locales/ms.json +128 -131
  232. package/locales/my.json +350 -353
  233. package/locales/ne.json +336 -339
  234. package/locales/nl.json +183 -186
  235. package/locales/no.json +238 -241
  236. package/locales/or.json +351 -354
  237. package/locales/pa.json +351 -354
  238. package/locales/pl.json +307 -310
  239. package/locales/pt-PT.json +273 -276
  240. package/locales/pt.json +270 -273
  241. package/locales/ro.json +309 -312
  242. package/locales/ru.json +351 -354
  243. package/locales/si.json +352 -355
  244. package/locales/sk.json +333 -336
  245. package/locales/sl.json +273 -276
  246. package/locales/sq.json +316 -319
  247. package/locales/sr-Latn.json +256 -259
  248. package/locales/sr.json +352 -355
  249. package/locales/sv.json +296 -299
  250. package/locales/sw.json +128 -131
  251. package/locales/ta.json +352 -355
  252. package/locales/te.json +350 -353
  253. package/locales/th.json +352 -355
  254. package/locales/tr.json +327 -330
  255. package/locales/uk.json +351 -354
  256. package/locales/ur.json +352 -355
  257. package/locales/uz.json +232 -235
  258. package/locales/vi.json +352 -355
  259. package/locales/zh-HK.json +352 -355
  260. package/locales/zh-TW.json +351 -354
  261. package/locales/zh.json +351 -354
  262. package/locales/zu.json +127 -130
  263. package/models/crux-manager/CrUXManager.d.ts +107 -0
  264. package/models/crux-manager/crux-manager.d.ts +1 -0
  265. package/models/emulation/DeviceModeModel.d.ts +156 -0
  266. package/models/emulation/EmulatedDevices.d.ts +148 -0
  267. package/models/emulation/emulation.d.ts +3 -0
  268. package/models/formatter/FormatterWorkerPool.d.ts +58 -0
  269. package/models/formatter/ScriptFormatter.d.ts +11 -0
  270. package/models/formatter/formatter.d.ts +3 -0
  271. package/models/trace/ModelImpl.d.ts +1 -1
  272. package/models/trace/extras/extras.d.ts +2 -7
  273. package/models/trace/handlers/ScriptsHandler.d.ts +2 -2
  274. package/models/trace/insights/CLSCulprits.d.ts +14 -14
  275. package/models/trace/insights/Cache.d.ts +8 -8
  276. package/models/trace/insights/CharacterSet.d.ts +10 -10
  277. package/models/trace/insights/Common.d.ts +4 -4
  278. package/models/trace/insights/DOMSize.d.ts +15 -15
  279. package/models/trace/insights/DocumentLatency.d.ts +13 -13
  280. package/models/trace/insights/DuplicatedJavaScript.d.ts +7 -7
  281. package/models/trace/insights/FontDisplay.d.ts +7 -7
  282. package/models/trace/insights/ForcedReflow.d.ts +9 -9
  283. package/models/trace/insights/INPBreakdown.d.ts +10 -10
  284. package/models/trace/insights/ImageDelivery.d.ts +12 -13
  285. package/models/trace/insights/LCPBreakdown.d.ts +13 -13
  286. package/models/trace/insights/LCPDiscovery.d.ts +12 -12
  287. package/models/trace/insights/LegacyJavaScript.d.ts +7 -7
  288. package/models/trace/insights/ModernHTTP.d.ts +7 -7
  289. package/models/trace/insights/NetworkDependencyTree.d.ts +21 -104
  290. package/models/trace/insights/RenderBlocking.d.ts +7 -7
  291. package/models/trace/insights/SlowCSSSelector.d.ts +12 -12
  292. package/models/trace/insights/ThirdParties.d.ts +8 -8
  293. package/models/trace/insights/Viewport.d.ts +5 -5
  294. package/models/trace/insights/types.d.ts +1 -1
  295. package/models/trace/lantern/core/NetworkAnalyzer.d.ts +0 -1
  296. package/models/trace/lantern/graph/BaseNode.d.ts +2 -2
  297. package/models/trace/lantern/graph/CPUNode.d.ts +2 -4
  298. package/models/trace/lantern/simulation/TCPConnection.d.ts +4 -4
  299. package/models/trace/lantern/types/Lantern.d.ts +19 -27
  300. package/models/trace/trace.js +544 -16
  301. package/models/trace/types/Configuration.d.ts +1 -1
  302. package/models/trace/types/Extensions.d.ts +1 -1
  303. package/models/trace/types/File.d.ts +5 -5
  304. package/models/trace/types/TraceEvents.d.ts +24 -24
  305. package/package.json +37 -8
  306. package/third_party/codemirror.next/codemirror.next.d.ts +9196 -0
  307. package/third_party/i18n/i18n-impl.d.ts +25 -0
  308. package/third_party/i18n/i18n.d.ts +3 -0
  309. package/third_party/i18n/localized-string-set.d.ts +49 -0
  310. package/third_party/intl-messageformat/intl-messageformat.d.ts +1 -0
  311. package/third_party/source-map-scopes-codec/package/src/builder/builder.d.ts +67 -0
  312. package/third_party/source-map-scopes-codec/package/src/builder/safe_builder.d.ts +38 -0
  313. package/third_party/source-map-scopes-codec/package/src/codec.d.ts +48 -0
  314. package/third_party/source-map-scopes-codec/package/src/decode/decode.d.ts +31 -0
  315. package/third_party/source-map-scopes-codec/package/src/encode/encode.d.ts +8 -0
  316. package/third_party/source-map-scopes-codec/package/src/encode/encoder.d.ts +6 -0
  317. package/third_party/source-map-scopes-codec/package/src/mod.d.ts +5 -0
  318. package/third_party/source-map-scopes-codec/package/src/scopes.d.ts +168 -0
  319. package/third_party/source-map-scopes-codec/package/src/util.d.ts +5 -0
  320. package/third_party/source-map-scopes-codec/package/src/vlq.d.ts +14 -0
  321. package/third_party/source-map-scopes-codec/source-map-scopes-codec.d.ts +1 -0
  322. package/third_party/third-party-web/lib/nostats-subset.d.ts +2 -0
  323. package/third_party/third-party-web/package/lib/index.d.ts +34 -0
  324. package/third_party/third-party-web/package/lib/subsets/nostats.d.ts +1 -0
  325. package/third_party/third-party-web/third-party-web.d.ts +2 -1
  326. package/.tmp/tsbuildinfo/analyze-inspector-issues.d.mts +0 -13
  327. package/.tmp/tsbuildinfo/analyze-inspector-issues.d.mts.map +0 -1
  328. package/.tmp/tsbuildinfo/analyze-trace.d.mts +0 -17
  329. package/.tmp/tsbuildinfo/analyze-trace.d.mts.map +0 -1
  330. package/.tmp/tsbuildinfo/models/trace/extras/polyfills.d.ts +0 -4
  331. package/.tmp/tsbuildinfo/models/trace/extras/polyfills.d.ts.map +0 -1
  332. package/.tmp/tsbuildinfo/test/test-trace-engine.d.mts +0 -2
  333. package/.tmp/tsbuildinfo/test/test-trace-engine.d.mts.map +0 -1
  334. package/.tmp/tsbuildinfo/third_party/third-party-web/third-party-web.d.ts +0 -3
  335. package/.tmp/tsbuildinfo/third_party/third-party-web/third-party-web.d.ts.map +0 -1
  336. package/.tmp/tsbuildinfo/tsconfig.tsbuildinfo +0 -1
  337. package/analyze-inspector-issues.mjs +0 -60
  338. package/core/common/common.js +0 -1
  339. package/core/host/host.js +0 -1
  340. package/core/platform/ArrayUtilities.js +0 -224
  341. package/core/platform/ArrayUtilities.js.map +0 -1
  342. package/core/platform/Brand.js +0 -5
  343. package/core/platform/Brand.js.map +0 -1
  344. package/core/platform/Constructor.js +0 -5
  345. package/core/platform/Constructor.js.map +0 -1
  346. package/core/platform/DateUtilities.js +0 -14
  347. package/core/platform/DateUtilities.js.map +0 -1
  348. package/core/platform/DevToolsPath.js +0 -28
  349. package/core/platform/DevToolsPath.js.map +0 -1
  350. package/core/platform/HostRuntime.js +0 -31
  351. package/core/platform/HostRuntime.js.map +0 -1
  352. package/core/platform/KeyboardUtilities.js +0 -34
  353. package/core/platform/KeyboardUtilities.js.map +0 -1
  354. package/core/platform/MapUtilities.js +0 -80
  355. package/core/platform/MapUtilities.js.map +0 -1
  356. package/core/platform/MimeType.js +0 -157
  357. package/core/platform/MimeType.js.map +0 -1
  358. package/core/platform/NumberUtilities.js +0 -73
  359. package/core/platform/NumberUtilities.js.map +0 -1
  360. package/core/platform/Size.js +0 -36
  361. package/core/platform/Size.js.map +0 -1
  362. package/core/platform/StringUtilities.js +0 -731
  363. package/core/platform/StringUtilities.js.map +0 -1
  364. package/core/platform/Timing.js +0 -10
  365. package/core/platform/Timing.js.map +0 -1
  366. package/core/platform/TypedArrayUtilities.js +0 -158
  367. package/core/platform/TypedArrayUtilities.js.map +0 -1
  368. package/core/platform/TypescriptUtilities.js +0 -17
  369. package/core/platform/TypescriptUtilities.js.map +0 -1
  370. package/core/platform/UIString.js +0 -5
  371. package/core/platform/UIString.js.map +0 -1
  372. package/core/platform/UserVisibleError.js +0 -23
  373. package/core/platform/UserVisibleError.js.map +0 -1
  374. package/core/platform/api/HostRuntime.js +0 -5
  375. package/core/platform/api/HostRuntime.js.map +0 -1
  376. package/core/platform/api/api-tsconfig.json +0 -58
  377. package/core/platform/api/api-tsconfig.ref.json +0 -26
  378. package/core/platform/api/api.js +0 -6
  379. package/core/platform/api/api.js.map +0 -1
  380. package/core/platform/browser/HostRuntime.js +0 -165
  381. package/core/platform/browser/HostRuntime.js.map +0 -1
  382. package/core/platform/browser/browser-tsconfig.json +0 -59
  383. package/core/platform/browser/browser-tsconfig.ref.json +0 -27
  384. package/core/platform/browser/browser.js +0 -6
  385. package/core/platform/browser/browser.js.map +0 -1
  386. package/core/platform/browser/bundle-tsconfig.json +0 -59
  387. package/core/platform/browser/bundle-tsconfig.ref.json +0 -27
  388. package/core/platform/bundle-tsconfig.json +0 -59
  389. package/core/platform/bundle-tsconfig.ref.json +0 -27
  390. package/core/platform/foundation_unittests-tsconfig.json +0 -73
  391. package/core/platform/foundation_unittests-tsconfig.ref.json +0 -40
  392. package/core/platform/foundation_unittests_node_typecheck-tsconfig.json +0 -70
  393. package/core/platform/node/HostRuntime.js +0 -127
  394. package/core/platform/node/HostRuntime.js.map +0 -1
  395. package/core/platform/node/bundle-tsconfig.json +0 -59
  396. package/core/platform/node/bundle-tsconfig.ref.json +0 -27
  397. package/core/platform/node/node-tsconfig.json +0 -59
  398. package/core/platform/node/node-tsconfig.ref.json +0 -27
  399. package/core/platform/node/node.js +0 -6
  400. package/core/platform/node/node.js.map +0 -1
  401. package/core/platform/platform-tsconfig.json +0 -81
  402. package/core/platform/platform-tsconfig.ref.json +0 -49
  403. package/core/platform/platform.js +0 -28
  404. package/core/platform/platform.js.map +0 -1
  405. package/core/platform/platform_node_typecheck-tsconfig.json +0 -78
  406. package/core/platform/platform_node_typecheck.stamp +0 -0
  407. package/core/root/root.js +0 -1
  408. package/core/sdk/sdk.js +0 -1
  409. package/generated/protocol.js +0 -3304
  410. package/locales/en-XL.json +0 -1058
  411. package/models/cpu_profile/CPUProfileDataModel.js +0 -517
  412. package/models/cpu_profile/CPUProfileDataModel.js.map +0 -1
  413. package/models/cpu_profile/ProfileTreeModel.js +0 -90
  414. package/models/cpu_profile/ProfileTreeModel.js.map +0 -1
  415. package/models/cpu_profile/bundle-tsconfig.json +0 -59
  416. package/models/cpu_profile/bundle-tsconfig.ref.json +0 -27
  417. package/models/cpu_profile/cpu_profile-tsconfig.json +0 -63
  418. package/models/cpu_profile/cpu_profile-tsconfig.ref.json +0 -31
  419. package/models/cpu_profile/cpu_profile.js +0 -7
  420. package/models/cpu_profile/cpu_profile.js.map +0 -1
  421. package/models/cpu_profile/cpu_profile_node_typecheck-tsconfig.json +0 -60
  422. package/models/cpu_profile/cpu_profile_node_typecheck.stamp +0 -0
  423. package/models/cpu_profile/foundation_unittests-tsconfig.json +0 -63
  424. package/models/cpu_profile/foundation_unittests-tsconfig.ref.json +0 -30
  425. package/models/cpu_profile/foundation_unittests_node_typecheck-tsconfig.json +0 -60
  426. package/models/issues_manager/CheckFormsIssuesTrigger.d.ts +0 -1
  427. package/models/issues_manager/CheckFormsIssuesTrigger.js +0 -1
  428. package/models/issues_manager/ContrastCheckTrigger.d.ts +0 -1
  429. package/models/issues_manager/ContrastCheckTrigger.js +0 -1
  430. package/models/issues_manager/DeprecationIssue.d.ts +0 -1
  431. package/models/issues_manager/DeprecationIssue.js +0 -1
  432. package/models/issues_manager/IssueResolver.d.ts +0 -1
  433. package/models/issues_manager/IssueResolver.js +0 -1
  434. package/models/issues_manager/RelatedIssue.d.ts +0 -1
  435. package/models/issues_manager/RelatedIssue.js +0 -1
  436. package/models/issues_manager/SourceFrameIssuesManager.d.ts +0 -1
  437. package/models/issues_manager/SourceFrameIssuesManager.js +0 -1
  438. package/models/trace/EntityMapper.js +0 -133
  439. package/models/trace/EntityMapper.js.map +0 -1
  440. package/models/trace/EventsSerializer.js +0 -90
  441. package/models/trace/EventsSerializer.js.map +0 -1
  442. package/models/trace/LanternComputationData.js +0 -374
  443. package/models/trace/LanternComputationData.js.map +0 -1
  444. package/models/trace/LegacyTracingModel.d.ts +0 -1
  445. package/models/trace/LegacyTracingModel.js +0 -1
  446. package/models/trace/ModelImpl.js +0 -181
  447. package/models/trace/ModelImpl.js.map +0 -1
  448. package/models/trace/Name.js +0 -115
  449. package/models/trace/Name.js.map +0 -1
  450. package/models/trace/Processor.js +0 -618
  451. package/models/trace/Processor.js.map +0 -1
  452. package/models/trace/Styles.js +0 -836
  453. package/models/trace/Styles.js.map +0 -1
  454. package/models/trace/TracingManager.d.ts +0 -1
  455. package/models/trace/TracingManager.js +0 -1
  456. package/models/trace/bundle-tsconfig.json +0 -77
  457. package/models/trace/bundle-tsconfig.ref.json +0 -45
  458. package/models/trace/extras/FilmStrip.js +0 -45
  459. package/models/trace/extras/FilmStrip.js.map +0 -1
  460. package/models/trace/extras/Initiators.js +0 -47
  461. package/models/trace/extras/Initiators.js.map +0 -1
  462. package/models/trace/extras/MainThreadActivity.js +0 -77
  463. package/models/trace/extras/MainThreadActivity.js.map +0 -1
  464. package/models/trace/extras/ScriptDuplication.js +0 -163
  465. package/models/trace/extras/ScriptDuplication.js.map +0 -1
  466. package/models/trace/extras/StackTraceForEvent.js +0 -192
  467. package/models/trace/extras/StackTraceForEvent.js.map +0 -1
  468. package/models/trace/extras/ThirdParties.js +0 -119
  469. package/models/trace/extras/ThirdParties.js.map +0 -1
  470. package/models/trace/extras/TraceFilter.js +0 -51
  471. package/models/trace/extras/TraceFilter.js.map +0 -1
  472. package/models/trace/extras/TraceTree.js +0 -621
  473. package/models/trace/extras/TraceTree.js.map +0 -1
  474. package/models/trace/extras/bundle-tsconfig.json +0 -59
  475. package/models/trace/extras/bundle-tsconfig.ref.json +0 -27
  476. package/models/trace/extras/extras-tsconfig.json +0 -81
  477. package/models/trace/extras/extras-tsconfig.ref.json +0 -49
  478. package/models/trace/extras/extras.js +0 -13
  479. package/models/trace/extras/extras.js.map +0 -1
  480. package/models/trace/extras/extras_node_typecheck-tsconfig.json +0 -78
  481. package/models/trace/extras/extras_node_typecheck.stamp +0 -0
  482. package/models/trace/extras/foundation_unittests-tsconfig.json +0 -91
  483. package/models/trace/extras/foundation_unittests-tsconfig.ref.json +0 -58
  484. package/models/trace/extras/foundation_unittests_node_typecheck-tsconfig.json +0 -88
  485. package/models/trace/foundation_unittests-tsconfig.json +0 -70
  486. package/models/trace/foundation_unittests-tsconfig.ref.json +0 -37
  487. package/models/trace/foundation_unittests_node_typecheck-tsconfig.json +0 -67
  488. package/models/trace/handlers/AnimationFramesHandler.js +0 -110
  489. package/models/trace/handlers/AnimationFramesHandler.js.map +0 -1
  490. package/models/trace/handlers/AnimationHandler.js +0 -27
  491. package/models/trace/handlers/AnimationHandler.js.map +0 -1
  492. package/models/trace/handlers/AsyncJSCallsHandler.js +0 -188
  493. package/models/trace/handlers/AsyncJSCallsHandler.js.map +0 -1
  494. package/models/trace/handlers/DOMStatsHandler.js +0 -22
  495. package/models/trace/handlers/DOMStatsHandler.js.map +0 -1
  496. package/models/trace/handlers/ExtensionTraceDataHandler.js +0 -264
  497. package/models/trace/handlers/ExtensionTraceDataHandler.js.map +0 -1
  498. package/models/trace/handlers/FlowsHandler.js +0 -149
  499. package/models/trace/handlers/FlowsHandler.js.map +0 -1
  500. package/models/trace/handlers/FramesHandler.js +0 -491
  501. package/models/trace/handlers/FramesHandler.js.map +0 -1
  502. package/models/trace/handlers/GPUHandler.js +0 -36
  503. package/models/trace/handlers/GPUHandler.js.map +0 -1
  504. package/models/trace/handlers/ImagePaintingHandler.js +0 -148
  505. package/models/trace/handlers/ImagePaintingHandler.js.map +0 -1
  506. package/models/trace/handlers/InitiatorsHandler.js +0 -181
  507. package/models/trace/handlers/InitiatorsHandler.js.map +0 -1
  508. package/models/trace/handlers/InvalidationsHandler.js +0 -127
  509. package/models/trace/handlers/InvalidationsHandler.js.map +0 -1
  510. package/models/trace/handlers/LargestImagePaintHandler.js +0 -86
  511. package/models/trace/handlers/LargestImagePaintHandler.js.map +0 -1
  512. package/models/trace/handlers/LargestTextPaintHandler.js +0 -28
  513. package/models/trace/handlers/LargestTextPaintHandler.js.map +0 -1
  514. package/models/trace/handlers/LayerTreeHandler.js +0 -104
  515. package/models/trace/handlers/LayerTreeHandler.js.map +0 -1
  516. package/models/trace/handlers/LayoutShiftsHandler.js +0 -457
  517. package/models/trace/handlers/LayoutShiftsHandler.js.map +0 -1
  518. package/models/trace/handlers/MemoryHandler.js +0 -22
  519. package/models/trace/handlers/MemoryHandler.js.map +0 -1
  520. package/models/trace/handlers/MetaHandler.js +0 -442
  521. package/models/trace/handlers/MetaHandler.js.map +0 -1
  522. package/models/trace/handlers/ModelHandlers.js +0 -33
  523. package/models/trace/handlers/ModelHandlers.js.map +0 -1
  524. package/models/trace/handlers/NetworkRequestsHandler.js +0 -578
  525. package/models/trace/handlers/NetworkRequestsHandler.js.map +0 -1
  526. package/models/trace/handlers/PageFramesHandler.js +0 -43
  527. package/models/trace/handlers/PageFramesHandler.js.map +0 -1
  528. package/models/trace/handlers/PageLoadMetricsHandler.js +0 -462
  529. package/models/trace/handlers/PageLoadMetricsHandler.js.map +0 -1
  530. package/models/trace/handlers/RendererHandler.js +0 -346
  531. package/models/trace/handlers/RendererHandler.js.map +0 -1
  532. package/models/trace/handlers/SamplesHandler.js +0 -261
  533. package/models/trace/handlers/SamplesHandler.js.map +0 -1
  534. package/models/trace/handlers/ScreenshotsHandler.js +0 -56
  535. package/models/trace/handlers/ScreenshotsHandler.js.map +0 -1
  536. package/models/trace/handlers/ScriptsHandler.js +0 -286
  537. package/models/trace/handlers/ScriptsHandler.js.map +0 -1
  538. package/models/trace/handlers/SelectorStatsHandler.js +0 -72
  539. package/models/trace/handlers/SelectorStatsHandler.js.map +0 -1
  540. package/models/trace/handlers/Threads.js +0 -108
  541. package/models/trace/handlers/Threads.js.map +0 -1
  542. package/models/trace/handlers/UserInteractionsHandler.js +0 -319
  543. package/models/trace/handlers/UserInteractionsHandler.js.map +0 -1
  544. package/models/trace/handlers/UserTimingsHandler.js +0 -194
  545. package/models/trace/handlers/UserTimingsHandler.js.map +0 -1
  546. package/models/trace/handlers/WarningsHandler.js +0 -135
  547. package/models/trace/handlers/WarningsHandler.js.map +0 -1
  548. package/models/trace/handlers/WorkersHandler.js +0 -34
  549. package/models/trace/handlers/WorkersHandler.js.map +0 -1
  550. package/models/trace/handlers/bundle-tsconfig.json +0 -59
  551. package/models/trace/handlers/bundle-tsconfig.ref.json +0 -27
  552. package/models/trace/handlers/foundation_unittests-tsconfig.json +0 -102
  553. package/models/trace/handlers/foundation_unittests-tsconfig.ref.json +0 -69
  554. package/models/trace/handlers/foundation_unittests_node_typecheck-tsconfig.json +0 -99
  555. package/models/trace/handlers/handlers-tsconfig.json +0 -112
  556. package/models/trace/handlers/handlers-tsconfig.ref.json +0 -80
  557. package/models/trace/handlers/handlers.js +0 -8
  558. package/models/trace/handlers/handlers.js.map +0 -1
  559. package/models/trace/handlers/handlers_node_typecheck-tsconfig.json +0 -109
  560. package/models/trace/handlers/handlers_node_typecheck.stamp +0 -0
  561. package/models/trace/handlers/helpers.js +0 -164
  562. package/models/trace/handlers/helpers.js.map +0 -1
  563. package/models/trace/handlers/types.js +0 -2
  564. package/models/trace/handlers/types.js.map +0 -1
  565. package/models/trace/helpers/Extensions.js +0 -42
  566. package/models/trace/helpers/Extensions.js.map +0 -1
  567. package/models/trace/helpers/Network.js +0 -103
  568. package/models/trace/helpers/Network.js.map +0 -1
  569. package/models/trace/helpers/SamplesIntegrator.js +0 -512
  570. package/models/trace/helpers/SamplesIntegrator.js.map +0 -1
  571. package/models/trace/helpers/SyntheticEvents.js +0 -94
  572. package/models/trace/helpers/SyntheticEvents.js.map +0 -1
  573. package/models/trace/helpers/Timing.js +0 -207
  574. package/models/trace/helpers/Timing.js.map +0 -1
  575. package/models/trace/helpers/Trace.js +0 -817
  576. package/models/trace/helpers/Trace.js.map +0 -1
  577. package/models/trace/helpers/TreeHelpers.js +0 -255
  578. package/models/trace/helpers/TreeHelpers.js.map +0 -1
  579. package/models/trace/helpers/bundle-tsconfig.json +0 -59
  580. package/models/trace/helpers/bundle-tsconfig.ref.json +0 -27
  581. package/models/trace/helpers/foundation_unittests-tsconfig.json +0 -73
  582. package/models/trace/helpers/foundation_unittests-tsconfig.ref.json +0 -40
  583. package/models/trace/helpers/foundation_unittests_node_typecheck-tsconfig.json +0 -70
  584. package/models/trace/helpers/helpers-tsconfig.json +0 -77
  585. package/models/trace/helpers/helpers-tsconfig.ref.json +0 -45
  586. package/models/trace/helpers/helpers.js +0 -11
  587. package/models/trace/helpers/helpers.js.map +0 -1
  588. package/models/trace/helpers/helpers_node_typecheck-tsconfig.json +0 -74
  589. package/models/trace/helpers/helpers_node_typecheck.stamp +0 -0
  590. package/models/trace/insights/CLSCulprits.js +0 -519
  591. package/models/trace/insights/CLSCulprits.js.map +0 -1
  592. package/models/trace/insights/Cache.js +0 -210
  593. package/models/trace/insights/Cache.js.map +0 -1
  594. package/models/trace/insights/CharacterSet.js +0 -132
  595. package/models/trace/insights/CharacterSet.js.map +0 -1
  596. package/models/trace/insights/Common.js +0 -366
  597. package/models/trace/insights/Common.js.map +0 -1
  598. package/models/trace/insights/DOMSize.js +0 -182
  599. package/models/trace/insights/DOMSize.js.map +0 -1
  600. package/models/trace/insights/DocumentLatency.js +0 -259
  601. package/models/trace/insights/DocumentLatency.js.map +0 -1
  602. package/models/trace/insights/DuplicatedJavaScript.js +0 -99
  603. package/models/trace/insights/DuplicatedJavaScript.js.map +0 -1
  604. package/models/trace/insights/FontDisplay.js +0 -93
  605. package/models/trace/insights/FontDisplay.js.map +0 -1
  606. package/models/trace/insights/ForcedReflow.js +0 -162
  607. package/models/trace/insights/ForcedReflow.js.map +0 -1
  608. package/models/trace/insights/INPBreakdown.js +0 -130
  609. package/models/trace/insights/INPBreakdown.js.map +0 -1
  610. package/models/trace/insights/ImageDelivery.js +0 -264
  611. package/models/trace/insights/ImageDelivery.js.map +0 -1
  612. package/models/trace/insights/LCPBreakdown.js +0 -200
  613. package/models/trace/insights/LCPBreakdown.js.map +0 -1
  614. package/models/trace/insights/LCPDiscovery.js +0 -190
  615. package/models/trace/insights/LCPDiscovery.js.map +0 -1
  616. package/models/trace/insights/LegacyJavaScript.js +0 -99
  617. package/models/trace/insights/LegacyJavaScript.js.map +0 -1
  618. package/models/trace/insights/Models.js +0 -23
  619. package/models/trace/insights/Models.js.map +0 -1
  620. package/models/trace/insights/ModernHTTP.js +0 -205
  621. package/models/trace/insights/ModernHTTP.js.map +0 -1
  622. package/models/trace/insights/NetworkDependencyTree.js +0 -972
  623. package/models/trace/insights/NetworkDependencyTree.js.map +0 -1
  624. package/models/trace/insights/RenderBlocking.js +0 -191
  625. package/models/trace/insights/RenderBlocking.js.map +0 -1
  626. package/models/trace/insights/SlowCSSSelector.js +0 -140
  627. package/models/trace/insights/SlowCSSSelector.js.map +0 -1
  628. package/models/trace/insights/Statistics.js +0 -93
  629. package/models/trace/insights/Statistics.js.map +0 -1
  630. package/models/trace/insights/ThirdParties.js +0 -110
  631. package/models/trace/insights/ThirdParties.js.map +0 -1
  632. package/models/trace/insights/Viewport.js +0 -105
  633. package/models/trace/insights/Viewport.js.map +0 -1
  634. package/models/trace/insights/bundle-tsconfig.json +0 -59
  635. package/models/trace/insights/bundle-tsconfig.ref.json +0 -27
  636. package/models/trace/insights/foundation_unittests-tsconfig.json +0 -98
  637. package/models/trace/insights/foundation_unittests-tsconfig.ref.json +0 -65
  638. package/models/trace/insights/foundation_unittests_node_typecheck-tsconfig.json +0 -95
  639. package/models/trace/insights/insights-tsconfig.json +0 -114
  640. package/models/trace/insights/insights-tsconfig.ref.json +0 -82
  641. package/models/trace/insights/insights.js +0 -10
  642. package/models/trace/insights/insights.js.map +0 -1
  643. package/models/trace/insights/insights_node_typecheck-tsconfig.json +0 -111
  644. package/models/trace/insights/insights_node_typecheck.stamp +0 -0
  645. package/models/trace/insights/types.js +0 -41
  646. package/models/trace/insights/types.js.map +0 -1
  647. package/models/trace/lantern/bundle-tsconfig.json +0 -71
  648. package/models/trace/lantern/bundle-tsconfig.ref.json +0 -39
  649. package/models/trace/lantern/core/LanternError.js +0 -7
  650. package/models/trace/lantern/core/LanternError.js.map +0 -1
  651. package/models/trace/lantern/core/NetworkAnalyzer.js +0 -488
  652. package/models/trace/lantern/core/NetworkAnalyzer.js.map +0 -1
  653. package/models/trace/lantern/core/bundle-tsconfig.json +0 -59
  654. package/models/trace/lantern/core/bundle-tsconfig.ref.json +0 -27
  655. package/models/trace/lantern/core/core-tsconfig.json +0 -60
  656. package/models/trace/lantern/core/core-tsconfig.ref.json +0 -28
  657. package/models/trace/lantern/core/core.js +0 -6
  658. package/models/trace/lantern/core/core.js.map +0 -1
  659. package/models/trace/lantern/core/core_node_typecheck-tsconfig.json +0 -57
  660. package/models/trace/lantern/core/core_node_typecheck.stamp +0 -0
  661. package/models/trace/lantern/core/foundation_unittests-tsconfig.json +0 -69
  662. package/models/trace/lantern/core/foundation_unittests-tsconfig.ref.json +0 -36
  663. package/models/trace/lantern/core/foundation_unittests_node_typecheck-tsconfig.json +0 -66
  664. package/models/trace/lantern/graph/BaseNode.js +0 -277
  665. package/models/trace/lantern/graph/BaseNode.js.map +0 -1
  666. package/models/trace/lantern/graph/CPUNode.js +0 -80
  667. package/models/trace/lantern/graph/CPUNode.js.map +0 -1
  668. package/models/trace/lantern/graph/NetworkNode.js +0 -95
  669. package/models/trace/lantern/graph/NetworkNode.js.map +0 -1
  670. package/models/trace/lantern/graph/PageDependencyGraph.js +0 -574
  671. package/models/trace/lantern/graph/PageDependencyGraph.js.map +0 -1
  672. package/models/trace/lantern/graph/bundle-tsconfig.json +0 -59
  673. package/models/trace/lantern/graph/bundle-tsconfig.ref.json +0 -27
  674. package/models/trace/lantern/graph/foundation_unittests-tsconfig.json +0 -61
  675. package/models/trace/lantern/graph/foundation_unittests-tsconfig.ref.json +0 -28
  676. package/models/trace/lantern/graph/foundation_unittests_node_typecheck-tsconfig.json +0 -58
  677. package/models/trace/lantern/graph/graph-tsconfig.json +0 -65
  678. package/models/trace/lantern/graph/graph-tsconfig.ref.json +0 -33
  679. package/models/trace/lantern/graph/graph.js +0 -8
  680. package/models/trace/lantern/graph/graph.js.map +0 -1
  681. package/models/trace/lantern/graph/graph_node_typecheck-tsconfig.json +0 -62
  682. package/models/trace/lantern/graph/graph_node_typecheck.stamp +0 -0
  683. package/models/trace/lantern/lantern.js +0 -10
  684. package/models/trace/lantern/lantern.js.map +0 -1
  685. package/models/trace/lantern/metrics/FirstContentfulPaint.js +0 -137
  686. package/models/trace/lantern/metrics/FirstContentfulPaint.js.map +0 -1
  687. package/models/trace/lantern/metrics/Interactive.js +0 -68
  688. package/models/trace/lantern/metrics/Interactive.js.map +0 -1
  689. package/models/trace/lantern/metrics/LargestContentfulPaint.js +0 -69
  690. package/models/trace/lantern/metrics/LargestContentfulPaint.js.map +0 -1
  691. package/models/trace/lantern/metrics/MaxPotentialFID.js +0 -49
  692. package/models/trace/lantern/metrics/MaxPotentialFID.js.map +0 -1
  693. package/models/trace/lantern/metrics/Metric.js +0 -69
  694. package/models/trace/lantern/metrics/Metric.js.map +0 -1
  695. package/models/trace/lantern/metrics/SpeedIndex.js +0 -102
  696. package/models/trace/lantern/metrics/SpeedIndex.js.map +0 -1
  697. package/models/trace/lantern/metrics/TBTUtils.js +0 -65
  698. package/models/trace/lantern/metrics/TBTUtils.js.map +0 -1
  699. package/models/trace/lantern/metrics/TotalBlockingTime.js +0 -79
  700. package/models/trace/lantern/metrics/TotalBlockingTime.js.map +0 -1
  701. package/models/trace/lantern/metrics/bundle-tsconfig.json +0 -59
  702. package/models/trace/lantern/metrics/bundle-tsconfig.ref.json +0 -27
  703. package/models/trace/lantern/metrics/foundation_unittests-tsconfig.json +0 -76
  704. package/models/trace/lantern/metrics/foundation_unittests-tsconfig.ref.json +0 -43
  705. package/models/trace/lantern/metrics/foundation_unittests_node_typecheck-tsconfig.json +0 -73
  706. package/models/trace/lantern/metrics/metrics-tsconfig.json +0 -75
  707. package/models/trace/lantern/metrics/metrics-tsconfig.ref.json +0 -43
  708. package/models/trace/lantern/metrics/metrics.js +0 -12
  709. package/models/trace/lantern/metrics/metrics.js.map +0 -1
  710. package/models/trace/lantern/metrics/metrics_node_typecheck-tsconfig.json +0 -72
  711. package/models/trace/lantern/metrics/metrics_node_typecheck.stamp +0 -0
  712. package/models/trace/lantern/simulation/ConnectionPool.js +0 -116
  713. package/models/trace/lantern/simulation/ConnectionPool.js.map +0 -1
  714. package/models/trace/lantern/simulation/Constants.js +0 -45
  715. package/models/trace/lantern/simulation/Constants.js.map +0 -1
  716. package/models/trace/lantern/simulation/DNSCache.js +0 -48
  717. package/models/trace/lantern/simulation/DNSCache.js.map +0 -1
  718. package/models/trace/lantern/simulation/SimulationTimingMap.js +0 -135
  719. package/models/trace/lantern/simulation/SimulationTimingMap.js.map +0 -1
  720. package/models/trace/lantern/simulation/Simulator.js +0 -455
  721. package/models/trace/lantern/simulation/Simulator.js.map +0 -1
  722. package/models/trace/lantern/simulation/TCPConnection.js +0 -155
  723. package/models/trace/lantern/simulation/TCPConnection.js.map +0 -1
  724. package/models/trace/lantern/simulation/bundle-tsconfig.json +0 -59
  725. package/models/trace/lantern/simulation/bundle-tsconfig.ref.json +0 -27
  726. package/models/trace/lantern/simulation/foundation_unittests-tsconfig.json +0 -75
  727. package/models/trace/lantern/simulation/foundation_unittests-tsconfig.ref.json +0 -42
  728. package/models/trace/lantern/simulation/foundation_unittests_node_typecheck-tsconfig.json +0 -72
  729. package/models/trace/lantern/simulation/simulation-tsconfig.json +0 -70
  730. package/models/trace/lantern/simulation/simulation-tsconfig.ref.json +0 -38
  731. package/models/trace/lantern/simulation/simulation.js +0 -10
  732. package/models/trace/lantern/simulation/simulation.js.map +0 -1
  733. package/models/trace/lantern/simulation/simulation_node_typecheck-tsconfig.json +0 -67
  734. package/models/trace/lantern/simulation/simulation_node_typecheck.stamp +0 -0
  735. package/models/trace/lantern/testing/bundle-tsconfig.json +0 -60
  736. package/models/trace/lantern/testing/bundle-tsconfig.ref.json +0 -27
  737. package/models/trace/lantern/testing/testing-tsconfig.json +0 -63
  738. package/models/trace/lantern/testing/testing-tsconfig.ref.json +0 -30
  739. package/models/trace/lantern/types/Lantern.js +0 -25
  740. package/models/trace/lantern/types/Lantern.js.map +0 -1
  741. package/models/trace/lantern/types/bundle-tsconfig.json +0 -59
  742. package/models/trace/lantern/types/bundle-tsconfig.ref.json +0 -27
  743. package/models/trace/lantern/types/types-tsconfig.json +0 -59
  744. package/models/trace/lantern/types/types-tsconfig.ref.json +0 -27
  745. package/models/trace/lantern/types/types.js +0 -5
  746. package/models/trace/lantern/types/types.js.map +0 -1
  747. package/models/trace/lantern/types/types_node_typecheck-tsconfig.json +0 -56
  748. package/models/trace/lantern/types/types_node_typecheck.stamp +0 -0
  749. package/models/trace/trace-tsconfig.json +0 -89
  750. package/models/trace/trace-tsconfig.ref.json +0 -57
  751. package/models/trace/trace.js.map +0 -1
  752. package/models/trace/trace_node_typecheck-tsconfig.json +0 -86
  753. package/models/trace/trace_node_typecheck.stamp +0 -0
  754. package/models/trace/types/Configuration.js +0 -19
  755. package/models/trace/types/Configuration.js.map +0 -1
  756. package/models/trace/types/Extensions.js +0 -38
  757. package/models/trace/types/Extensions.js.map +0 -1
  758. package/models/trace/types/File.js +0 -82
  759. package/models/trace/types/File.js.map +0 -1
  760. package/models/trace/types/Overlays.js +0 -5
  761. package/models/trace/types/Overlays.js.map +0 -1
  762. package/models/trace/types/Timing.js +0 -16
  763. package/models/trace/types/Timing.js.map +0 -1
  764. package/models/trace/types/TraceEvents.js +0 -986
  765. package/models/trace/types/TraceEvents.js.map +0 -1
  766. package/models/trace/types/bundle-tsconfig.json +0 -59
  767. package/models/trace/types/bundle-tsconfig.ref.json +0 -27
  768. package/models/trace/types/foundation_unittests-tsconfig.json +0 -67
  769. package/models/trace/types/foundation_unittests-tsconfig.ref.json +0 -34
  770. package/models/trace/types/foundation_unittests_node_typecheck-tsconfig.json +0 -64
  771. package/models/trace/types/types-tsconfig.json +0 -76
  772. package/models/trace/types/types-tsconfig.ref.json +0 -44
  773. package/models/trace/types/types.js +0 -10
  774. package/models/trace/types/types.js.map +0 -1
  775. package/models/trace/types/types_node_typecheck-tsconfig.json +0 -73
  776. package/models/trace/types/types_node_typecheck.stamp +0 -0
  777. package/test/invalid-animation-events.json.gz +0 -0
  778. package/test/test-trace-engine.mjs +0 -191
  779. package/third_party/legacy-javascript/bundle-tsconfig.json +0 -59
  780. package/third_party/legacy-javascript/bundle-tsconfig.ref.json +0 -27
  781. package/third_party/legacy-javascript/legacy-javascript-tsconfig.ref.json +0 -15
  782. package/third_party/legacy-javascript/legacy-javascript.js +0 -3
  783. package/third_party/legacy-javascript/legacy-javascript.js.map +0 -1
  784. package/third_party/legacy-javascript/lib/legacy-javascript.js +0 -1119
  785. package/third_party/marked/marked.d.ts +0 -1
  786. package/third_party/marked/marked.js +0 -1
  787. package/third_party/third-party-web/third-party-web.js +0 -1
  788. package/tsconfig.json +0 -29
@@ -1,512 +0,0 @@
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
- var _a;
5
- import * as Types from '../types/types.js';
6
- import { milliToMicro } from './Timing.js';
7
- import { extractSampleTraceId, makeProfileCall, mergeEventsInOrder, sortTraceEventsInPlace } from './Trace.js';
8
- /**
9
- * This is a helper that integrates CPU profiling data coming in the
10
- * shape of samples, with trace events. Samples indicate what the JS
11
- * stack trace looked at a given point in time, but they don't have
12
- * duration. The SamplesIntegrator task is to make an approximation
13
- * of what the duration of each JS call was, given the sample data and
14
- * given the trace events profiled during that time. At the end of its
15
- * execution, the SamplesIntegrator returns an array of ProfileCalls
16
- * (under SamplesIntegrator::buildProfileCalls()), which
17
- * represent JS calls, with a call frame and duration. These calls have
18
- * the shape of a complete trace events and can be treated as flame
19
- * chart entries in the timeline.
20
- *
21
- * The approach to build the profile calls consists in tracking the
22
- * current stack as the following events happen (in order):
23
- * 1. A sample was done.
24
- * 2. A trace event started.
25
- * 3. A trace event ended.
26
- * Depending on the event and on the data that's coming with it the
27
- * stack is updated by adding or removing JS calls to it and updating
28
- * the duration of the calls in the tracking stack.
29
- *
30
- * note: Although this approach has been implemented since long ago, and
31
- * is relatively efficient (adds a complexity over the trace parsing of
32
- * O(n) where n is the number of samples) it has proven to be faulty.
33
- * It might be worthwhile experimenting with improvements or with a
34
- * completely different approach. Improving the approach is tracked in
35
- * crbug.com/1417439
36
- */
37
- export class SamplesIntegrator {
38
- /**
39
- * The result of running the samples integrator. Holds the JS calls
40
- * with their approximated duration after integrating samples into the
41
- * trace event tree.
42
- */
43
- #constructedProfileCalls = [];
44
- /**
45
- * tracks the state of the JS stack at each point in time to update
46
- * the profile call durations as new events arrive. This doesn't only
47
- * happen with new profile calls (in which case we would compare the
48
- * stack in them) but also with trace events (in which case we would
49
- * update the duration of the events we are tracking at the moment).
50
- */
51
- #currentJSStack = [];
52
- /**
53
- * Process holding the CPU profile and trace events.
54
- */
55
- #processId;
56
- /**
57
- * Thread holding the CPU profile and trace events.
58
- */
59
- #threadId;
60
- /**
61
- * Tracks the depth of the JS stack at the moment a trace event starts
62
- * or ends. It is assumed that for the duration of a trace event, the
63
- * JS stack's depth cannot decrease, since JS calls that started
64
- * before a trace event cannot end during the trace event. So as trace
65
- * events arrive, we store the "locked" amount of JS frames that were
66
- * in the stack before the event came.
67
- */
68
- #lockedJsStackDepth = [];
69
- /**
70
- * Used to keep track when samples should be integrated even if they
71
- * are not children of invocation trace events. This is used in two cases:
72
- * 1. We start tracing half-way through, so we miss the start of JS
73
- * invocation events.
74
- * 2. On threads (like Web Workers) without real JS invocation parent events,
75
- * but where trace events (like SchedulePostMessage) integrate stack traces.
76
- * Enabling fake JS mode allows subsequent samples to be processed and
77
- * eventually correct the stack, preventing a deadlock.
78
- */
79
- #fakeJSInvocation = false;
80
- /**
81
- * The parsed CPU profile, holding the tree hierarchy of JS frames and
82
- * the sample data.
83
- */
84
- #profileModel;
85
- /**
86
- * Because GC nodes don't have a stack, we artificially add a stack to
87
- * them which corresponds to that of the previous sample. This map
88
- * tracks which node is used for the stack of a GC call.
89
- * Note that GC samples are not shown in the flamechart, however they
90
- * are used during the construction of for profile calls, as we can
91
- * infer information about the duration of the executed code when a
92
- * GC node is sampled.
93
- */
94
- #nodeForGC = new Map();
95
- #engineConfig;
96
- #profileId;
97
- /**
98
- * Keeps track of the individual samples from the CPU Profile.
99
- * Only used with Debug Mode experiment enabled.
100
- */
101
- jsSampleEvents = [];
102
- constructor(profileModel, profileId, pid, tid, configuration) {
103
- this.#profileModel = profileModel;
104
- this.#threadId = tid;
105
- this.#processId = pid;
106
- this.#engineConfig = configuration || Types.Configuration.defaults();
107
- this.#profileId = profileId;
108
- }
109
- buildProfileCalls(traceEvents) {
110
- const mergedEvents = mergeEventsInOrder(traceEvents, this.callsFromProfileSamples());
111
- const stack = [];
112
- for (let i = 0; i < mergedEvents.length; i++) {
113
- const event = mergedEvents[i];
114
- // Because instant trace events have no duration, they don't provide
115
- // useful information for possible changes in the duration of calls
116
- // in the JS stack.
117
- if (event.ph === Types.Events.Phase.INSTANT && !extractSampleTraceId(event)) {
118
- continue;
119
- }
120
- if (stack.length === 0) {
121
- if (Types.Events.isProfileCall(event)) {
122
- this.#onProfileCall(event);
123
- continue;
124
- }
125
- stack.push(event);
126
- this.#onTraceEventStart(event);
127
- continue;
128
- }
129
- const parentEvent = stack.at(-1);
130
- if (parentEvent === undefined) {
131
- continue;
132
- }
133
- const begin = event.ts;
134
- const parentBegin = parentEvent.ts;
135
- const parentDuration = parentEvent.dur || 0;
136
- const parentEnd = parentBegin + parentDuration;
137
- const startsAfterParent = begin >= parentEnd;
138
- if (startsAfterParent) {
139
- this.#onTraceEventEnd(parentEvent);
140
- stack.pop();
141
- i--;
142
- continue;
143
- }
144
- if (Types.Events.isProfileCall(event)) {
145
- this.#onProfileCall(event, parentEvent);
146
- continue;
147
- }
148
- this.#onTraceEventStart(event, parentEvent);
149
- stack.push(event);
150
- }
151
- while (stack.length) {
152
- const last = stack.pop();
153
- if (last) {
154
- this.#onTraceEventEnd(last);
155
- }
156
- }
157
- sortTraceEventsInPlace(this.jsSampleEvents);
158
- return this.#constructedProfileCalls;
159
- }
160
- #onTraceEventStart(event, parent) {
161
- // Top level events cannot be nested into JS frames so we reset
162
- // the stack when we find one.
163
- if (event.name === Types.Events.Name.RUN_MICROTASKS || event.name === Types.Events.Name.RUN_TASK) {
164
- this.#lockedJsStackDepth = [];
165
- this.#truncateJSStack(0, event.ts);
166
- this.#fakeJSInvocation = false;
167
- }
168
- if (this.#fakeJSInvocation) {
169
- this.#truncateJSStack(this.#lockedJsStackDepth.pop() || 0, event.ts);
170
- this.#fakeJSInvocation = false;
171
- }
172
- this.#extractStackTrace(event);
173
- if (extractSampleTraceId(event)) {
174
- const hasJSInvocationParent = parent && Types.Events.isJSInvocationEvent(parent);
175
- if (!hasJSInvocationParent) {
176
- // If the event has a sampleTraceId (meaning it has a stack trace) but
177
- // no JS invocation parent, we enter fake JS mode. This ensures that
178
- // subsequent samples on this thread are processed, allowing the stack
179
- // to be correctly updated/truncated. Without this, subsequent samples
180
- // would be ignored because the stack is non-empty but we are not
181
- // considered to be in JS.
182
- this.#fakeJSInvocation = true;
183
- }
184
- }
185
- // Keep track of the call frames in the stack before the event
186
- // happened. For the duration of this event, these frames cannot
187
- // change (none can be terminated before this event finishes).
188
- //
189
- // Also, every frame that is opened after this event, is considered
190
- // to be a descendant of the event. So once the event finishes, the
191
- // frames that were opened after it, need to be closed (see
192
- // onEndEvent).
193
- //
194
- // TODO(crbug.com/1417439):
195
- // The assumption that every frame opened after an event is a
196
- // descendant of the event is incorrect. For example, a JS call that
197
- // parents a trace event might have been sampled after the event was
198
- // dispatched. In this case the JS call would be discarded if this
199
- // event isn't an invocation event, otherwise the call will be
200
- // considered a child of the event. In both cases, the result would
201
- // be incorrect.
202
- this.#lockedJsStackDepth.push(this.#currentJSStack.length);
203
- }
204
- #onProfileCall(event, parent) {
205
- if ((parent && Types.Events.isJSInvocationEvent(parent)) || this.#fakeJSInvocation) {
206
- this.#extractStackTrace(event);
207
- }
208
- else if (Types.Events.isProfileCall(event) && this.#currentJSStack.length === 0) {
209
- // Force JS Samples to show up even if we are not inside a JS
210
- // invocation event, because we can be missing the start of JS
211
- // invocation events if we start tracing half-way through. Pretend
212
- // we have a top-level JS invocation event.
213
- this.#fakeJSInvocation = true;
214
- const stackDepthBefore = this.#currentJSStack.length;
215
- this.#extractStackTrace(event);
216
- this.#lockedJsStackDepth.push(stackDepthBefore);
217
- }
218
- }
219
- #onTraceEventEnd(event) {
220
- // Because the event has ended, any frames that happened after
221
- // this event are terminated. Frames that are ancestors to this
222
- // event are extended to cover its ending.
223
- const endTime = Types.Timing.Micro(event.ts + (event.dur ?? 0));
224
- this.#truncateJSStack(this.#lockedJsStackDepth.pop() || 0, endTime);
225
- }
226
- /**
227
- * Builds the initial calls with no duration from samples. Their
228
- * purpose is to be merged with the trace event array being parsed so
229
- * that they can be traversed in order with them and their duration
230
- * can be updated as the SampleIntegrator callbacks are invoked.
231
- */
232
- callsFromProfileSamples() {
233
- const samples = this.#profileModel.samples;
234
- const timestamps = this.#profileModel.timestamps;
235
- if (!samples) {
236
- return [];
237
- }
238
- const calls = [];
239
- let prevNode;
240
- for (let i = 0; i < samples.length; i++) {
241
- const node = this.#profileModel.nodeByIndex(i);
242
- const timestamp = milliToMicro(Types.Timing.Milli(timestamps[i]));
243
- if (!node) {
244
- continue;
245
- }
246
- const call = makeProfileCall(node, this.#profileId, i, timestamp, this.#processId, this.#threadId);
247
- calls.push(call);
248
- if (this.#engineConfig.debugMode) {
249
- const traceId = this.#profileModel.traceIds?.[i];
250
- this.jsSampleEvents.push(this.#makeJSSampleEvent(call, timestamp, traceId));
251
- }
252
- if (node.id === this.#profileModel.gcNode?.id && prevNode) {
253
- // GC samples have no stack, so we just put GC node on top of the
254
- // last recorded sample. Cache the previous sample for future
255
- // reference.
256
- this.#nodeForGC.set(call, prevNode);
257
- continue;
258
- }
259
- prevNode = node;
260
- }
261
- return calls;
262
- }
263
- /**
264
- * Given a synthetic profile call, returns an array of profile calls
265
- * representing the stack trace that profile call belongs to based on
266
- * its nodeId. The input profile call will be at the top of the
267
- * returned stack (last position), meaning that any other frames that
268
- * were effectively above it are omitted.
269
- * @param profileCall
270
- * @param overrideTimeStamp a custom timestamp to use for the returned
271
- * profile calls. If not defined, the timestamp of the input
272
- * profileCall is used instead. This param is useful for example when
273
- * creating the profile calls for a sample with a trace id, since the
274
- * timestamp of the corresponding trace event should be used instead
275
- * of the sample's.
276
- */
277
- #makeProfileCallsForStack(profileCall, overrideTimeStamp) {
278
- let node = this.#profileModel.nodeById(profileCall.nodeId);
279
- const isGarbageCollection = node?.id === this.#profileModel.gcNode?.id;
280
- if (isGarbageCollection) {
281
- // Because GC don't have a stack, we use the stack of the previous
282
- // sample.
283
- node = this.#nodeForGC.get(profileCall) || null;
284
- }
285
- if (!node) {
286
- return [];
287
- }
288
- // `node.depth` is 0 based, so to set the size of the array we need
289
- // to add 1 to its value.
290
- const callFrames = new Array(node.depth + 1 + Number(isGarbageCollection));
291
- // Add the stack trace in reverse order (bottom first).
292
- let i = callFrames.length - 1;
293
- if (isGarbageCollection) {
294
- // Place the garbage collection call frame on top of the stack.
295
- callFrames[i--] = profileCall;
296
- }
297
- // Many of these ProfileCalls will be GC'd later when we estimate the frame
298
- // durations
299
- while (node) {
300
- callFrames[i--] = makeProfileCall(node, profileCall.profileId, profileCall.sampleIndex, overrideTimeStamp ?? profileCall.ts, this.#processId, this.#threadId);
301
- node = node.parent;
302
- }
303
- return callFrames;
304
- }
305
- #getStackForSampleTraceId(traceId, timestamp) {
306
- const nodeId = this.#profileModel.traceIds?.[traceId];
307
- const node = nodeId && this.#profileModel.nodeById(nodeId);
308
- const maybeCallForTraceId = node && makeProfileCall(node, this.#profileId, -1, timestamp, this.#processId, this.#threadId);
309
- if (!maybeCallForTraceId) {
310
- return null;
311
- }
312
- if (this.#engineConfig.debugMode) {
313
- this.jsSampleEvents.push(this.#makeJSSampleEvent(maybeCallForTraceId, timestamp, traceId));
314
- }
315
- return this.#makeProfileCallsForStack(maybeCallForTraceId);
316
- }
317
- /**
318
- * Update tracked stack using this event's call stack.
319
- */
320
- #extractStackTrace(event) {
321
- let stackTrace = this.#currentJSStack;
322
- if (Types.Events.isProfileCall(event)) {
323
- stackTrace = this.#makeProfileCallsForStack(event);
324
- }
325
- const traceId = extractSampleTraceId(event);
326
- const maybeCallForTraceId = traceId && this.#getStackForSampleTraceId(traceId, event.ts);
327
- if (maybeCallForTraceId) {
328
- stackTrace = maybeCallForTraceId;
329
- }
330
- _a.filterStackFrames(stackTrace, this.#engineConfig);
331
- const endTime = event.ts + (event.dur || 0);
332
- const minFrames = Math.min(stackTrace.length, this.#currentJSStack.length);
333
- let i;
334
- // Merge a sample's stack frames with the stack frames we have
335
- // so far if we detect they are equivalent.
336
- // Graphically
337
- // This:
338
- // Current stack trace Sample
339
- // [-------A------] [A]
340
- // [-------B------] [B]
341
- // [-------C------] [C]
342
- // ^ t = x1 ^ t = x2
343
- // Becomes this:
344
- // New stack trace after merge
345
- // [--------A-------]
346
- // [--------B-------]
347
- // [--------C-------]
348
- // ^ t = x2
349
- for (i = this.#lockedJsStackDepth.at(-1) || 0; i < minFrames; ++i) {
350
- const newFrame = stackTrace[i].callFrame;
351
- const oldFrame = this.#currentJSStack[i].callFrame;
352
- if (!_a.framesAreEqual(newFrame, oldFrame)) {
353
- break;
354
- }
355
- // Scoot the right edge of this callFrame to the right
356
- this.#currentJSStack[i].dur =
357
- Types.Timing.Micro(Math.max(this.#currentJSStack[i].dur || 0, endTime - this.#currentJSStack[i].ts));
358
- }
359
- // If there are call frames in the sample that differ with the stack
360
- // we have, update the stack, but keeping the common frames in place
361
- // Graphically
362
- // This:
363
- // Current stack trace Sample
364
- // [-------A------] [A]
365
- // [-------B------] [B]
366
- // [-------C------] [C]
367
- // [-------D------] [E]
368
- // ^ t = x1 ^ t = x2
369
- // Becomes this:
370
- // New stack trace after merge
371
- // [--------A-------]
372
- // [--------B-------]
373
- // [--------C-------]
374
- // [E]
375
- // ^ t = x2
376
- this.#truncateJSStack(i, event.ts);
377
- for (; i < stackTrace.length; ++i) {
378
- const call = stackTrace[i];
379
- if (call.nodeId === this.#profileModel.programNode?.id || call.nodeId === this.#profileModel.root?.id ||
380
- call.nodeId === this.#profileModel.idleNode?.id || call.nodeId === this.#profileModel.gcNode?.id) {
381
- // Skip (root), (program) and (idle) frames, since this are not
382
- // relevant for web profiling and we don't want to show them in
383
- // the timeline.
384
- continue;
385
- }
386
- this.#currentJSStack.push(call);
387
- this.#constructedProfileCalls.push(call);
388
- }
389
- }
390
- /**
391
- * When a call stack that differs from the one we are tracking has
392
- * been detected in the samples, the latter is "truncated" by
393
- * setting the ending time of its call frames and removing the top
394
- * call frames that aren't shared with the new call stack. This way,
395
- * we can update the tracked stack with the new call frames on top.
396
- * @param depth the amount of call frames from bottom to top that
397
- * should be kept in the tracking stack trace. AKA amount of shared
398
- * call frames between two stacks.
399
- * @param time the new end of the call frames in the stack.
400
- */
401
- #truncateJSStack(depth, time) {
402
- if (this.#lockedJsStackDepth.length) {
403
- const lockedDepth = this.#lockedJsStackDepth.at(-1);
404
- if (lockedDepth && depth < lockedDepth) {
405
- console.error(`Child stack is shallower (${depth}) than the parent stack (${lockedDepth}) at ${time}`);
406
- depth = lockedDepth;
407
- }
408
- }
409
- if (this.#currentJSStack.length < depth) {
410
- console.error(`Trying to truncate higher than the current stack size at ${time}`);
411
- depth = this.#currentJSStack.length;
412
- }
413
- for (let k = 0; k < this.#currentJSStack.length; ++k) {
414
- this.#currentJSStack[k].dur = Types.Timing.Micro(Math.max(time - this.#currentJSStack[k].ts, 0));
415
- }
416
- this.#currentJSStack.length = depth;
417
- }
418
- #makeJSSampleEvent(call, timestamp, traceId) {
419
- const JSSampleEvent = {
420
- name: Types.Events.Name.JS_SAMPLE,
421
- cat: 'devtools.timeline',
422
- args: {
423
- data: { traceId, stackTrace: this.#makeProfileCallsForStack(call).map(e => e.callFrame) },
424
- },
425
- ph: Types.Events.Phase.INSTANT,
426
- ts: timestamp,
427
- dur: Types.Timing.Micro(0),
428
- pid: this.#processId,
429
- tid: this.#threadId,
430
- };
431
- return JSSampleEvent;
432
- }
433
- static framesAreEqual(frame1, frame2) {
434
- return frame1.scriptId === frame2.scriptId && frame1.functionName === frame2.functionName &&
435
- frame1.lineNumber === frame2.lineNumber;
436
- }
437
- static showNativeName(name, runtimeCallStatsEnabled) {
438
- return runtimeCallStatsEnabled && Boolean(_a.nativeGroup(name));
439
- }
440
- static nativeGroup(nativeName) {
441
- if (nativeName.startsWith('Parse')) {
442
- return _a.NativeGroups.PARSE;
443
- }
444
- if (nativeName.startsWith('Compile') || nativeName.startsWith('Recompile')) {
445
- return _a.NativeGroups.COMPILE;
446
- }
447
- return null;
448
- }
449
- static isNativeRuntimeFrame(frame) {
450
- return frame.url === 'native V8Runtime';
451
- }
452
- static filterStackFrames(stack, engineConfig) {
453
- const showAllEvents = engineConfig.showAllEvents;
454
- if (showAllEvents) {
455
- return;
456
- }
457
- let j = 0;
458
- for (let i = 0; i < stack.length; ++i) {
459
- const frame = stack[i].callFrame;
460
- const nativeRuntimeFrame = _a.isNativeRuntimeFrame(frame);
461
- if (nativeRuntimeFrame) {
462
- continue;
463
- }
464
- stack[j++] = stack[i];
465
- }
466
- stack.length = j;
467
- }
468
- static createFakeTraceFromCpuProfile(profile, tid) {
469
- if (!profile) {
470
- return { traceEvents: [], metadata: {} };
471
- }
472
- // The |Name.CPU_PROFILE| will let MetaHandler to set |traceIsGeneric| to false
473
- // The start time and duration is important here because we'll use them to determine the traceBounds
474
- // We use the start and end time of the profile (which is longer than all samples), so the Performance
475
- // panel won't truncate this time period.
476
- const cpuProfileEvent = {
477
- cat: 'disabled-by-default-devtools.timeline',
478
- name: Types.Events.Name.CPU_PROFILE,
479
- ph: Types.Events.Phase.COMPLETE,
480
- pid: Types.Events.ProcessID(1),
481
- tid,
482
- ts: Types.Timing.Micro(profile.startTime),
483
- dur: Types.Timing.Micro(profile.endTime - profile.startTime),
484
- args: { data: { cpuProfile: profile } },
485
- // Create an arbitrary profile id.
486
- id: '0x1',
487
- };
488
- return {
489
- traceEvents: [cpuProfileEvent],
490
- metadata: {
491
- dataOrigin: Types.File.DataOrigin.CPU_PROFILE,
492
- },
493
- };
494
- }
495
- static extractCpuProfileFromFakeTrace(traceEvents) {
496
- const profileEvent = traceEvents.find(e => Types.Events.isSyntheticCpuProfile(e));
497
- const profile = profileEvent?.args.data.cpuProfile;
498
- if (!profile) {
499
- throw new Error('Missing cpuProfile data');
500
- }
501
- return profile;
502
- }
503
- }
504
- _a = SamplesIntegrator;
505
- (function (SamplesIntegrator) {
506
- let NativeGroups;
507
- (function (NativeGroups) {
508
- NativeGroups["COMPILE"] = "Compile";
509
- NativeGroups["PARSE"] = "Parse";
510
- })(NativeGroups = SamplesIntegrator.NativeGroups || (SamplesIntegrator.NativeGroups = {}));
511
- })(SamplesIntegrator || (SamplesIntegrator = {}));
512
- //# sourceMappingURL=SamplesIntegrator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SamplesIntegrator.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/helpers/SamplesIntegrator.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;;AAI7B,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AACzC,OAAO,EAAC,oBAAoB,EAAE,eAAe,EAAE,kBAAkB,EAAE,sBAAsB,EAAC,MAAM,YAAY,CAAC;AAE7G;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,OAAO,iBAAiB;IAC5B;;;;OAIG;IACH,wBAAwB,GAAwC,EAAE,CAAC;IACnE;;;;;;OAMG;IACH,eAAe,GAAwC,EAAE,CAAC;IAC1D;;OAEG;IACH,UAAU,CAAyB;IACnC;;OAEG;IACH,SAAS,CAAwB;IACjC;;;;;;;OAOG;IACH,mBAAmB,GAAa,EAAE,CAAC;IACnC;;;;;;;;;OASG;IACH,iBAAiB,GAAG,KAAK,CAAC;IAC1B;;;OAGG;IACH,aAAa,CAAqD;IAClE;;;;;;;;OAQG;IACH,UAAU,GAAG,IAAI,GAAG,EAA8E,CAAC;IAEnG,aAAa,CAAoC;IACjD,UAAU,CAAyB;IAEnC;;;OAGG;IACH,cAAc,GAAqC,EAAE,CAAC;IAEtD,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CAAC,KAAK,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;QAClF,MAAM,OAAO,GAAG,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;QACnD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;;AAED,WAAiB,iBAAiB;IAChC,IAAY,YAGX;IAHD,WAAY,YAAY;QACtB,mCAAmB,CAAA;QACnB,+BAAe,CAAA;IACjB,CAAC,EAHW,YAAY,GAAZ,kBAAA,YAAY,KAAZ,kBAAA,YAAY,QAGvB;AACH,CAAC,EALgB,iBAAiB,KAAjB,iBAAiB,QAKjC","sourcesContent":["// Copyright 2023 The Chromium Authors\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';\nimport type * as CPUProfile from '../../cpu_profile/cpu_profile.js';\nimport * as Types from '../types/types.js';\n\nimport {milliToMicro} from './Timing.js';\nimport {extractSampleTraceId, makeProfileCall, mergeEventsInOrder, sortTraceEventsInPlace} from './Trace.js';\n\n/**\n * This is a helper that integrates CPU profiling data coming in the\n * shape of samples, with trace events. Samples indicate what the JS\n * stack trace looked at a given point in time, but they don't have\n * duration. The SamplesIntegrator task is to make an approximation\n * of what the duration of each JS call was, given the sample data and\n * given the trace events profiled during that time. At the end of its\n * execution, the SamplesIntegrator returns an array of ProfileCalls\n * (under SamplesIntegrator::buildProfileCalls()), which\n * represent JS calls, with a call frame and duration. These calls have\n * the shape of a complete trace events and can be treated as flame\n * chart entries in the timeline.\n *\n * The approach to build the profile calls consists in tracking the\n * current stack as the following events happen (in order):\n * 1. A sample was done.\n * 2. A trace event started.\n * 3. A trace event ended.\n * Depending on the event and on the data that's coming with it the\n * stack is updated by adding or removing JS calls to it and updating\n * the duration of the calls in the tracking stack.\n *\n * note: Although this approach has been implemented since long ago, and\n * is relatively efficient (adds a complexity over the trace parsing of\n * O(n) where n is the number of samples) it has proven to be faulty.\n * It might be worthwhile experimenting with improvements or with a\n * completely different approach. Improving the approach is tracked in\n * crbug.com/1417439\n */\nexport class SamplesIntegrator {\n /**\n * The result of running the samples integrator. Holds the JS calls\n * with their approximated duration after integrating samples into the\n * trace event tree.\n */\n #constructedProfileCalls: Types.Events.SyntheticProfileCall[] = [];\n /**\n * tracks the state of the JS stack at each point in time to update\n * the profile call durations as new events arrive. This doesn't only\n * happen with new profile calls (in which case we would compare the\n * stack in them) but also with trace events (in which case we would\n * update the duration of the events we are tracking at the moment).\n */\n #currentJSStack: Types.Events.SyntheticProfileCall[] = [];\n /**\n * Process holding the CPU profile and trace events.\n */\n #processId: Types.Events.ProcessID;\n /**\n * Thread holding the CPU profile and trace events.\n */\n #threadId: Types.Events.ThreadID;\n /**\n * Tracks the depth of the JS stack at the moment a trace event starts\n * or ends. It is assumed that for the duration of a trace event, the\n * JS stack's depth cannot decrease, since JS calls that started\n * before a trace event cannot end during the trace event. So as trace\n * events arrive, we store the \"locked\" amount of JS frames that were\n * in the stack before the event came.\n */\n #lockedJsStackDepth: number[] = [];\n /**\n * Used to keep track when samples should be integrated even if they\n * are not children of invocation trace events. This is used in two cases:\n * 1. We start tracing half-way through, so we miss the start of JS\n * invocation events.\n * 2. On threads (like Web Workers) without real JS invocation parent events,\n * but where trace events (like SchedulePostMessage) integrate stack traces.\n * Enabling fake JS mode allows subsequent samples to be processed and\n * eventually correct the stack, preventing a deadlock.\n */\n #fakeJSInvocation = false;\n /**\n * The parsed CPU profile, holding the tree hierarchy of JS frames and\n * the sample data.\n */\n #profileModel: CPUProfile.CPUProfileDataModel.CPUProfileDataModel;\n /**\n * Because GC nodes don't have a stack, we artificially add a stack to\n * them which corresponds to that of the previous sample. This map\n * tracks which node is used for the stack of a GC call.\n * Note that GC samples are not shown in the flamechart, however they\n * are used during the construction of for profile calls, as we can\n * infer information about the duration of the executed code when a\n * GC node is sampled.\n */\n #nodeForGC = new Map<Types.Events.SyntheticProfileCall, CPUProfile.ProfileTreeModel.ProfileNode>();\n\n #engineConfig: Types.Configuration.Configuration;\n #profileId: Types.Events.ProfileID;\n\n /**\n * Keeps track of the individual samples from the CPU Profile.\n * Only used with Debug Mode experiment enabled.\n */\n jsSampleEvents: Types.Events.SyntheticJSSample[] = [];\n\n constructor(\n profileModel: CPUProfile.CPUProfileDataModel.CPUProfileDataModel, profileId: Types.Events.ProfileID,\n pid: Types.Events.ProcessID, tid: Types.Events.ThreadID, configuration?: Types.Configuration.Configuration) {\n this.#profileModel = profileModel;\n this.#threadId = tid;\n this.#processId = pid;\n this.#engineConfig = configuration || Types.Configuration.defaults();\n this.#profileId = profileId;\n }\n\n buildProfileCalls(traceEvents: Types.Events.Event[]): Types.Events.SyntheticProfileCall[] {\n const mergedEvents = mergeEventsInOrder(traceEvents, this.callsFromProfileSamples());\n const stack = [];\n for (let i = 0; i < mergedEvents.length; i++) {\n const event = mergedEvents[i];\n // Because instant trace events have no duration, they don't provide\n // useful information for possible changes in the duration of calls\n // in the JS stack.\n if (event.ph === Types.Events.Phase.INSTANT && !extractSampleTraceId(event)) {\n continue;\n }\n if (stack.length === 0) {\n if (Types.Events.isProfileCall(event)) {\n this.#onProfileCall(event);\n continue;\n }\n stack.push(event);\n this.#onTraceEventStart(event);\n continue;\n }\n\n const parentEvent = stack.at(-1);\n if (parentEvent === undefined) {\n continue;\n }\n const begin = event.ts;\n const parentBegin = parentEvent.ts;\n const parentDuration = parentEvent.dur || 0;\n const parentEnd = parentBegin + parentDuration;\n\n const startsAfterParent = begin >= parentEnd;\n if (startsAfterParent) {\n this.#onTraceEventEnd(parentEvent);\n stack.pop();\n i--;\n continue;\n }\n if (Types.Events.isProfileCall(event)) {\n this.#onProfileCall(event, parentEvent);\n continue;\n }\n this.#onTraceEventStart(event, parentEvent);\n stack.push(event);\n }\n while (stack.length) {\n const last = stack.pop();\n if (last) {\n this.#onTraceEventEnd(last);\n }\n }\n sortTraceEventsInPlace(this.jsSampleEvents);\n return this.#constructedProfileCalls;\n }\n\n #onTraceEventStart(event: Types.Events.Event, parent?: Types.Events.Event): void {\n // Top level events cannot be nested into JS frames so we reset\n // the stack when we find one.\n if (event.name === Types.Events.Name.RUN_MICROTASKS || event.name === Types.Events.Name.RUN_TASK) {\n this.#lockedJsStackDepth = [];\n this.#truncateJSStack(0, event.ts);\n this.#fakeJSInvocation = false;\n }\n\n if (this.#fakeJSInvocation) {\n this.#truncateJSStack(this.#lockedJsStackDepth.pop() || 0, event.ts);\n this.#fakeJSInvocation = false;\n }\n this.#extractStackTrace(event);\n if (extractSampleTraceId(event)) {\n const hasJSInvocationParent = parent && Types.Events.isJSInvocationEvent(parent);\n if (!hasJSInvocationParent) {\n // If the event has a sampleTraceId (meaning it has a stack trace) but\n // no JS invocation parent, we enter fake JS mode. This ensures that\n // subsequent samples on this thread are processed, allowing the stack\n // to be correctly updated/truncated. Without this, subsequent samples\n // would be ignored because the stack is non-empty but we are not\n // considered to be in JS.\n this.#fakeJSInvocation = true;\n }\n }\n // Keep track of the call frames in the stack before the event\n // happened. For the duration of this event, these frames cannot\n // change (none can be terminated before this event finishes).\n //\n // Also, every frame that is opened after this event, is considered\n // to be a descendant of the event. So once the event finishes, the\n // frames that were opened after it, need to be closed (see\n // onEndEvent).\n //\n // TODO(crbug.com/1417439):\n // The assumption that every frame opened after an event is a\n // descendant of the event is incorrect. For example, a JS call that\n // parents a trace event might have been sampled after the event was\n // dispatched. In this case the JS call would be discarded if this\n // event isn't an invocation event, otherwise the call will be\n // considered a child of the event. In both cases, the result would\n // be incorrect.\n this.#lockedJsStackDepth.push(this.#currentJSStack.length);\n }\n\n #onProfileCall(event: Types.Events.SyntheticProfileCall, parent?: Types.Events.Event): void {\n if ((parent && Types.Events.isJSInvocationEvent(parent)) || this.#fakeJSInvocation) {\n this.#extractStackTrace(event);\n } else if (Types.Events.isProfileCall(event) && this.#currentJSStack.length === 0) {\n // Force JS Samples to show up even if we are not inside a JS\n // invocation event, because we can be missing the start of JS\n // invocation events if we start tracing half-way through. Pretend\n // we have a top-level JS invocation event.\n this.#fakeJSInvocation = true;\n const stackDepthBefore = this.#currentJSStack.length;\n this.#extractStackTrace(event);\n this.#lockedJsStackDepth.push(stackDepthBefore);\n }\n }\n\n #onTraceEventEnd(event: Types.Events.Event): void {\n // Because the event has ended, any frames that happened after\n // this event are terminated. Frames that are ancestors to this\n // event are extended to cover its ending.\n const endTime = Types.Timing.Micro(event.ts + (event.dur ?? 0));\n this.#truncateJSStack(this.#lockedJsStackDepth.pop() || 0, endTime);\n }\n\n /**\n * Builds the initial calls with no duration from samples. Their\n * purpose is to be merged with the trace event array being parsed so\n * that they can be traversed in order with them and their duration\n * can be updated as the SampleIntegrator callbacks are invoked.\n */\n callsFromProfileSamples(): Types.Events.SyntheticProfileCall[] {\n const samples = this.#profileModel.samples;\n const timestamps = this.#profileModel.timestamps;\n if (!samples) {\n return [];\n }\n const calls: Types.Events.SyntheticProfileCall[] = [];\n let prevNode;\n for (let i = 0; i < samples.length; i++) {\n const node = this.#profileModel.nodeByIndex(i);\n const timestamp = milliToMicro(Types.Timing.Milli(timestamps[i]));\n if (!node) {\n continue;\n }\n const call = makeProfileCall(node, this.#profileId, i, timestamp, this.#processId, this.#threadId);\n calls.push(call);\n\n if (this.#engineConfig.debugMode) {\n const traceId = this.#profileModel.traceIds?.[i];\n this.jsSampleEvents.push(this.#makeJSSampleEvent(call, timestamp, traceId));\n }\n if (node.id === this.#profileModel.gcNode?.id && prevNode) {\n // GC samples have no stack, so we just put GC node on top of the\n // last recorded sample. Cache the previous sample for future\n // reference.\n this.#nodeForGC.set(call, prevNode);\n continue;\n }\n prevNode = node;\n }\n return calls;\n }\n\n /**\n * Given a synthetic profile call, returns an array of profile calls\n * representing the stack trace that profile call belongs to based on\n * its nodeId. The input profile call will be at the top of the\n * returned stack (last position), meaning that any other frames that\n * were effectively above it are omitted.\n * @param profileCall\n * @param overrideTimeStamp a custom timestamp to use for the returned\n * profile calls. If not defined, the timestamp of the input\n * profileCall is used instead. This param is useful for example when\n * creating the profile calls for a sample with a trace id, since the\n * timestamp of the corresponding trace event should be used instead\n * of the sample's.\n */\n\n #makeProfileCallsForStack(profileCall: Types.Events.SyntheticProfileCall, overrideTimeStamp?: Types.Timing.Micro):\n Types.Events.SyntheticProfileCall[] {\n let node = this.#profileModel.nodeById(profileCall.nodeId);\n const isGarbageCollection = node?.id === this.#profileModel.gcNode?.id;\n if (isGarbageCollection) {\n // Because GC don't have a stack, we use the stack of the previous\n // sample.\n node = this.#nodeForGC.get(profileCall) || null;\n }\n if (!node) {\n return [];\n }\n // `node.depth` is 0 based, so to set the size of the array we need\n // to add 1 to its value.\n const callFrames = new Array<Types.Events.SyntheticProfileCall>(node.depth + 1 + Number(isGarbageCollection));\n // Add the stack trace in reverse order (bottom first).\n let i = callFrames.length - 1;\n if (isGarbageCollection) {\n // Place the garbage collection call frame on top of the stack.\n callFrames[i--] = profileCall;\n }\n\n // Many of these ProfileCalls will be GC'd later when we estimate the frame\n // durations\n while (node) {\n callFrames[i--] = makeProfileCall(\n node, profileCall.profileId, profileCall.sampleIndex, overrideTimeStamp ?? profileCall.ts, this.#processId,\n this.#threadId);\n node = node.parent;\n }\n return callFrames;\n }\n\n #getStackForSampleTraceId(traceId: number, timestamp: Types.Timing.Micro): Types.Events.SyntheticProfileCall[]|null {\n const nodeId = this.#profileModel.traceIds?.[traceId];\n const node = nodeId && this.#profileModel.nodeById(nodeId);\n const maybeCallForTraceId =\n node && makeProfileCall(node, this.#profileId, -1, timestamp, this.#processId, this.#threadId);\n if (!maybeCallForTraceId) {\n return null;\n }\n if (this.#engineConfig.debugMode) {\n this.jsSampleEvents.push(this.#makeJSSampleEvent(maybeCallForTraceId, timestamp, traceId));\n }\n return this.#makeProfileCallsForStack(maybeCallForTraceId);\n }\n /**\n * Update tracked stack using this event's call stack.\n */\n #extractStackTrace(event: Types.Events.Event): void {\n let stackTrace = this.#currentJSStack;\n if (Types.Events.isProfileCall(event)) {\n stackTrace = this.#makeProfileCallsForStack(event);\n }\n const traceId = extractSampleTraceId(event);\n const maybeCallForTraceId = traceId && this.#getStackForSampleTraceId(traceId, event.ts);\n if (maybeCallForTraceId) {\n stackTrace = maybeCallForTraceId;\n }\n\n SamplesIntegrator.filterStackFrames(stackTrace, this.#engineConfig);\n\n const endTime = event.ts + (event.dur || 0);\n const minFrames = Math.min(stackTrace.length, this.#currentJSStack.length);\n let i;\n // Merge a sample's stack frames with the stack frames we have\n // so far if we detect they are equivalent.\n // Graphically\n // This:\n // Current stack trace Sample\n // [-------A------] [A]\n // [-------B------] [B]\n // [-------C------] [C]\n // ^ t = x1 ^ t = x2\n\n // Becomes this:\n // New stack trace after merge\n // [--------A-------]\n // [--------B-------]\n // [--------C-------]\n // ^ t = x2\n for (i = this.#lockedJsStackDepth.at(-1) || 0; i < minFrames; ++i) {\n const newFrame = stackTrace[i].callFrame;\n const oldFrame = this.#currentJSStack[i].callFrame;\n if (!SamplesIntegrator.framesAreEqual(newFrame, oldFrame)) {\n break;\n }\n // Scoot the right edge of this callFrame to the right\n this.#currentJSStack[i].dur =\n Types.Timing.Micro(Math.max(this.#currentJSStack[i].dur || 0, endTime - this.#currentJSStack[i].ts));\n }\n\n // If there are call frames in the sample that differ with the stack\n // we have, update the stack, but keeping the common frames in place\n // Graphically\n // This:\n // Current stack trace Sample\n // [-------A------] [A]\n // [-------B------] [B]\n // [-------C------] [C]\n // [-------D------] [E]\n // ^ t = x1 ^ t = x2\n // Becomes this:\n // New stack trace after merge\n // [--------A-------]\n // [--------B-------]\n // [--------C-------]\n // [E]\n // ^ t = x2\n this.#truncateJSStack(i, event.ts);\n\n for (; i < stackTrace.length; ++i) {\n const call = stackTrace[i];\n if (call.nodeId === this.#profileModel.programNode?.id || call.nodeId === this.#profileModel.root?.id ||\n call.nodeId === this.#profileModel.idleNode?.id || call.nodeId === this.#profileModel.gcNode?.id) {\n // Skip (root), (program) and (idle) frames, since this are not\n // relevant for web profiling and we don't want to show them in\n // the timeline.\n continue;\n }\n this.#currentJSStack.push(call);\n this.#constructedProfileCalls.push(call);\n }\n }\n\n /**\n * When a call stack that differs from the one we are tracking has\n * been detected in the samples, the latter is \"truncated\" by\n * setting the ending time of its call frames and removing the top\n * call frames that aren't shared with the new call stack. This way,\n * we can update the tracked stack with the new call frames on top.\n * @param depth the amount of call frames from bottom to top that\n * should be kept in the tracking stack trace. AKA amount of shared\n * call frames between two stacks.\n * @param time the new end of the call frames in the stack.\n */\n #truncateJSStack(depth: number, time: Types.Timing.Micro): void {\n if (this.#lockedJsStackDepth.length) {\n const lockedDepth = this.#lockedJsStackDepth.at(-1);\n if (lockedDepth && depth < lockedDepth) {\n console.error(`Child stack is shallower (${depth}) than the parent stack (${lockedDepth}) at ${time}`);\n depth = lockedDepth;\n }\n }\n if (this.#currentJSStack.length < depth) {\n console.error(`Trying to truncate higher than the current stack size at ${time}`);\n depth = this.#currentJSStack.length;\n }\n for (let k = 0; k < this.#currentJSStack.length; ++k) {\n this.#currentJSStack[k].dur = Types.Timing.Micro(Math.max(time - this.#currentJSStack[k].ts, 0));\n }\n this.#currentJSStack.length = depth;\n }\n\n #makeJSSampleEvent(call: Types.Events.SyntheticProfileCall, timestamp: Types.Timing.Micro, traceId?: number):\n Types.Events.SyntheticJSSample {\n const JSSampleEvent: Types.Events.SyntheticJSSample = {\n name: Types.Events.Name.JS_SAMPLE,\n cat: 'devtools.timeline',\n args: {\n data: {traceId, stackTrace: this.#makeProfileCallsForStack(call).map(e => e.callFrame)},\n },\n ph: Types.Events.Phase.INSTANT,\n ts: timestamp,\n dur: Types.Timing.Micro(0),\n pid: this.#processId,\n tid: this.#threadId,\n };\n return JSSampleEvent;\n }\n\n static framesAreEqual(frame1: Protocol.Runtime.CallFrame, frame2: Protocol.Runtime.CallFrame): boolean {\n return frame1.scriptId === frame2.scriptId && frame1.functionName === frame2.functionName &&\n frame1.lineNumber === frame2.lineNumber;\n }\n\n static showNativeName(name: string, runtimeCallStatsEnabled: boolean): boolean {\n return runtimeCallStatsEnabled && Boolean(SamplesIntegrator.nativeGroup(name));\n }\n\n static nativeGroup(nativeName: string): SamplesIntegrator.NativeGroups|null {\n if (nativeName.startsWith('Parse')) {\n return SamplesIntegrator.NativeGroups.PARSE;\n }\n if (nativeName.startsWith('Compile') || nativeName.startsWith('Recompile')) {\n return SamplesIntegrator.NativeGroups.COMPILE;\n }\n return null;\n }\n\n static isNativeRuntimeFrame(frame: Protocol.Runtime.CallFrame): boolean {\n return frame.url === 'native V8Runtime';\n }\n\n static filterStackFrames(stack: Types.Events.SyntheticProfileCall[], engineConfig: Types.Configuration.Configuration):\n void {\n const showAllEvents = engineConfig.showAllEvents;\n if (showAllEvents) {\n return;\n }\n let j = 0;\n for (let i = 0; i < stack.length; ++i) {\n const frame = stack[i].callFrame;\n const nativeRuntimeFrame = SamplesIntegrator.isNativeRuntimeFrame(frame);\n if (nativeRuntimeFrame) {\n continue;\n }\n stack[j++] = stack[i];\n }\n stack.length = j;\n }\n\n static createFakeTraceFromCpuProfile(profile: Protocol.Profiler.Profile, tid: Types.Events.ThreadID):\n Types.File.TraceFile {\n if (!profile) {\n return {traceEvents: [], metadata: {}};\n }\n // The |Name.CPU_PROFILE| will let MetaHandler to set |traceIsGeneric| to false\n // The start time and duration is important here because we'll use them to determine the traceBounds\n // We use the start and end time of the profile (which is longer than all samples), so the Performance\n // panel won't truncate this time period.\n const cpuProfileEvent: Types.Events.SyntheticCpuProfile = {\n cat: 'disabled-by-default-devtools.timeline',\n name: Types.Events.Name.CPU_PROFILE,\n ph: Types.Events.Phase.COMPLETE,\n pid: Types.Events.ProcessID(1),\n tid,\n ts: Types.Timing.Micro(profile.startTime),\n dur: Types.Timing.Micro(profile.endTime - profile.startTime),\n args: {data: {cpuProfile: profile}},\n // Create an arbitrary profile id.\n id: '0x1' as Types.Events.ProfileID,\n };\n\n return {\n traceEvents: [cpuProfileEvent],\n metadata: {\n dataOrigin: Types.File.DataOrigin.CPU_PROFILE,\n },\n };\n }\n\n static extractCpuProfileFromFakeTrace(traceEvents: readonly Types.Events.Event[]): Protocol.Profiler.Profile {\n const profileEvent = traceEvents.find(e => Types.Events.isSyntheticCpuProfile(e));\n const profile = profileEvent?.args.data.cpuProfile;\n if (!profile) {\n throw new Error('Missing cpuProfile data');\n }\n return profile;\n }\n}\n\nexport namespace SamplesIntegrator {\n export enum NativeGroups {\n COMPILE = 'Compile',\n PARSE = 'Parse',\n }\n}\n"]}