@paulirish/trace_engine 0.0.65 → 0.0.67-beta.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.
- package/README.md +19 -17
- package/analyze-trace.mjs +6 -144
- package/core/common/Base64.d.ts +12 -0
- package/core/common/CharacterIdMap.d.ts +5 -0
- package/core/common/Color.d.ts +357 -0
- package/core/common/ColorConverter.d.ts +26 -0
- package/core/common/ColorUtils.d.ts +45 -0
- package/core/common/Console.d.ts +54 -0
- package/core/common/Debouncer.d.ts +8 -0
- package/core/common/EventTarget.d.ts +22 -0
- package/core/common/Gzip.d.ts +23 -0
- package/core/common/JavaScriptMetaData.d.ts +20 -0
- package/core/common/Lazy.d.ts +4 -0
- package/core/common/MapWithDefault.d.ts +9 -0
- package/core/common/Mutex.d.ts +13 -0
- package/core/common/Object.d.ts +20 -0
- package/core/common/ParsedURL.d.ts +87 -0
- package/core/common/Progress.d.ts +47 -0
- package/core/common/ResolverBase.d.ts +29 -0
- package/core/common/ResourceType.d.ts +52 -0
- package/core/common/ReturnToPanel.d.ts +10 -0
- package/core/common/Revealer.d.ts +66 -0
- package/core/common/Runnable.d.ts +14 -0
- package/core/common/SegmentedRange.d.ts +14 -0
- package/core/common/SettingRegistration.d.ts +136 -0
- package/core/common/Settings.d.ts +226 -0
- package/core/common/SimpleHistoryManager.d.ts +20 -0
- package/core/common/Srcset.d.ts +16 -0
- package/core/common/StringOutputStream.d.ts +10 -0
- package/core/common/TextDictionary.d.ts +11 -0
- package/core/common/Throttler.d.ts +12 -0
- package/core/common/Trie.d.ts +24 -0
- package/core/common/VersionController.d.ts +85 -0
- package/core/common/common.d.ts +33 -1
- package/core/host/AidaClient.d.ts +73 -0
- package/core/host/AidaClientTypes.d.ts +355 -0
- package/core/host/AidaGcaTranslation.d.ts +10 -0
- package/core/host/DispatchHttpRequestClient.d.ts +14 -0
- package/core/host/GcaClient.d.ts +14 -0
- package/core/host/GcaTypes.d.ts +411 -0
- package/core/host/GdpClient.d.ts +84 -0
- package/core/host/InspectorFrontendHost.d.ts +29 -0
- package/core/host/InspectorFrontendHostAPI.d.ts +425 -0
- package/core/host/InspectorFrontendHostStub.d.ts +151 -0
- package/core/host/Platform.d.ts +11 -0
- package/core/host/ResourceLoader.d.ts +15 -0
- package/core/host/UserMetrics.d.ts +116 -0
- package/core/host/UserMetricsEnums.d.ts +883 -0
- package/core/host/host.d.ts +13 -1
- package/core/i18n/ByteUtilities.d.ts +11 -0
- package/core/i18n/DevToolsLocale.d.ts +41 -0
- package/core/i18n/NumberFormatter.d.ts +11 -0
- package/core/i18n/i18n.d.ts +10 -0
- package/core/i18n/i18nImpl.d.ts +64 -0
- package/core/i18n/i18nTypes.d.ts +5 -0
- package/core/i18n/locales.d.ts +15 -0
- package/core/i18n/time-utilities.d.ts +16 -0
- package/core/platform/ArrayUtilities.d.ts +5 -0
- package/core/platform/HostRuntime.d.ts +1 -0
- package/core/platform/Size.d.ts +12 -0
- package/core/platform/StringUtilities.d.ts +28 -0
- package/core/platform/TypescriptUtilities.d.ts +0 -6
- package/core/platform/api/HostRuntime.d.ts +25 -0
- package/core/platform/platform.d.ts +2 -1
- package/core/protocol_client/CDPConnection.d.ts +77 -0
- package/core/protocol_client/ConnectionTransport.d.ts +9 -0
- package/core/protocol_client/DevToolsCDPConnection.d.ts +16 -0
- package/core/protocol_client/InspectorBackend.d.ts +223 -0
- package/core/protocol_client/protocol_client.d.ts +5 -0
- package/core/root/DevToolsContext.d.ts +34 -0
- package/core/root/ExperimentNames.d.ts +8 -0
- package/core/root/Runtime.d.ts +351 -0
- package/core/root/root.d.ts +4 -1
- package/core/sdk/AccessibilityModel.d.ts +76 -0
- package/core/sdk/AnimationModel.d.ts +161 -0
- package/core/sdk/AutofillModel.d.ts +23 -0
- package/core/sdk/CPUProfilerModel.d.ts +46 -0
- package/core/sdk/CPUThrottlingManager.d.ts +47 -0
- package/core/sdk/CSSContainerQuery.d.ts +42 -0
- package/core/sdk/CSSFontFace.d.ts +10 -0
- package/core/sdk/CSSLayer.d.ts +9 -0
- package/core/sdk/CSSLocation.d.ts +14 -0
- package/core/sdk/CSSMatchedStyles.d.ts +138 -0
- package/core/sdk/CSSMedia.d.ts +36 -0
- package/core/sdk/CSSMetadata.d.ts +87 -0
- package/core/sdk/CSSModel.d.ts +180 -0
- package/core/sdk/CSSNavigation.d.ts +10 -0
- package/core/sdk/CSSProperty.d.ts +53 -0
- package/core/sdk/CSSPropertyParser.d.ts +131 -0
- package/core/sdk/CSSPropertyParserMatchers.d.ts +442 -0
- package/core/sdk/CSSQuery.d.ts +22 -0
- package/core/sdk/CSSRule.d.ts +132 -0
- package/core/sdk/CSSScope.d.ts +9 -0
- package/core/sdk/CSSStartingStyle.d.ts +9 -0
- package/core/sdk/CSSStyleDeclaration.d.ts +38 -0
- package/core/sdk/CSSStyleSheetHeader.d.ts +53 -0
- package/core/sdk/CSSSupports.d.ts +10 -0
- package/core/sdk/CategorizedBreakpoint.d.ts +42 -0
- package/core/sdk/ChildTargetManager.d.ts +40 -0
- package/core/sdk/CompilerSourceMappingContentProvider.d.ts +12 -0
- package/core/sdk/Connections.d.ts +36 -0
- package/core/sdk/ConsoleModel.d.ts +127 -0
- package/core/sdk/ConsoleModelTypes.d.ts +6 -0
- package/core/sdk/Cookie.d.ts +68 -0
- package/core/sdk/CookieModel.d.ts +31 -0
- package/core/sdk/CookieParser.d.ts +14 -0
- package/core/sdk/CrashReportContextModel.d.ts +8 -0
- package/core/sdk/DOMDebuggerModel.d.ts +127 -0
- package/core/sdk/DOMModel.d.ts +436 -0
- package/core/sdk/DOMStorageModel.d.ts +79 -0
- package/core/sdk/DebuggerModel.d.ts +272 -0
- package/core/sdk/EmulationModel.d.ts +95 -0
- package/core/sdk/EnhancedTracesParser.d.ts +105 -0
- package/core/sdk/EventBreakpointsModel.d.ts +66 -0
- package/core/sdk/FrameAssociated.d.ts +6 -0
- package/core/sdk/FrameManager.d.ts +68 -0
- package/core/sdk/HeapProfilerModel.d.ts +75 -0
- package/core/sdk/HttpReasonPhraseStrings.d.ts +5 -0
- package/core/sdk/IOModel.d.ts +10 -0
- package/core/sdk/IsolateManager.d.ts +53 -0
- package/core/sdk/IssuesModel.d.ts +28 -0
- package/core/sdk/LayerTreeBase.d.ts +70 -0
- package/core/sdk/LogModel.d.ts +20 -0
- package/core/sdk/NetworkManager.d.ts +418 -0
- package/core/sdk/NetworkRequest.d.ts +469 -0
- package/core/sdk/NetworkRequestAccess.d.ts +91 -0
- package/core/sdk/OverlayColorGenerator.d.ts +14 -0
- package/core/sdk/OverlayModel.d.ts +186 -0
- package/core/sdk/OverlayPersistentHighlighter.d.ts +116 -0
- package/core/sdk/PageFunctions.d.ts +22 -0
- package/core/sdk/PageLoad.d.ts +14 -0
- package/core/sdk/PageResourceLoader.d.ts +111 -0
- package/core/sdk/PaintProfiler.d.ts +43 -0
- package/core/sdk/PerformanceMetricsModel.d.ts +12 -0
- package/core/sdk/PreloadingModel.d.ts +146 -0
- package/core/sdk/RehydratingConnection.d.ts +73 -0
- package/core/sdk/RehydratingObject.d.ts +59 -0
- package/core/sdk/RemoteObject.d.ts +210 -0
- package/core/sdk/Resource.d.ts +36 -0
- package/core/sdk/ResourceTreeModel.d.ts +278 -0
- package/core/sdk/RuntimeModel.d.ts +163 -0
- package/core/sdk/SDKModel.d.ts +30 -0
- package/core/sdk/SDKSettings.d.ts +53 -0
- package/core/sdk/ScopeTreeCache.d.ts +21 -0
- package/core/sdk/ScreenCaptureModel.d.ts +69 -0
- package/core/sdk/Script.d.ts +134 -0
- package/core/sdk/SecurityOrigin.d.ts +108 -0
- package/core/sdk/SecurityOriginManager.d.ts +23 -0
- package/core/sdk/ServerSentEvents.d.ts +18 -0
- package/core/sdk/ServerSentEventsProtocol.d.ts +18 -0
- package/core/sdk/ServerTiming.d.ts +24 -0
- package/core/sdk/ServiceWorkerCacheModel.d.ts +71 -0
- package/core/sdk/ServiceWorkerManager.d.ts +125 -0
- package/core/sdk/SourceMap.d.ts +197 -0
- package/core/sdk/SourceMapCache.d.ts +12 -0
- package/core/sdk/SourceMapFunctionRanges.d.ts +26 -0
- package/core/sdk/SourceMapManager.d.ts +46 -0
- package/core/sdk/SourceMapRangeMappings.d.ts +15 -0
- package/core/sdk/SourceMapScopeChainEntry.d.ts +23 -0
- package/core/sdk/SourceMapScopesInfo.d.ts +109 -0
- package/core/sdk/StorageBucketsModel.d.ts +48 -0
- package/core/sdk/StorageKeyManager.d.ts +38 -0
- package/core/sdk/Target.d.ts +79 -0
- package/core/sdk/TargetManager.d.ts +92 -0
- package/core/sdk/TraceObject.d.ts +43 -0
- package/core/sdk/WebAuthnModel.d.ts +29 -0
- package/core/sdk/sdk.d.ts +97 -1
- package/core/text_utils/CodeMirrorUtils.d.ts +3 -0
- package/core/text_utils/ContentData.d.ts +94 -0
- package/core/text_utils/ContentProvider.d.ts +42 -0
- package/core/text_utils/StaticContentProvider.d.ts +13 -0
- package/core/text_utils/StreamingContentData.d.ts +49 -0
- package/core/text_utils/Text.d.ts +19 -0
- package/core/text_utils/TextCursor.d.ts +9 -0
- package/core/text_utils/TextRange.d.ts +81 -0
- package/core/text_utils/TextUtils.d.ts +97 -0
- package/core/text_utils/WasmDisassembly.d.ts +29 -0
- package/core/text_utils/text_utils.d.ts +11 -0
- package/entrypoints/formatter_actions/formatter_actions.d.ts +48 -0
- package/generated/InspectorBackendCommands.d.ts +14 -0
- package/generated/SupportedCSSProperties.d.ts +18 -0
- package/generated/protocol-mapping.d.ts +5930 -0
- package/generated/protocol-proxy-api.d.ts +5396 -0
- package/generated/protocol.d.ts +736 -685
- package/index.js +6 -0
- package/locales/af.json +80 -62
- package/locales/am.json +363 -345
- package/locales/ar.json +364 -346
- package/locales/as.json +362 -344
- package/locales/az.json +353 -335
- package/locales/be.json +363 -345
- package/locales/bg.json +363 -345
- package/locales/bn.json +363 -345
- package/locales/bs.json +259 -241
- package/locales/ca.json +295 -277
- package/locales/cs.json +348 -330
- package/locales/cy.json +139 -121
- package/locales/da.json +222 -204
- package/locales/de.json +234 -216
- package/locales/el.json +348 -330
- package/locales/en-GB.json +36 -18
- package/locales/es-419.json +290 -272
- package/locales/es.json +292 -274
- package/locales/et.json +251 -233
- package/locales/eu.json +29 -11
- package/locales/fa.json +363 -345
- package/locales/fi.json +295 -277
- package/locales/fil.json +29 -11
- package/locales/fr-CA.json +320 -302
- package/locales/fr.json +317 -299
- package/locales/gl.json +276 -258
- package/locales/gu.json +364 -346
- package/locales/he.json +364 -346
- package/locales/hi.json +348 -330
- package/locales/hr.json +250 -232
- package/locales/hu.json +354 -336
- package/locales/hy.json +363 -345
- package/locales/id.json +27 -9
- package/locales/is.json +317 -299
- package/locales/it.json +154 -136
- package/locales/ja.json +363 -345
- package/locales/ka.json +364 -346
- package/locales/kk.json +364 -346
- package/locales/km.json +363 -345
- package/locales/kn.json +364 -346
- package/locales/ko.json +363 -345
- package/locales/ky.json +362 -344
- package/locales/lo.json +364 -346
- package/locales/lt.json +331 -313
- package/locales/lv.json +331 -313
- package/locales/mk.json +364 -346
- package/locales/ml.json +363 -345
- package/locales/mn.json +363 -345
- package/locales/mr.json +363 -345
- package/locales/ms.json +27 -9
- package/locales/my.json +362 -344
- package/locales/ne.json +348 -330
- package/locales/nl.json +84 -66
- package/locales/no.json +188 -170
- package/locales/or.json +363 -345
- package/locales/pa.json +363 -345
- package/locales/pl.json +322 -304
- package/locales/pt-PT.json +284 -266
- package/locales/pt.json +283 -265
- package/locales/ro.json +318 -300
- package/locales/ru.json +363 -345
- package/locales/si.json +364 -346
- package/locales/sk.json +345 -327
- package/locales/sl.json +231 -213
- package/locales/sq.json +329 -311
- package/locales/sr-Latn.json +267 -249
- package/locales/sr.json +364 -346
- package/locales/sv.json +296 -278
- package/locales/sw.json +35 -17
- package/locales/ta.json +364 -346
- package/locales/te.json +362 -344
- package/locales/th.json +364 -346
- package/locales/tr.json +337 -319
- package/locales/uk.json +363 -345
- package/locales/ur.json +364 -346
- package/locales/uz.json +175 -157
- package/locales/vi.json +364 -346
- package/locales/zh-HK.json +364 -346
- package/locales/zh-TW.json +363 -345
- package/locales/zh.json +363 -345
- package/locales/zu.json +35 -17
- package/models/crux-manager/CrUXManager.d.ts +107 -0
- package/models/crux-manager/crux-manager.d.ts +1 -0
- package/models/emulation/DeviceModeModel.d.ts +156 -0
- package/models/emulation/EmulatedDevices.d.ts +148 -0
- package/models/emulation/emulation.d.ts +3 -0
- package/models/formatter/FormatterWorkerPool.d.ts +58 -0
- package/models/formatter/ScriptFormatter.d.ts +11 -0
- package/models/formatter/formatter.d.ts +3 -0
- package/models/trace/ModelImpl.d.ts +2 -6
- package/models/trace/Processor.d.ts +2 -6
- package/models/trace/extras/StackTraceForEvent.d.ts +1 -1
- package/models/trace/extras/extras.d.ts +2 -7
- package/models/trace/handlers/FramesHandler.d.ts +1 -2
- package/models/trace/handlers/LayoutShiftsHandler.d.ts +2 -2
- package/models/trace/handlers/MetaHandler.d.ts +2 -3
- package/models/trace/handlers/ModelHandlers.d.ts +0 -1
- package/models/trace/handlers/PageLoadMetricsHandler.d.ts +2 -0
- package/models/trace/handlers/ScriptsHandler.d.ts +2 -2
- package/models/trace/handlers/Threads.d.ts +1 -3
- package/models/trace/handlers/UserTimingsHandler.d.ts +1 -1
- package/models/trace/helpers/Network.d.ts +3 -1
- package/models/trace/helpers/SyntheticEvents.d.ts +7 -0
- package/models/trace/insights/CLSCulprits.d.ts +6 -3
- package/models/trace/insights/Cache.d.ts +2 -1
- package/models/trace/insights/CharacterSet.d.ts +5 -4
- package/models/trace/insights/Common.d.ts +4 -4
- package/models/trace/insights/DOMSize.d.ts +4 -3
- package/models/trace/insights/DocumentLatency.d.ts +2 -1
- package/models/trace/insights/DuplicatedJavaScript.d.ts +9 -4
- package/models/trace/insights/FontDisplay.d.ts +11 -5
- package/models/trace/insights/ForcedReflow.d.ts +6 -6
- package/models/trace/insights/INPBreakdown.d.ts +5 -5
- package/models/trace/insights/ImageDelivery.d.ts +7 -7
- package/models/trace/insights/LCPBreakdown.d.ts +4 -3
- package/models/trace/insights/LCPDiscovery.d.ts +7 -6
- package/models/trace/insights/LegacyJavaScript.d.ts +9 -4
- package/models/trace/insights/ModernHTTP.d.ts +6 -6
- package/models/trace/insights/NetworkDependencyTree.d.ts +18 -96
- package/models/trace/insights/RenderBlocking.d.ts +4 -3
- package/models/trace/insights/SlowCSSSelector.d.ts +10 -9
- package/models/trace/insights/ThirdParties.d.ts +17 -8
- package/models/trace/insights/Viewport.d.ts +6 -4
- package/models/trace/insights/types.d.ts +10 -7
- package/models/trace/lantern/lantern.js +6 -8
- package/models/trace/lantern/simulation/Constants.d.ts +29 -28
- package/models/trace/trace.js +529 -18
- package/models/trace/types/Configuration.d.ts +12 -1
- package/models/trace/types/File.d.ts +6 -5
- package/models/trace/types/Overlays.d.ts +13 -3
- package/models/trace/types/Timing.js +6 -14
- package/models/trace/types/TraceEvents.d.ts +48 -18
- package/models/trace/types/TraceEvents.js +187 -884
- package/models/trace/types/types.js +6 -8
- package/package.json +30 -9
- package/third_party/codemirror.next/codemirror.next.d.ts +9196 -0
- package/third_party/i18n/i18n-impl.d.ts +25 -0
- package/third_party/i18n/i18n.d.ts +3 -0
- package/third_party/i18n/localized-string-set.d.ts +49 -0
- package/third_party/intl-messageformat/intl-messageformat.d.ts +1 -0
- package/third_party/legacy-javascript/legacy-javascript.d.ts +2 -1
- package/third_party/legacy-javascript/lib/legacy-javascript.d.ts +18 -0
- package/third_party/source-map-scopes-codec/package/src/builder/builder.d.ts +67 -0
- package/third_party/source-map-scopes-codec/package/src/builder/safe_builder.d.ts +38 -0
- package/third_party/source-map-scopes-codec/package/src/codec.d.ts +48 -0
- package/third_party/source-map-scopes-codec/package/src/decode/decode.d.ts +31 -0
- package/third_party/source-map-scopes-codec/package/src/encode/encode.d.ts +8 -0
- package/third_party/source-map-scopes-codec/package/src/encode/encoder.d.ts +6 -0
- package/third_party/source-map-scopes-codec/package/src/mod.d.ts +5 -0
- package/third_party/source-map-scopes-codec/package/src/scopes.d.ts +168 -0
- package/third_party/source-map-scopes-codec/package/src/util.d.ts +5 -0
- package/third_party/source-map-scopes-codec/package/src/vlq.d.ts +14 -0
- package/third_party/source-map-scopes-codec/source-map-scopes-codec.d.ts +1 -0
- package/third_party/third-party-web/lib/nostats-subset.d.ts +2 -0
- package/third_party/third-party-web/package/lib/index.d.ts +34 -0
- package/third_party/third-party-web/package/lib/subsets/nostats.d.ts +1 -0
- package/third_party/third-party-web/third-party-web.d.ts +2 -1
- package/.tmp/tsbuildinfo/analyze-inspector-issues.d.mts +0 -13
- package/.tmp/tsbuildinfo/analyze-inspector-issues.d.mts.map +0 -1
- package/.tmp/tsbuildinfo/analyze-trace.d.mts +0 -17
- package/.tmp/tsbuildinfo/analyze-trace.d.mts.map +0 -1
- package/.tmp/tsbuildinfo/models/trace/extras/polyfills.d.ts +0 -4
- package/.tmp/tsbuildinfo/models/trace/extras/polyfills.d.ts.map +0 -1
- package/.tmp/tsbuildinfo/test/test-trace-engine.d.mts +0 -2
- package/.tmp/tsbuildinfo/test/test-trace-engine.d.mts.map +0 -1
- package/.tmp/tsbuildinfo/third_party/third-party-web/third-party-web.d.ts +0 -3
- package/.tmp/tsbuildinfo/third_party/third-party-web/third-party-web.d.ts.map +0 -1
- package/.tmp/tsbuildinfo/tsconfig.tsbuildinfo +0 -1
- package/analyze-inspector-issues.mjs +0 -60
- package/core/common/common.js +0 -1
- package/core/host/host.js +0 -1
- package/core/platform/ArrayUtilities.js +0 -210
- package/core/platform/ArrayUtilities.js.map +0 -1
- package/core/platform/Brand.js +0 -5
- package/core/platform/Brand.js.map +0 -1
- package/core/platform/Constructor.js +0 -5
- package/core/platform/Constructor.js.map +0 -1
- package/core/platform/DateUtilities.js +0 -14
- package/core/platform/DateUtilities.js.map +0 -1
- package/core/platform/DevToolsPath.js +0 -28
- package/core/platform/DevToolsPath.js.map +0 -1
- package/core/platform/HostRuntime.js +0 -31
- package/core/platform/HostRuntime.js.map +0 -1
- package/core/platform/KeyboardUtilities.js +0 -22
- package/core/platform/KeyboardUtilities.js.map +0 -1
- package/core/platform/MapUtilities.js +0 -80
- package/core/platform/MapUtilities.js.map +0 -1
- package/core/platform/MimeType.js +0 -144
- package/core/platform/MimeType.js.map +0 -1
- package/core/platform/NumberUtilities.js +0 -73
- package/core/platform/NumberUtilities.js.map +0 -1
- package/core/platform/StringUtilities.js +0 -594
- package/core/platform/StringUtilities.js.map +0 -1
- package/core/platform/Timing.js +0 -10
- package/core/platform/Timing.js.map +0 -1
- package/core/platform/TypedArrayUtilities.js +0 -158
- package/core/platform/TypedArrayUtilities.js.map +0 -1
- package/core/platform/TypescriptUtilities.js +0 -25
- package/core/platform/TypescriptUtilities.js.map +0 -1
- package/core/platform/UIString.js +0 -5
- package/core/platform/UIString.js.map +0 -1
- package/core/platform/UserVisibleError.js +0 -23
- package/core/platform/UserVisibleError.js.map +0 -1
- package/core/platform/api/HostRuntime.js +0 -5
- package/core/platform/api/HostRuntime.js.map +0 -1
- package/core/platform/api/api-tsconfig.json +0 -43
- package/core/platform/api/api.js +0 -6
- package/core/platform/api/api.js.map +0 -1
- package/core/platform/api/api_node_typecheck-tsconfig.json +0 -48
- package/core/platform/api/bundle-tsconfig.json +0 -1
- package/core/platform/api/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
- package/core/platform/browser/HostRuntime.js +0 -75
- package/core/platform/browser/HostRuntime.js.map +0 -1
- package/core/platform/browser/browser-tsconfig.json +0 -48
- package/core/platform/browser/browser.js +0 -6
- package/core/platform/browser/browser.js.map +0 -1
- package/core/platform/browser/bundle-tsconfig.json +0 -1
- package/core/platform/browser/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
- package/core/platform/bundle-tsconfig.json +0 -1
- package/core/platform/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
- package/core/platform/node/HostRuntime.js +0 -82
- package/core/platform/node/HostRuntime.js.map +0 -1
- package/core/platform/node/bundle-tsconfig.json +0 -1
- package/core/platform/node/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
- package/core/platform/node/node-tsconfig.json +0 -52
- package/core/platform/node/node.js +0 -6
- package/core/platform/node/node.js.map +0 -1
- package/core/platform/platform-tsconfig.json +0 -69
- package/core/platform/platform.js +0 -27
- package/core/platform/platform.js.map +0 -1
- package/core/platform/platform_node_typecheck-tsconfig.json +0 -74
- package/core/root/root.js +0 -1
- package/core/sdk/sdk.js +0 -1
- package/generated/protocol.js +0 -5
- package/locales/en-US.json +0 -1046
- package/locales/en-XL.json +0 -1046
- package/models/cpu_profile/CPUProfileDataModel.js +0 -517
- package/models/cpu_profile/CPUProfileDataModel.js.map +0 -1
- package/models/cpu_profile/ProfileTreeModel.js +0 -90
- package/models/cpu_profile/ProfileTreeModel.js.map +0 -1
- package/models/cpu_profile/bundle-tsconfig.json +0 -1
- package/models/cpu_profile/cpu_profile-tsconfig.json +0 -52
- package/models/cpu_profile/cpu_profile.js +0 -7
- package/models/cpu_profile/cpu_profile.js.map +0 -1
- package/models/cpu_profile/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
- package/models/issues_manager/CheckFormsIssuesTrigger.d.ts +0 -1
- package/models/issues_manager/CheckFormsIssuesTrigger.js +0 -1
- package/models/issues_manager/ContrastCheckTrigger.d.ts +0 -1
- package/models/issues_manager/ContrastCheckTrigger.js +0 -1
- package/models/issues_manager/DeprecationIssue.d.ts +0 -1
- package/models/issues_manager/DeprecationIssue.js +0 -1
- package/models/issues_manager/IssueResolver.d.ts +0 -1
- package/models/issues_manager/IssueResolver.js +0 -1
- package/models/issues_manager/RelatedIssue.d.ts +0 -1
- package/models/issues_manager/RelatedIssue.js +0 -1
- package/models/issues_manager/SourceFrameIssuesManager.d.ts +0 -1
- package/models/issues_manager/SourceFrameIssuesManager.js +0 -1
- package/models/trace/EntityMapper.js +0 -133
- package/models/trace/EntityMapper.js.map +0 -1
- package/models/trace/EventsSerializer.js +0 -90
- package/models/trace/EventsSerializer.js.map +0 -1
- package/models/trace/LanternComputationData.js +0 -367
- package/models/trace/LanternComputationData.js.map +0 -1
- package/models/trace/LegacyTracingModel.d.ts +0 -1
- package/models/trace/LegacyTracingModel.js +0 -1
- package/models/trace/ModelImpl.js +0 -170
- package/models/trace/ModelImpl.js.map +0 -1
- package/models/trace/Name.js +0 -115
- package/models/trace/Name.js.map +0 -1
- package/models/trace/Processor.js +0 -556
- package/models/trace/Processor.js.map +0 -1
- package/models/trace/Styles.js +0 -824
- package/models/trace/Styles.js.map +0 -1
- package/models/trace/TracingManager.d.ts +0 -1
- package/models/trace/TracingManager.js +0 -1
- package/models/trace/bundle-tsconfig.json +0 -1
- package/models/trace/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -66
- package/models/trace/extras/FilmStrip.js +0 -45
- package/models/trace/extras/FilmStrip.js.map +0 -1
- package/models/trace/extras/Initiators.js +0 -47
- package/models/trace/extras/Initiators.js.map +0 -1
- package/models/trace/extras/MainThreadActivity.js +0 -77
- package/models/trace/extras/MainThreadActivity.js.map +0 -1
- package/models/trace/extras/ScriptDuplication.js +0 -163
- package/models/trace/extras/ScriptDuplication.js.map +0 -1
- package/models/trace/extras/StackTraceForEvent.js +0 -192
- package/models/trace/extras/StackTraceForEvent.js.map +0 -1
- package/models/trace/extras/ThirdParties.js +0 -119
- package/models/trace/extras/ThirdParties.js.map +0 -1
- package/models/trace/extras/TraceFilter.js +0 -51
- package/models/trace/extras/TraceFilter.js.map +0 -1
- package/models/trace/extras/TraceTree.js +0 -621
- package/models/trace/extras/TraceTree.js.map +0 -1
- package/models/trace/extras/bundle-tsconfig.json +0 -1
- package/models/trace/extras/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
- package/models/trace/extras/extras-tsconfig.json +0 -70
- package/models/trace/extras/extras.js +0 -13
- package/models/trace/extras/extras.js.map +0 -1
- package/models/trace/handlers/AnimationFramesHandler.js +0 -110
- package/models/trace/handlers/AnimationFramesHandler.js.map +0 -1
- package/models/trace/handlers/AnimationHandler.js +0 -27
- package/models/trace/handlers/AnimationHandler.js.map +0 -1
- package/models/trace/handlers/AsyncJSCallsHandler.js +0 -188
- package/models/trace/handlers/AsyncJSCallsHandler.js.map +0 -1
- package/models/trace/handlers/AuctionWorkletsHandler.d.ts +0 -8
- package/models/trace/handlers/AuctionWorkletsHandler.js +0 -163
- package/models/trace/handlers/AuctionWorkletsHandler.js.map +0 -1
- package/models/trace/handlers/DOMStatsHandler.js +0 -22
- package/models/trace/handlers/DOMStatsHandler.js.map +0 -1
- package/models/trace/handlers/ExtensionTraceDataHandler.js +0 -264
- package/models/trace/handlers/ExtensionTraceDataHandler.js.map +0 -1
- package/models/trace/handlers/FlowsHandler.js +0 -149
- package/models/trace/handlers/FlowsHandler.js.map +0 -1
- package/models/trace/handlers/FramesHandler.js +0 -492
- package/models/trace/handlers/FramesHandler.js.map +0 -1
- package/models/trace/handlers/GPUHandler.js +0 -36
- package/models/trace/handlers/GPUHandler.js.map +0 -1
- package/models/trace/handlers/ImagePaintingHandler.js +0 -148
- package/models/trace/handlers/ImagePaintingHandler.js.map +0 -1
- package/models/trace/handlers/InitiatorsHandler.js +0 -181
- package/models/trace/handlers/InitiatorsHandler.js.map +0 -1
- package/models/trace/handlers/InvalidationsHandler.js +0 -127
- package/models/trace/handlers/InvalidationsHandler.js.map +0 -1
- package/models/trace/handlers/LargestImagePaintHandler.js +0 -86
- package/models/trace/handlers/LargestImagePaintHandler.js.map +0 -1
- package/models/trace/handlers/LargestTextPaintHandler.js +0 -28
- package/models/trace/handlers/LargestTextPaintHandler.js.map +0 -1
- package/models/trace/handlers/LayerTreeHandler.js +0 -104
- package/models/trace/handlers/LayerTreeHandler.js.map +0 -1
- package/models/trace/handlers/LayoutShiftsHandler.js +0 -458
- package/models/trace/handlers/LayoutShiftsHandler.js.map +0 -1
- package/models/trace/handlers/MemoryHandler.js +0 -22
- package/models/trace/handlers/MemoryHandler.js.map +0 -1
- package/models/trace/handlers/MetaHandler.js +0 -411
- package/models/trace/handlers/MetaHandler.js.map +0 -1
- package/models/trace/handlers/ModelHandlers.js +0 -34
- package/models/trace/handlers/ModelHandlers.js.map +0 -1
- package/models/trace/handlers/NetworkRequestsHandler.js +0 -576
- package/models/trace/handlers/NetworkRequestsHandler.js.map +0 -1
- package/models/trace/handlers/PageFramesHandler.js +0 -43
- package/models/trace/handlers/PageFramesHandler.js.map +0 -1
- package/models/trace/handlers/PageLoadMetricsHandler.js +0 -423
- package/models/trace/handlers/PageLoadMetricsHandler.js.map +0 -1
- package/models/trace/handlers/RendererHandler.js +0 -347
- package/models/trace/handlers/RendererHandler.js.map +0 -1
- package/models/trace/handlers/SamplesHandler.js +0 -261
- package/models/trace/handlers/SamplesHandler.js.map +0 -1
- package/models/trace/handlers/ScreenshotsHandler.js +0 -98
- package/models/trace/handlers/ScreenshotsHandler.js.map +0 -1
- package/models/trace/handlers/ScriptsHandler.js +0 -286
- package/models/trace/handlers/ScriptsHandler.js.map +0 -1
- package/models/trace/handlers/SelectorStatsHandler.js +0 -72
- package/models/trace/handlers/SelectorStatsHandler.js.map +0 -1
- package/models/trace/handlers/Threads.js +0 -112
- package/models/trace/handlers/Threads.js.map +0 -1
- package/models/trace/handlers/UserInteractionsHandler.js +0 -319
- package/models/trace/handlers/UserInteractionsHandler.js.map +0 -1
- package/models/trace/handlers/UserTimingsHandler.js +0 -184
- package/models/trace/handlers/UserTimingsHandler.js.map +0 -1
- package/models/trace/handlers/WarningsHandler.js +0 -135
- package/models/trace/handlers/WarningsHandler.js.map +0 -1
- package/models/trace/handlers/WorkersHandler.js +0 -34
- package/models/trace/handlers/WorkersHandler.js.map +0 -1
- package/models/trace/handlers/bundle-tsconfig.json +0 -1
- package/models/trace/handlers/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
- package/models/trace/handlers/handlers-tsconfig.json +0 -102
- package/models/trace/handlers/handlers.js +0 -8
- package/models/trace/handlers/handlers.js.map +0 -1
- package/models/trace/handlers/helpers.js +0 -164
- package/models/trace/handlers/helpers.js.map +0 -1
- package/models/trace/handlers/types.js +0 -2
- package/models/trace/handlers/types.js.map +0 -1
- package/models/trace/helpers/Extensions.js +0 -42
- package/models/trace/helpers/Extensions.js.map +0 -1
- package/models/trace/helpers/Network.js +0 -103
- package/models/trace/helpers/Network.js.map +0 -1
- package/models/trace/helpers/SamplesIntegrator.js +0 -496
- package/models/trace/helpers/SamplesIntegrator.js.map +0 -1
- package/models/trace/helpers/SyntheticEvents.js +0 -75
- package/models/trace/helpers/SyntheticEvents.js.map +0 -1
- package/models/trace/helpers/Timing.js +0 -194
- package/models/trace/helpers/Timing.js.map +0 -1
- package/models/trace/helpers/Trace.js +0 -817
- package/models/trace/helpers/Trace.js.map +0 -1
- package/models/trace/helpers/TreeHelpers.js +0 -255
- package/models/trace/helpers/TreeHelpers.js.map +0 -1
- package/models/trace/helpers/bundle-tsconfig.json +0 -1
- package/models/trace/helpers/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
- package/models/trace/helpers/helpers-tsconfig.json +0 -69
- package/models/trace/helpers/helpers.js +0 -11
- package/models/trace/helpers/helpers.js.map +0 -1
- package/models/trace/insights/CLSCulprits.js +0 -518
- package/models/trace/insights/CLSCulprits.js.map +0 -1
- package/models/trace/insights/Cache.js +0 -210
- package/models/trace/insights/Cache.js.map +0 -1
- package/models/trace/insights/CharacterSet.js +0 -132
- package/models/trace/insights/CharacterSet.js.map +0 -1
- package/models/trace/insights/Common.js +0 -348
- package/models/trace/insights/Common.js.map +0 -1
- package/models/trace/insights/DOMSize.js +0 -182
- package/models/trace/insights/DOMSize.js.map +0 -1
- package/models/trace/insights/DocumentLatency.js +0 -259
- package/models/trace/insights/DocumentLatency.js.map +0 -1
- package/models/trace/insights/DuplicatedJavaScript.js +0 -95
- package/models/trace/insights/DuplicatedJavaScript.js.map +0 -1
- package/models/trace/insights/FontDisplay.js +0 -87
- package/models/trace/insights/FontDisplay.js.map +0 -1
- package/models/trace/insights/ForcedReflow.js +0 -162
- package/models/trace/insights/ForcedReflow.js.map +0 -1
- package/models/trace/insights/INPBreakdown.js +0 -130
- package/models/trace/insights/INPBreakdown.js.map +0 -1
- package/models/trace/insights/ImageDelivery.js +0 -264
- package/models/trace/insights/ImageDelivery.js.map +0 -1
- package/models/trace/insights/LCPBreakdown.js +0 -200
- package/models/trace/insights/LCPBreakdown.js.map +0 -1
- package/models/trace/insights/LCPDiscovery.js +0 -190
- package/models/trace/insights/LCPDiscovery.js.map +0 -1
- package/models/trace/insights/LegacyJavaScript.js +0 -95
- package/models/trace/insights/LegacyJavaScript.js.map +0 -1
- package/models/trace/insights/Models.js +0 -23
- package/models/trace/insights/Models.js.map +0 -1
- package/models/trace/insights/ModernHTTP.js +0 -201
- package/models/trace/insights/ModernHTTP.js.map +0 -1
- package/models/trace/insights/NetworkDependencyTree.js +0 -968
- package/models/trace/insights/NetworkDependencyTree.js.map +0 -1
- package/models/trace/insights/RenderBlocking.js +0 -193
- package/models/trace/insights/RenderBlocking.js.map +0 -1
- package/models/trace/insights/SlowCSSSelector.js +0 -137
- package/models/trace/insights/SlowCSSSelector.js.map +0 -1
- package/models/trace/insights/Statistics.js +0 -93
- package/models/trace/insights/Statistics.js.map +0 -1
- package/models/trace/insights/ThirdParties.js +0 -99
- package/models/trace/insights/ThirdParties.js.map +0 -1
- package/models/trace/insights/Viewport.js +0 -103
- package/models/trace/insights/Viewport.js.map +0 -1
- package/models/trace/insights/bundle-tsconfig.json +0 -1
- package/models/trace/insights/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
- package/models/trace/insights/insights-tsconfig.json +0 -103
- package/models/trace/insights/insights.js +0 -10
- package/models/trace/insights/insights.js.map +0 -1
- package/models/trace/insights/types.js +0 -41
- package/models/trace/insights/types.js.map +0 -1
- package/models/trace/lantern/bundle-tsconfig.json +0 -1
- package/models/trace/lantern/core/LanternError.js +0 -7
- package/models/trace/lantern/core/LanternError.js.map +0 -1
- package/models/trace/lantern/core/NetworkAnalyzer.js +0 -484
- package/models/trace/lantern/core/NetworkAnalyzer.js.map +0 -1
- package/models/trace/lantern/core/bundle-tsconfig.json +0 -1
- package/models/trace/lantern/core/core-tsconfig.json +0 -49
- package/models/trace/lantern/core/core.js +0 -6
- package/models/trace/lantern/core/core.js.map +0 -1
- package/models/trace/lantern/core/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
- package/models/trace/lantern/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -60
- package/models/trace/lantern/graph/BaseNode.js +0 -277
- package/models/trace/lantern/graph/BaseNode.js.map +0 -1
- package/models/trace/lantern/graph/CPUNode.js +0 -64
- package/models/trace/lantern/graph/CPUNode.js.map +0 -1
- package/models/trace/lantern/graph/NetworkNode.js +0 -83
- package/models/trace/lantern/graph/NetworkNode.js.map +0 -1
- package/models/trace/lantern/graph/PageDependencyGraph.js +0 -552
- package/models/trace/lantern/graph/PageDependencyGraph.js.map +0 -1
- package/models/trace/lantern/graph/bundle-tsconfig.json +0 -1
- package/models/trace/lantern/graph/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
- package/models/trace/lantern/graph/graph-tsconfig.json +0 -54
- package/models/trace/lantern/graph/graph.js +0 -8
- package/models/trace/lantern/graph/graph.js.map +0 -1
- package/models/trace/lantern/lantern.js.map +0 -1
- package/models/trace/lantern/metrics/FirstContentfulPaint.js +0 -137
- package/models/trace/lantern/metrics/FirstContentfulPaint.js.map +0 -1
- package/models/trace/lantern/metrics/Interactive.js +0 -68
- package/models/trace/lantern/metrics/Interactive.js.map +0 -1
- package/models/trace/lantern/metrics/LargestContentfulPaint.js +0 -69
- package/models/trace/lantern/metrics/LargestContentfulPaint.js.map +0 -1
- package/models/trace/lantern/metrics/MaxPotentialFID.js +0 -49
- package/models/trace/lantern/metrics/MaxPotentialFID.js.map +0 -1
- package/models/trace/lantern/metrics/Metric.js +0 -69
- package/models/trace/lantern/metrics/Metric.js.map +0 -1
- package/models/trace/lantern/metrics/SpeedIndex.js +0 -102
- package/models/trace/lantern/metrics/SpeedIndex.js.map +0 -1
- package/models/trace/lantern/metrics/TBTUtils.js +0 -65
- package/models/trace/lantern/metrics/TBTUtils.js.map +0 -1
- package/models/trace/lantern/metrics/TotalBlockingTime.js +0 -79
- package/models/trace/lantern/metrics/TotalBlockingTime.js.map +0 -1
- package/models/trace/lantern/metrics/bundle-tsconfig.json +0 -1
- package/models/trace/lantern/metrics/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
- package/models/trace/lantern/metrics/metrics-tsconfig.json +0 -64
- package/models/trace/lantern/metrics/metrics.js +0 -12
- package/models/trace/lantern/metrics/metrics.js.map +0 -1
- package/models/trace/lantern/simulation/ConnectionPool.js +0 -116
- package/models/trace/lantern/simulation/ConnectionPool.js.map +0 -1
- package/models/trace/lantern/simulation/Constants.js +0 -43
- package/models/trace/lantern/simulation/Constants.js.map +0 -1
- package/models/trace/lantern/simulation/DNSCache.js +0 -48
- package/models/trace/lantern/simulation/DNSCache.js.map +0 -1
- package/models/trace/lantern/simulation/SimulationTimingMap.js +0 -135
- package/models/trace/lantern/simulation/SimulationTimingMap.js.map +0 -1
- package/models/trace/lantern/simulation/Simulator.js +0 -451
- package/models/trace/lantern/simulation/Simulator.js.map +0 -1
- package/models/trace/lantern/simulation/TCPConnection.js +0 -155
- package/models/trace/lantern/simulation/TCPConnection.js.map +0 -1
- package/models/trace/lantern/simulation/bundle-tsconfig.json +0 -1
- package/models/trace/lantern/simulation/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
- package/models/trace/lantern/simulation/simulation-tsconfig.json +0 -59
- package/models/trace/lantern/simulation/simulation.js +0 -10
- package/models/trace/lantern/simulation/simulation.js.map +0 -1
- package/models/trace/lantern/types/Lantern.js +0 -25
- package/models/trace/lantern/types/Lantern.js.map +0 -1
- package/models/trace/lantern/types/bundle-tsconfig.json +0 -1
- package/models/trace/lantern/types/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
- package/models/trace/lantern/types/types-tsconfig.json +0 -48
- package/models/trace/lantern/types/types.js +0 -5
- package/models/trace/lantern/types/types.js.map +0 -1
- package/models/trace/trace-tsconfig.json +0 -78
- package/models/trace/trace.js.map +0 -1
- package/models/trace/types/Configuration.js +0 -18
- package/models/trace/types/Configuration.js.map +0 -1
- package/models/trace/types/Extensions.js +0 -38
- package/models/trace/types/Extensions.js.map +0 -1
- package/models/trace/types/File.js +0 -82
- package/models/trace/types/File.js.map +0 -1
- package/models/trace/types/Overlays.js +0 -5
- package/models/trace/types/Overlays.js.map +0 -1
- package/models/trace/types/Timing.js.map +0 -1
- package/models/trace/types/TraceEvents.js.map +0 -1
- package/models/trace/types/bundle-tsconfig.json +0 -1
- package/models/trace/types/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
- package/models/trace/types/types-tsconfig.json +0 -65
- package/models/trace/types/types.js.map +0 -1
- package/test/invalid-animation-events.json.gz +0 -0
- package/test/test-trace-engine.mjs +0 -191
- package/third_party/legacy-javascript/legacy-javascript.js +0 -1
- package/third_party/marked/marked.d.ts +0 -1
- package/third_party/marked/marked.js +0 -1
- package/third_party/third-party-web/third-party-web.js +0 -1
- package/tsconfig.json +0 -29
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 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
|
-
import * as Platform from '../../../core/platform/platform.js';
|
|
5
|
-
import * as Types from '../types/types.js';
|
|
6
|
-
import { data as metaHandlerData } from './MetaHandler.js';
|
|
7
|
-
import { data as networkRequestsHandlerData } from './NetworkRequestsHandler.js';
|
|
8
|
-
function completeURL(base, url) {
|
|
9
|
-
if (url.startsWith('data:') || url.startsWith('blob:') || url.startsWith('javascript:') || url.startsWith('mailto:')) {
|
|
10
|
-
return url;
|
|
11
|
-
}
|
|
12
|
-
try {
|
|
13
|
-
return new URL(url, base).href;
|
|
14
|
-
}
|
|
15
|
-
catch { }
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
let scriptById = new Map();
|
|
19
|
-
let frameIdByIsolate = new Map();
|
|
20
|
-
export function deps() {
|
|
21
|
-
return ['Meta', 'NetworkRequests'];
|
|
22
|
-
}
|
|
23
|
-
export function reset() {
|
|
24
|
-
scriptById = new Map();
|
|
25
|
-
frameIdByIsolate = new Map();
|
|
26
|
-
}
|
|
27
|
-
export function handleEvent(event) {
|
|
28
|
-
const getOrMakeScript = (isolate, scriptIdAsNumber) => {
|
|
29
|
-
const scriptId = String(scriptIdAsNumber);
|
|
30
|
-
const key = `${isolate}.${scriptId}`;
|
|
31
|
-
return Platform.MapUtilities.getWithDefault(scriptById, key, () => ({ isolate, scriptId, frame: '', ts: event.ts }));
|
|
32
|
-
};
|
|
33
|
-
if (Types.Events.isRundownScriptCompiled(event) && event.args.data) {
|
|
34
|
-
const { isolate, scriptId, frame } = event.args.data;
|
|
35
|
-
const script = getOrMakeScript(isolate, scriptId);
|
|
36
|
-
script.frame = frame;
|
|
37
|
-
script.ts = event.ts;
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (Types.Events.isRundownScript(event)) {
|
|
41
|
-
const { isolate, scriptId, url, sourceUrl, sourceMapUrl, sourceMapUrlElided } = event.args.data;
|
|
42
|
-
const script = getOrMakeScript(isolate, scriptId);
|
|
43
|
-
if (!script.frame) {
|
|
44
|
-
script.frame = frameIdByIsolate.get(String(isolate)) ?? '';
|
|
45
|
-
}
|
|
46
|
-
script.url = url;
|
|
47
|
-
script.ts = event.ts;
|
|
48
|
-
if (sourceUrl) {
|
|
49
|
-
script.sourceUrl = sourceUrl;
|
|
50
|
-
}
|
|
51
|
-
// Older traces may have data source map urls. Those can be very large, so a change
|
|
52
|
-
// was made to elide them from the trace.
|
|
53
|
-
// If elided, a fresh trace will fetch the source map from the Script model
|
|
54
|
-
// (see TimelinePanel getExistingSourceMap). If not fresh, the source map is resolved
|
|
55
|
-
// instead in this handler via `findCachedRawSourceMap`.
|
|
56
|
-
if (sourceMapUrlElided) {
|
|
57
|
-
script.sourceMapUrlElided = true;
|
|
58
|
-
}
|
|
59
|
-
else if (sourceMapUrl) {
|
|
60
|
-
script.sourceMapUrl = sourceMapUrl;
|
|
61
|
-
}
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (Types.Events.isRundownScriptSource(event)) {
|
|
65
|
-
const { isolate, scriptId, sourceText } = event.args.data;
|
|
66
|
-
const script = getOrMakeScript(isolate, scriptId);
|
|
67
|
-
script.content = sourceText;
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
if (Types.Events.isRundownScriptSourceLarge(event)) {
|
|
71
|
-
const { isolate, scriptId, sourceText } = event.args.data;
|
|
72
|
-
const script = getOrMakeScript(isolate, scriptId);
|
|
73
|
-
script.content = (script.content ?? '') + sourceText;
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
// Setup frameIdByIsolate, which is used only in the case that we are missing
|
|
77
|
-
// rundown events for a script. We won't get a frame association from the rundown
|
|
78
|
-
// events if the recording started only after the script was first compiled. In
|
|
79
|
-
// that scenario, derive the frame via the isolate / FunctionCall events.
|
|
80
|
-
// TODO: ideally, we put the frame on ScriptCatchup event. So much easier. This approach has some
|
|
81
|
-
// issues.
|
|
82
|
-
if (Types.Events.isFunctionCall(event) && event.args.data?.isolate && event.args.data.frame) {
|
|
83
|
-
const { isolate, frame } = event.args.data;
|
|
84
|
-
const existingValue = frameIdByIsolate.get(isolate);
|
|
85
|
-
if (existingValue !== frame) {
|
|
86
|
-
frameIdByIsolate.set(isolate, frame);
|
|
87
|
-
// Update the scripts we discovered but without knowing their frame.
|
|
88
|
-
for (const script of scriptById.values()) {
|
|
89
|
-
if (!script.frame && script.isolate === isolate) {
|
|
90
|
-
script.frame = frame;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
function findFrame(meta, frameId) {
|
|
97
|
-
for (const frames of meta.frameByProcessId?.values()) {
|
|
98
|
-
const frame = frames.get(frameId);
|
|
99
|
-
if (frame) {
|
|
100
|
-
return frame;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
function findNetworkRequest(networkRequests, script) {
|
|
106
|
-
if (!script.url) {
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
return networkRequests.find(request => request.args.data.url === script.url) ?? null;
|
|
110
|
-
}
|
|
111
|
-
function computeMappingEndColumns(map) {
|
|
112
|
-
const result = new Map();
|
|
113
|
-
const mappings = map.mappings();
|
|
114
|
-
for (let i = 0; i < mappings.length - 1; i++) {
|
|
115
|
-
const mapping = mappings[i];
|
|
116
|
-
const nextMapping = mappings[i + 1];
|
|
117
|
-
if (mapping.lineNumber === nextMapping.lineNumber) {
|
|
118
|
-
result.set(mapping, nextMapping.columnNumber);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
// Now, all but the last mapping on each line will have a value in this map.
|
|
122
|
-
return result;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Using a script's contents and source map, attribute every generated byte to an authored source file.
|
|
126
|
-
*/
|
|
127
|
-
function computeGeneratedFileSizes(script) {
|
|
128
|
-
if (!script.sourceMap) {
|
|
129
|
-
throw new Error('expected source map');
|
|
130
|
-
}
|
|
131
|
-
const map = script.sourceMap;
|
|
132
|
-
const content = script.content ?? '';
|
|
133
|
-
const contentLength = content.length;
|
|
134
|
-
const lines = content.split('\n');
|
|
135
|
-
const files = {};
|
|
136
|
-
const totalBytes = contentLength;
|
|
137
|
-
let unmappedBytes = totalBytes;
|
|
138
|
-
const mappingEndCols = computeMappingEndColumns(script.sourceMap);
|
|
139
|
-
for (const mapping of map.mappings()) {
|
|
140
|
-
const source = mapping.sourceURL;
|
|
141
|
-
const lineNum = mapping.lineNumber;
|
|
142
|
-
const colNum = mapping.columnNumber;
|
|
143
|
-
const lastColNum = mappingEndCols.get(mapping);
|
|
144
|
-
// Webpack sometimes emits null mappings.
|
|
145
|
-
// https://github.com/mozilla/source-map/pull/303
|
|
146
|
-
if (!source) {
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
// Lines and columns are zero-based indices. Visually, lines are shown as a 1-based index.
|
|
150
|
-
const line = lines[lineNum];
|
|
151
|
-
if (line === null || line === undefined) {
|
|
152
|
-
const errorMessage = `${map.url()} mapping for line out of bounds: ${lineNum + 1}`;
|
|
153
|
-
return { errorMessage };
|
|
154
|
-
}
|
|
155
|
-
if (colNum > line.length) {
|
|
156
|
-
const errorMessage = `${map.url()} mapping for column out of bounds: ${lineNum + 1}:${colNum}`;
|
|
157
|
-
return { errorMessage };
|
|
158
|
-
}
|
|
159
|
-
let mappingLength = 0;
|
|
160
|
-
if (lastColNum !== undefined) {
|
|
161
|
-
if (lastColNum > line.length) {
|
|
162
|
-
const errorMessage = `${map.url()} mapping for last column out of bounds: ${lineNum + 1}:${lastColNum}`;
|
|
163
|
-
return { errorMessage };
|
|
164
|
-
}
|
|
165
|
-
mappingLength = lastColNum - colNum;
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
// Add +1 to account for the newline.
|
|
169
|
-
mappingLength = line.length - colNum + 1;
|
|
170
|
-
}
|
|
171
|
-
files[source] = (files[source] || 0) + mappingLength;
|
|
172
|
-
unmappedBytes -= mappingLength;
|
|
173
|
-
}
|
|
174
|
-
return {
|
|
175
|
-
files,
|
|
176
|
-
unmappedBytes,
|
|
177
|
-
totalBytes,
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
export function getScriptGeneratedSizes(script) {
|
|
181
|
-
if (script.sourceMap && !script.sizes) {
|
|
182
|
-
script.sizes = computeGeneratedFileSizes(script);
|
|
183
|
-
}
|
|
184
|
-
return script.sizes ?? null;
|
|
185
|
-
}
|
|
186
|
-
function findCachedRawSourceMap(script, options) {
|
|
187
|
-
if (options.isFreshRecording || !options.metadata?.sourceMaps) {
|
|
188
|
-
// Exit if this is not a loaded trace w/ source maps in the metadata.
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
// For elided data url source maps, search the metadata source maps by script url.
|
|
192
|
-
if (script.sourceMapUrlElided) {
|
|
193
|
-
if (!script.url) {
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
const cachedSourceMap = options.metadata.sourceMaps.find(m => m.url === script.url);
|
|
197
|
-
if (cachedSourceMap) {
|
|
198
|
-
return cachedSourceMap.sourceMap;
|
|
199
|
-
}
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
if (!script.sourceMapUrl) {
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
// Otherwise, search by source map url.
|
|
206
|
-
// Note: early enhanced traces may have this field set for data urls. Ignore those,
|
|
207
|
-
// as they were never stored in metadata sourcemap.
|
|
208
|
-
const isDataUrl = script.sourceMapUrl.startsWith('data:');
|
|
209
|
-
if (!isDataUrl) {
|
|
210
|
-
const cachedSourceMap = options.metadata.sourceMaps.find(m => m.sourceMapUrl === script.sourceMapUrl);
|
|
211
|
-
if (cachedSourceMap) {
|
|
212
|
-
return cachedSourceMap.sourceMap;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
export async function finalize(options) {
|
|
218
|
-
const meta = metaHandlerData();
|
|
219
|
-
const networkRequests = [...networkRequestsHandlerData().byId.values()];
|
|
220
|
-
const documentUrls = new Set();
|
|
221
|
-
for (const frames of meta.frameByProcessId.values()) {
|
|
222
|
-
for (const frame of frames.values()) {
|
|
223
|
-
documentUrls.add(frame.url);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
for (const script of scriptById.values()) {
|
|
227
|
-
script.request = findNetworkRequest(networkRequests, script) ?? undefined;
|
|
228
|
-
script.inline = !!script.url && documentUrls.has(script.url);
|
|
229
|
-
}
|
|
230
|
-
if (!options.resolveSourceMap) {
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
const promises = [];
|
|
234
|
-
for (const script of scriptById.values()) {
|
|
235
|
-
// No frame or url means the script came from somewhere we don't care about.
|
|
236
|
-
// Note: scripts from inline <SCRIPT> elements use the url of the HTML document,
|
|
237
|
-
// so aren't ignored.
|
|
238
|
-
if (!script.frame || !script.url || (!script.sourceMapUrl && !script.sourceMapUrlElided)) {
|
|
239
|
-
continue;
|
|
240
|
-
}
|
|
241
|
-
const frameUrl = findFrame(meta, script.frame)?.url;
|
|
242
|
-
if (!frameUrl) {
|
|
243
|
-
continue;
|
|
244
|
-
}
|
|
245
|
-
// If there is a `sourceURL` magic comment, resolve the compiledUrl against the frame url.
|
|
246
|
-
// example: `// #sourceURL=foo.js` for target frame https://www.example.com/home -> https://www.example.com/home/foo.js
|
|
247
|
-
let sourceUrl = script.url;
|
|
248
|
-
if (script.sourceUrl) {
|
|
249
|
-
sourceUrl = completeURL(frameUrl, script.sourceUrl) ?? script.sourceUrl;
|
|
250
|
-
}
|
|
251
|
-
let sourceMapUrl;
|
|
252
|
-
if (script.sourceMapUrl) {
|
|
253
|
-
// Resolve the source map url. The value given by v8 may be relative, so resolve it here.
|
|
254
|
-
// This process should match the one in `SourceMapManager.attachSourceMap`.
|
|
255
|
-
sourceMapUrl =
|
|
256
|
-
completeURL(sourceUrl, script.sourceMapUrl);
|
|
257
|
-
if (!sourceMapUrl) {
|
|
258
|
-
continue;
|
|
259
|
-
}
|
|
260
|
-
script.sourceMapUrl = sourceMapUrl;
|
|
261
|
-
}
|
|
262
|
-
const params = {
|
|
263
|
-
scriptId: script.scriptId,
|
|
264
|
-
scriptUrl: script.url,
|
|
265
|
-
sourceUrl: sourceUrl,
|
|
266
|
-
sourceMapUrl: sourceMapUrl ?? '',
|
|
267
|
-
frame: script.frame,
|
|
268
|
-
cachedRawSourceMap: findCachedRawSourceMap(script, options),
|
|
269
|
-
};
|
|
270
|
-
const promise = options.resolveSourceMap(params).then(sourceMap => {
|
|
271
|
-
if (sourceMap) {
|
|
272
|
-
script.sourceMap = sourceMap;
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
promises.push(promise.catch(e => {
|
|
276
|
-
console.error('Uncaught error when resolving source map', params, e);
|
|
277
|
-
}));
|
|
278
|
-
}
|
|
279
|
-
await Promise.all(promises);
|
|
280
|
-
}
|
|
281
|
-
export function data() {
|
|
282
|
-
return {
|
|
283
|
-
scripts: [...scriptById.values()],
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
//# sourceMappingURL=ScriptsHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ScriptsHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/ScriptsHandler.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAG/D,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,IAAI,IAAI,eAAe,EAAuB,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAC,IAAI,IAAI,0BAA0B,EAAC,MAAM,6BAA6B,CAAC;AAG/E,SAAS,WAAW,CAAC,IAAY,EAAE,GAAW;IAC5C,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACrH,OAAO,GAAsC,CAAC;IAChD,CAAC;IAED,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,IAAuC,CAAC;IACpE,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;IAEV,OAAO,IAAI,CAAC;AACd,CAAC;AAiCD,IAAI,UAAU,GAAG,IAAI,GAAG,EAAkB,CAAC;AAC3C,IAAI,gBAAgB,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEjD,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAA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AE,sBAAsB,CAAC,MAAM,EAAE,OAAO,CAAC;SAC5D,CAAC;QACF,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;YAChE,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;YAC/B,CAAC;QACH,CAAC,CAAC,CAAC;QACH,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;YAC9B,OAAO,CAAC,KAAK,CAAC,0CAA0C,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC,CAAC;IACN,CAAC;IACD,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,IAAI;IAClB,OAAO;QACL,OAAO,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC;KAClC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright 2025 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 * as Platform from '../../../core/platform/platform.js';\nimport type * as SDK from '../../../core/sdk/sdk.js';\nimport type * as Protocol from '../../../generated/protocol.js';\nimport * as Types from '../types/types.js';\n\nimport {data as metaHandlerData, type MetaHandlerData} from './MetaHandler.js';\nimport {data as networkRequestsHandlerData} from './NetworkRequestsHandler.js';\nimport type {FinalizeOptions, HandlerName} from './types.js';\n\nfunction completeURL(base: string, url: string): Platform.DevToolsPath.UrlString|null {\n if (url.startsWith('data:') || url.startsWith('blob:') || url.startsWith('javascript:') || url.startsWith('mailto:')) {\n return url as Platform.DevToolsPath.UrlString;\n }\n\n try {\n return new URL(url, base).href as Platform.DevToolsPath.UrlString;\n } catch {}\n\n return null;\n}\n\nexport interface ScriptsData {\n /** Note: this is only populated when the \"Enhanced Traces\" feature is enabled. */\n scripts: Script[];\n}\n\nexport interface Script {\n isolate: string;\n scriptId: Protocol.Runtime.ScriptId;\n frame: string;\n ts: Types.Timing.Micro;\n inline: boolean;\n url?: string;\n sourceUrl?: string;\n content?: string;\n /**\n * Note: this is the literal text given as the sourceMappingURL value. It has not been resolved relative to the script url.\n * Since M138, data urls are never set here.\n */\n sourceMapUrl?: string;\n /** If true, the source map url was a data URL, so it got removed from the trace event. */\n sourceMapUrlElided?: boolean;\n sourceMap?: SDK.SourceMap.SourceMap;\n request?: Types.Events.SyntheticNetworkRequest;\n /** Lazily generated - use getScriptGeneratedSizes to access. */\n sizes?: GeneratedFileSizes;\n}\n\ntype GeneratedFileSizes = {\n errorMessage: string,\n}|{files: Record<string, number>, unmappedBytes: number, totalBytes: number};\n\nlet scriptById = new Map<string, Script>();\nlet frameIdByIsolate = new Map<string, string>();\n\nexport function deps(): HandlerName[] {\n return ['Meta', 'NetworkRequests'];\n}\n\nexport function reset(): void {\n scriptById = new Map();\n frameIdByIsolate = new Map();\n}\n\nexport function handleEvent(event: Types.Events.Event): void {\n const getOrMakeScript = (isolate: string|number, scriptIdAsNumber: number): Script => {\n const scriptId = String(scriptIdAsNumber) as Protocol.Runtime.ScriptId;\n const key = `${isolate}.${scriptId}`;\n return Platform.MapUtilities.getWithDefault(\n scriptById, key, () => ({isolate, scriptId, frame: '', ts: event.ts} as Script));\n };\n\n if (Types.Events.isRundownScriptCompiled(event) && event.args.data) {\n const {isolate, scriptId, frame} = event.args.data;\n const script = getOrMakeScript(isolate, scriptId);\n script.frame = frame;\n script.ts = event.ts;\n\n return;\n }\n\n if (Types.Events.isRundownScript(event)) {\n const {isolate, scriptId, url, sourceUrl, sourceMapUrl, sourceMapUrlElided} = event.args.data;\n const script = getOrMakeScript(isolate, scriptId);\n if (!script.frame) {\n script.frame = frameIdByIsolate.get(String(isolate)) ?? '';\n }\n script.url = url;\n script.ts = event.ts;\n if (sourceUrl) {\n script.sourceUrl = sourceUrl;\n }\n\n // Older traces may have data source map urls. Those can be very large, so a change\n // was made to elide them from the trace.\n // If elided, a fresh trace will fetch the source map from the Script model\n // (see TimelinePanel getExistingSourceMap). If not fresh, the source map is resolved\n // instead in this handler via `findCachedRawSourceMap`.\n if (sourceMapUrlElided) {\n script.sourceMapUrlElided = true;\n } else if (sourceMapUrl) {\n script.sourceMapUrl = sourceMapUrl;\n }\n return;\n }\n\n if (Types.Events.isRundownScriptSource(event)) {\n const {isolate, scriptId, sourceText} = event.args.data;\n const script = getOrMakeScript(isolate, scriptId);\n script.content = sourceText;\n return;\n }\n\n if (Types.Events.isRundownScriptSourceLarge(event)) {\n const {isolate, scriptId, sourceText} = event.args.data;\n const script = getOrMakeScript(isolate, scriptId);\n script.content = (script.content ?? '') + sourceText;\n return;\n }\n\n // Setup frameIdByIsolate, which is used only in the case that we are missing\n // rundown events for a script. We won't get a frame association from the rundown\n // events if the recording started only after the script was first compiled. In\n // that scenario, derive the frame via the isolate / FunctionCall events.\n // TODO: ideally, we put the frame on ScriptCatchup event. So much easier. This approach has some\n // issues.\n if (Types.Events.isFunctionCall(event) && event.args.data?.isolate && event.args.data.frame) {\n const {isolate, frame} = event.args.data;\n const existingValue = frameIdByIsolate.get(isolate);\n if (existingValue !== frame) {\n frameIdByIsolate.set(isolate, frame);\n\n // Update the scripts we discovered but without knowing their frame.\n for (const script of scriptById.values()) {\n if (!script.frame && script.isolate === isolate) {\n script.frame = frame;\n }\n }\n }\n }\n}\n\nfunction findFrame(meta: MetaHandlerData, frameId: string): Types.Events.TraceFrame|null {\n for (const frames of meta.frameByProcessId?.values()) {\n const frame = frames.get(frameId);\n if (frame) {\n return frame;\n }\n }\n\n return null;\n}\n\nfunction findNetworkRequest(networkRequests: Types.Events.SyntheticNetworkRequest[], script: Script):\n Types.Events.SyntheticNetworkRequest|null {\n if (!script.url) {\n return null;\n }\n\n return networkRequests.find(request => request.args.data.url === script.url) ?? null;\n}\n\nfunction computeMappingEndColumns(map: SDK.SourceMap.SourceMap): Map<SDK.SourceMap.SourceMapEntry, number> {\n const result = new Map<SDK.SourceMap.SourceMapEntry, number>();\n\n const mappings = map.mappings();\n for (let i = 0; i < mappings.length - 1; i++) {\n const mapping = mappings[i];\n const nextMapping = mappings[i + 1];\n if (mapping.lineNumber === nextMapping.lineNumber) {\n result.set(mapping, nextMapping.columnNumber);\n }\n }\n\n // Now, all but the last mapping on each line will have a value in this map.\n return result;\n}\n\n/**\n * Using a script's contents and source map, attribute every generated byte to an authored source file.\n */\nfunction computeGeneratedFileSizes(script: Script): GeneratedFileSizes {\n if (!script.sourceMap) {\n throw new Error('expected source map');\n }\n\n const map = script.sourceMap;\n const content = script.content ?? '';\n const contentLength = content.length;\n const lines = content.split('\\n');\n const files: Record<string, number> = {};\n const totalBytes = contentLength;\n let unmappedBytes = totalBytes;\n\n const mappingEndCols = computeMappingEndColumns(script.sourceMap);\n\n for (const mapping of map.mappings()) {\n const source = mapping.sourceURL;\n const lineNum = mapping.lineNumber;\n const colNum = mapping.columnNumber;\n const lastColNum = mappingEndCols.get(mapping);\n\n // Webpack sometimes emits null mappings.\n // https://github.com/mozilla/source-map/pull/303\n if (!source) {\n continue;\n }\n\n // Lines and columns are zero-based indices. Visually, lines are shown as a 1-based index.\n\n const line = lines[lineNum];\n if (line === null || line === undefined) {\n const errorMessage = `${map.url()} mapping for line out of bounds: ${lineNum + 1}`;\n return {errorMessage};\n }\n\n if (colNum > line.length) {\n const errorMessage = `${map.url()} mapping for column out of bounds: ${lineNum + 1}:${colNum}`;\n return {errorMessage};\n }\n\n let mappingLength = 0;\n if (lastColNum !== undefined) {\n if (lastColNum > line.length) {\n const errorMessage = `${map.url()} mapping for last column out of bounds: ${lineNum + 1}:${lastColNum}`;\n return {errorMessage};\n }\n mappingLength = lastColNum - colNum;\n } else {\n // Add +1 to account for the newline.\n mappingLength = line.length - colNum + 1;\n }\n files[source] = (files[source] || 0) + mappingLength;\n unmappedBytes -= mappingLength;\n }\n\n return {\n files,\n unmappedBytes,\n totalBytes,\n };\n}\n\nexport function getScriptGeneratedSizes(script: Script): GeneratedFileSizes|null {\n if (script.sourceMap && !script.sizes) {\n script.sizes = computeGeneratedFileSizes(script);\n }\n\n return script.sizes ?? null;\n}\n\nfunction findCachedRawSourceMap(script: Script, options: Types.Configuration.ParseOptions): SDK.SourceMap.SourceMapV3|\n undefined {\n if (options.isFreshRecording || !options.metadata?.sourceMaps) {\n // Exit if this is not a loaded trace w/ source maps in the metadata.\n return;\n }\n\n // For elided data url source maps, search the metadata source maps by script url.\n if (script.sourceMapUrlElided) {\n if (!script.url) {\n return;\n }\n\n const cachedSourceMap = options.metadata.sourceMaps.find(m => m.url === script.url);\n if (cachedSourceMap) {\n return cachedSourceMap.sourceMap;\n }\n\n return;\n }\n\n if (!script.sourceMapUrl) {\n return;\n }\n\n // Otherwise, search by source map url.\n // Note: early enhanced traces may have this field set for data urls. Ignore those,\n // as they were never stored in metadata sourcemap.\n const isDataUrl = script.sourceMapUrl.startsWith('data:');\n if (!isDataUrl) {\n const cachedSourceMap = options.metadata.sourceMaps.find(m => m.sourceMapUrl === script.sourceMapUrl);\n if (cachedSourceMap) {\n return cachedSourceMap.sourceMap;\n }\n }\n\n return;\n}\n\nexport async function finalize(options: FinalizeOptions): Promise<void> {\n const meta = metaHandlerData();\n const networkRequests = [...networkRequestsHandlerData().byId.values()];\n\n const documentUrls = new Set<string>();\n for (const frames of meta.frameByProcessId.values()) {\n for (const frame of frames.values()) {\n documentUrls.add(frame.url);\n }\n }\n\n for (const script of scriptById.values()) {\n script.request = findNetworkRequest(networkRequests, script) ?? undefined;\n script.inline = !!script.url && documentUrls.has(script.url);\n }\n\n if (!options.resolveSourceMap) {\n return;\n }\n\n const promises = [];\n for (const script of scriptById.values()) {\n // No frame or url means the script came from somewhere we don't care about.\n // Note: scripts from inline <SCRIPT> elements use the url of the HTML document,\n // so aren't ignored.\n if (!script.frame || !script.url || (!script.sourceMapUrl && !script.sourceMapUrlElided)) {\n continue;\n }\n\n const frameUrl = findFrame(meta, script.frame)?.url as Platform.DevToolsPath.UrlString | undefined;\n if (!frameUrl) {\n continue;\n }\n\n // If there is a `sourceURL` magic comment, resolve the compiledUrl against the frame url.\n // example: `// #sourceURL=foo.js` for target frame https://www.example.com/home -> https://www.example.com/home/foo.js\n let sourceUrl = script.url;\n if (script.sourceUrl) {\n sourceUrl = completeURL(frameUrl, script.sourceUrl) ?? script.sourceUrl;\n }\n\n let sourceMapUrl;\n if (script.sourceMapUrl) {\n // Resolve the source map url. The value given by v8 may be relative, so resolve it here.\n // This process should match the one in `SourceMapManager.attachSourceMap`.\n sourceMapUrl =\n completeURL(sourceUrl as Platform.DevToolsPath.UrlString, script.sourceMapUrl);\n if (!sourceMapUrl) {\n continue;\n }\n\n script.sourceMapUrl = sourceMapUrl;\n }\n\n const params: Types.Configuration.ResolveSourceMapParams = {\n scriptId: script.scriptId,\n scriptUrl: script.url as Platform.DevToolsPath.UrlString,\n sourceUrl: sourceUrl as Platform.DevToolsPath.UrlString,\n sourceMapUrl: sourceMapUrl ?? '' as Platform.DevToolsPath.UrlString,\n frame: script.frame as Protocol.Page.FrameId,\n cachedRawSourceMap: findCachedRawSourceMap(script, options),\n };\n const promise = options.resolveSourceMap(params).then(sourceMap => {\n if (sourceMap) {\n script.sourceMap = sourceMap;\n }\n });\n promises.push(promise.catch(e => {\n console.error('Uncaught error when resolving source map', params, e);\n }));\n }\n await Promise.all(promises);\n}\n\nexport function data(): ScriptsData {\n return {\n scripts: [...scriptById.values()],\n };\n}\n"]}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 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
|
-
import * as Types from '../types/types.js';
|
|
5
|
-
let lastRecalcStyleEvent = null;
|
|
6
|
-
let lastInvalidatedNode = null;
|
|
7
|
-
let selectorDataForRecalcStyle = new Map();
|
|
8
|
-
let invalidatedNodeList = new Array();
|
|
9
|
-
export function reset() {
|
|
10
|
-
lastRecalcStyleEvent = null;
|
|
11
|
-
lastInvalidatedNode = null;
|
|
12
|
-
selectorDataForRecalcStyle = new Map();
|
|
13
|
-
invalidatedNodeList = [];
|
|
14
|
-
}
|
|
15
|
-
export function handleEvent(event) {
|
|
16
|
-
if (Types.Events.isStyleRecalcInvalidationTracking(event)) {
|
|
17
|
-
/**
|
|
18
|
-
* CSS Style substree invalidation
|
|
19
|
-
* A subtree invalidation comes with two records, 1) a StyleInvalidatorInvalidationTracking
|
|
20
|
-
* event 2) following with a StyleRecalcInvalidationTracking event. List of selectors and style
|
|
21
|
-
* sheet ID information is stored in the 1st event. Subtree flag is stored in the 2nd
|
|
22
|
-
* event.
|
|
23
|
-
*/
|
|
24
|
-
if (event.args.data.subtree &&
|
|
25
|
-
event.args.data.reason === Types.Events.StyleRecalcInvalidationReason.RELATED_STYLE_RULE &&
|
|
26
|
-
lastInvalidatedNode && event.args.data.nodeId === lastInvalidatedNode.backendNodeId) {
|
|
27
|
-
lastInvalidatedNode.subtree = true;
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if (Types.Events.isSelectorStats(event) && lastRecalcStyleEvent && event.args.selector_stats) {
|
|
32
|
-
selectorDataForRecalcStyle.set(lastRecalcStyleEvent, {
|
|
33
|
-
timings: event.args.selector_stats.selector_timings,
|
|
34
|
-
});
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
if (Types.Events.isStyleInvalidatorInvalidationTracking(event)) {
|
|
38
|
-
const selectorList = new Array();
|
|
39
|
-
event.args.data.selectors?.forEach(selector => {
|
|
40
|
-
selectorList.push({
|
|
41
|
-
selector: selector.selector,
|
|
42
|
-
styleSheetId: selector.style_sheet_id,
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
if (selectorList.length > 0) {
|
|
46
|
-
lastInvalidatedNode = {
|
|
47
|
-
frame: event.args.data.frame,
|
|
48
|
-
backendNodeId: event.args.data.nodeId,
|
|
49
|
-
type: Types.Events.InvalidationEventType.StyleInvalidatorInvalidationTracking,
|
|
50
|
-
selectorList,
|
|
51
|
-
ts: event.ts,
|
|
52
|
-
tts: event.tts,
|
|
53
|
-
subtree: false,
|
|
54
|
-
lastRecalcStyleEventTs: lastRecalcStyleEvent ? lastRecalcStyleEvent.ts : Types.Timing.Micro(0),
|
|
55
|
-
};
|
|
56
|
-
invalidatedNodeList.push(lastInvalidatedNode);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (Types.Events.isRecalcStyle(event)) {
|
|
60
|
-
lastRecalcStyleEvent = event;
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
export async function finalize() {
|
|
65
|
-
}
|
|
66
|
-
export function data() {
|
|
67
|
-
return {
|
|
68
|
-
dataForRecalcStyleEvent: selectorDataForRecalcStyle,
|
|
69
|
-
invalidatedNodeList,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
//# sourceMappingURL=SelectorStatsHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectorStatsHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/SelectorStatsHandler.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAG7B,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAmB3C,IAAI,oBAAoB,GAAkC,IAAI,CAAC;AAC/D,IAAI,mBAAmB,GAAyB,IAAI,CAAC;AAErD,IAAI,0BAA0B,GAAG,IAAI,GAAG,EAEpC,CAAC;AAEL,IAAI,mBAAmB,GAAG,IAAI,KAAK,EAAmB,CAAC;AAEvD,MAAM,UAAU,KAAK;IACnB,oBAAoB,GAAG,IAAI,CAAC;IAC5B,mBAAmB,GAAG,IAAI,CAAC;IAC3B,0BAA0B,GAAG,IAAI,GAAG,EAAE,CAAC;IACvC,mBAAmB,GAAG,EAAE,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAyB;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IAAI,CAAC,IAAI,CAAC,MAAM;gBACrC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,qBAAqB,CAAC,oCAAoC;gBAC7E,YAAY;gBACZ,EAAE,EAAE,KAAK,CAAC,EAAE;gBACZ,GAAG,EAAE,KAAK,CAAC,GAAG;gBACd,OAAO,EAAE,KAAK;gBACd,sBAAsB,EAAE,oBAAoB,CAAC,CAAC,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;aAC/F,CAAC;YACF,mBAAmB,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,oBAAoB,GAAG,KAAK,CAAC;QAC7B,OAAO;IACT,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ;AAC9B,CAAC;AASD,MAAM,UAAU,IAAI;IAClB,OAAO;QACL,uBAAuB,EAAE,0BAA0B;QACnD,mBAAmB;KACpB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright 2024 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 * as Types from '../types/types.js';\n\ninterface SelectorWithStyleSheedId {\n selector: string;\n styleSheetId: string;\n}\n\ninterface InvalidatedNode {\n frame: string;\n backendNodeId: Protocol.DOM.BackendNodeId;\n type: Types.Events.InvalidationEventType;\n selectorList: SelectorWithStyleSheedId[];\n ts: Types.Timing.Micro;\n tts?: Types.Timing.Micro;\n subtree:\n boolean; // Indicates if the invalidation applies solely to the node (false) or extends to all its descendants (true)\n lastRecalcStyleEventTs: Types.Timing.Micro;\n}\n\nlet lastRecalcStyleEvent: Types.Events.RecalcStyle|null = null;\nlet lastInvalidatedNode: InvalidatedNode|null = null;\n\nlet selectorDataForRecalcStyle = new Map<Types.Events.RecalcStyle, {\n timings: Types.Events.SelectorTiming[],\n}>();\n\nlet invalidatedNodeList = new Array<InvalidatedNode>();\n\nexport function reset(): void {\n lastRecalcStyleEvent = null;\n lastInvalidatedNode = null;\n selectorDataForRecalcStyle = new Map();\n invalidatedNodeList = [];\n}\n\nexport function handleEvent(event: Types.Events.Event): void {\n if (Types.Events.isStyleRecalcInvalidationTracking(event)) {\n /**\n * CSS Style substree invalidation\n * A subtree invalidation comes with two records, 1) a StyleInvalidatorInvalidationTracking\n * event 2) following with a StyleRecalcInvalidationTracking event. List of selectors and style\n * sheet ID information is stored in the 1st event. Subtree flag is stored in the 2nd\n * event.\n */\n if (event.args.data.subtree &&\n event.args.data.reason === Types.Events.StyleRecalcInvalidationReason.RELATED_STYLE_RULE &&\n lastInvalidatedNode && event.args.data.nodeId === lastInvalidatedNode.backendNodeId) {\n lastInvalidatedNode.subtree = true;\n return;\n }\n }\n\n if (Types.Events.isSelectorStats(event) && lastRecalcStyleEvent && event.args.selector_stats) {\n selectorDataForRecalcStyle.set(lastRecalcStyleEvent, {\n timings: event.args.selector_stats.selector_timings,\n });\n return;\n }\n\n if (Types.Events.isStyleInvalidatorInvalidationTracking(event)) {\n const selectorList = new Array<SelectorWithStyleSheedId>();\n event.args.data.selectors?.forEach(selector => {\n selectorList.push({\n selector: selector.selector,\n styleSheetId: selector.style_sheet_id,\n });\n });\n\n if (selectorList.length > 0) {\n lastInvalidatedNode = {\n frame: event.args.data.frame,\n backendNodeId: event.args.data.nodeId,\n type: Types.Events.InvalidationEventType.StyleInvalidatorInvalidationTracking,\n selectorList,\n ts: event.ts,\n tts: event.tts,\n subtree: false,\n lastRecalcStyleEventTs: lastRecalcStyleEvent ? lastRecalcStyleEvent.ts : Types.Timing.Micro(0),\n };\n invalidatedNodeList.push(lastInvalidatedNode);\n }\n }\n\n if (Types.Events.isRecalcStyle(event)) {\n lastRecalcStyleEvent = event;\n return;\n }\n}\n\nexport async function finalize(): Promise<void> {\n}\n\nexport interface SelectorStatsData {\n dataForRecalcStyleEvent: Map<Types.Events.RecalcStyle, {\n timings: Types.Events.SelectorTiming[],\n }>;\n invalidatedNodeList: InvalidatedNode[];\n}\n\nexport function data(): SelectorStatsData {\n return {\n dataForRecalcStyleEvent: selectorDataForRecalcStyle,\n invalidatedNodeList,\n };\n}\n"]}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
export var ThreadType;
|
|
2
|
-
(function (ThreadType) {
|
|
3
|
-
ThreadType["MAIN_THREAD"] = "MAIN_THREAD";
|
|
4
|
-
ThreadType["WORKER"] = "WORKER";
|
|
5
|
-
ThreadType["RASTERIZER"] = "RASTERIZER";
|
|
6
|
-
ThreadType["AUCTION_WORKLET"] = "AUCTION_WORKLET";
|
|
7
|
-
ThreadType["OTHER"] = "OTHER";
|
|
8
|
-
ThreadType["CPU_PROFILE"] = "CPU_PROFILE";
|
|
9
|
-
ThreadType["THREAD_POOL"] = "THREAD_POOL";
|
|
10
|
-
})(ThreadType || (ThreadType = {}));
|
|
11
|
-
function getThreadTypeForRendererThread(pid, thread, auctionWorkletsData) {
|
|
12
|
-
let threadType = ThreadType.OTHER;
|
|
13
|
-
if (thread.name === 'CrRendererMain') {
|
|
14
|
-
threadType = ThreadType.MAIN_THREAD;
|
|
15
|
-
}
|
|
16
|
-
else if (thread.name === 'DedicatedWorker thread') {
|
|
17
|
-
threadType = ThreadType.WORKER;
|
|
18
|
-
}
|
|
19
|
-
else if (thread.name?.startsWith('CompositorTileWorker')) {
|
|
20
|
-
threadType = ThreadType.RASTERIZER;
|
|
21
|
-
}
|
|
22
|
-
else if (auctionWorkletsData.worklets.has(pid)) {
|
|
23
|
-
threadType = ThreadType.AUCTION_WORKLET;
|
|
24
|
-
}
|
|
25
|
-
else if (thread.name?.startsWith('ThreadPool')) {
|
|
26
|
-
// TODO(paulirish): perhaps exclude ThreadPoolServiceThread entirely
|
|
27
|
-
threadType = ThreadType.THREAD_POOL;
|
|
28
|
-
}
|
|
29
|
-
return threadType;
|
|
30
|
-
}
|
|
31
|
-
export function threadsInRenderer(rendererData, auctionWorkletsData) {
|
|
32
|
-
const foundThreads = [];
|
|
33
|
-
// If we have Renderer threads, we prefer to use those. In the event that a
|
|
34
|
-
// trace is a CPU Profile trace, we will never have Renderer threads, so we
|
|
35
|
-
// know if there are no Renderer threads that we can fallback to using the
|
|
36
|
-
// data from the SamplesHandler.
|
|
37
|
-
if (rendererData.processes.size) {
|
|
38
|
-
for (const [pid, process] of rendererData.processes) {
|
|
39
|
-
for (const [tid, thread] of process.threads) {
|
|
40
|
-
if (!thread.tree) {
|
|
41
|
-
// Drop threads where we could not create the tree; this indicates
|
|
42
|
-
// unexpected data and we won't be able to support all the UI
|
|
43
|
-
// filtering we need.
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
const threadType = getThreadTypeForRendererThread(pid, thread, auctionWorkletsData);
|
|
47
|
-
foundThreads.push({
|
|
48
|
-
name: thread.name,
|
|
49
|
-
pid,
|
|
50
|
-
tid,
|
|
51
|
-
processIsOnMainFrame: process.isOnMainFrame,
|
|
52
|
-
entries: thread.entries,
|
|
53
|
-
tree: thread.tree,
|
|
54
|
-
type: threadType,
|
|
55
|
-
entryToNode: rendererData.entryToNode,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return foundThreads;
|
|
61
|
-
}
|
|
62
|
-
const threadsInHandlerDataCache = new WeakMap();
|
|
63
|
-
/**
|
|
64
|
-
* Given trace parsed data, this helper will return a high level array of
|
|
65
|
-
* ThreadData. This is useful because it allows you to get a list of threads
|
|
66
|
-
* regardless of if the trace is a CPU Profile or a Tracing profile. Thus you
|
|
67
|
-
* can use this helper to iterate over threads in confidence that it will work
|
|
68
|
-
* for both trace types.
|
|
69
|
-
* The resulting data is cached per-trace, so you can safely call this multiple times.
|
|
70
|
-
*/
|
|
71
|
-
export function threadsInTrace(handlerData) {
|
|
72
|
-
const cached = threadsInHandlerDataCache.get(handlerData);
|
|
73
|
-
if (cached) {
|
|
74
|
-
return cached;
|
|
75
|
-
}
|
|
76
|
-
// If we have Renderer threads, we prefer to use those.
|
|
77
|
-
const threadsFromRenderer = threadsInRenderer(handlerData.Renderer, handlerData.AuctionWorklets);
|
|
78
|
-
if (threadsFromRenderer.length) {
|
|
79
|
-
threadsInHandlerDataCache.set(handlerData, threadsFromRenderer);
|
|
80
|
-
return threadsFromRenderer;
|
|
81
|
-
}
|
|
82
|
-
// If it's a CPU Profile trace, there will be no Renderer threads.
|
|
83
|
-
// We can fallback to using the data from the SamplesHandler.
|
|
84
|
-
const foundThreads = [];
|
|
85
|
-
if (handlerData.Samples.profilesInProcess.size) {
|
|
86
|
-
for (const [pid, process] of handlerData.Samples.profilesInProcess) {
|
|
87
|
-
for (const [tid, thread] of process) {
|
|
88
|
-
if (!thread.profileTree) {
|
|
89
|
-
// Drop threads where we could not create the tree; this indicates
|
|
90
|
-
// unexpected data and we won't be able to support all the UI
|
|
91
|
-
// filtering we need.
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
foundThreads.push({
|
|
95
|
-
pid,
|
|
96
|
-
tid,
|
|
97
|
-
// CPU Profile threads do not have a name.
|
|
98
|
-
name: null,
|
|
99
|
-
entries: thread.profileCalls,
|
|
100
|
-
// There is no concept of a "Main Frame" in a CPU profile.
|
|
101
|
-
processIsOnMainFrame: false,
|
|
102
|
-
tree: thread.profileTree,
|
|
103
|
-
type: ThreadType.CPU_PROFILE,
|
|
104
|
-
entryToNode: handlerData.Samples.entryToNode,
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
threadsInHandlerDataCache.set(handlerData, foundThreads);
|
|
110
|
-
return foundThreads;
|
|
111
|
-
}
|
|
112
|
-
//# sourceMappingURL=Threads.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Threads.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/hand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,CAAC;IAED,kEAAkE;IAClE,6DAA6D;IAC7D,MAAM,YAAY,GAAiB,EAAE,CAAC;IACtC,IAAI,WAAW,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;QAC/C,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC;YACnE,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;gBACpC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;oBACxB,kEAAkE;oBAClE,6DAA6D;oBAC7D,qBAAqB;oBACrB,SAAS;gBACX,CAAC;gBAED,YAAY,CAAC,IAAI,CAAC;oBAChB,GAAG;oBACH,GAAG;oBACH,0CAA0C;oBAC1C,IAAI,EAAE,IAAI;oBACV,OAAO,EAAE,MAAM,CAAC,YAAY;oBAC5B,0DAA0D;oBAC1D,oBAAoB,EAAE,KAAK;oBAC3B,IAAI,EAAE,MAAM,CAAC,WAAW;oBACxB,IAAI,EAAE,UAAU,CAAC,WAAW;oBAC5B,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,WAAW;iBAC7C,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAED,yBAAyB,CAAC,GAAG,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IACzD,OAAO,YAAY,CAAC;AACtB,CAAC","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 Helpers from '../helpers/helpers.js';\nimport type * as Types from '../types/types.js';\n\nimport type {AuctionWorkletsData} from './AuctionWorkletsHandler.js';\nimport type * as Renderer from './RendererHandler.js';\nimport type {HandlerData} from './types.js';\n\nexport interface ThreadData {\n pid: Types.Events.ProcessID;\n tid: Types.Events.ThreadID;\n entries: readonly Types.Events.Event[];\n processIsOnMainFrame: boolean;\n tree: Helpers.TreeHelpers.TraceEntryTree;\n type: ThreadType;\n name: string|null;\n entryToNode: Map<Types.Events.Event, Helpers.TreeHelpers.TraceEntryNode>;\n}\n\nexport enum ThreadType {\n MAIN_THREAD = 'MAIN_THREAD',\n WORKER = 'WORKER',\n RASTERIZER = 'RASTERIZER',\n AUCTION_WORKLET = 'AUCTION_WORKLET',\n OTHER = 'OTHER',\n CPU_PROFILE = 'CPU_PROFILE',\n THREAD_POOL = 'THREAD_POOL',\n}\n\nfunction getThreadTypeForRendererThread(\n pid: Types.Events.ProcessID, thread: Renderer.RendererThread,\n auctionWorkletsData: AuctionWorkletsData): ThreadType {\n let threadType = ThreadType.OTHER;\n if (thread.name === 'CrRendererMain') {\n threadType = ThreadType.MAIN_THREAD;\n } else if (thread.name === 'DedicatedWorker thread') {\n threadType = ThreadType.WORKER;\n } else if (thread.name?.startsWith('CompositorTileWorker')) {\n threadType = ThreadType.RASTERIZER;\n } else if (auctionWorkletsData.worklets.has(pid)) {\n threadType = ThreadType.AUCTION_WORKLET;\n } else if (thread.name?.startsWith('ThreadPool')) {\n // TODO(paulirish): perhaps exclude ThreadPoolServiceThread entirely\n threadType = ThreadType.THREAD_POOL;\n }\n return threadType;\n}\n\nexport function threadsInRenderer(\n rendererData: Renderer.RendererHandlerData, auctionWorkletsData: AuctionWorkletsData): readonly ThreadData[] {\n const foundThreads: ThreadData[] = [];\n // If we have Renderer threads, we prefer to use those. In the event that a\n // trace is a CPU Profile trace, we will never have Renderer threads, so we\n // know if there are no Renderer threads that we can fallback to using the\n // data from the SamplesHandler.\n if (rendererData.processes.size) {\n for (const [pid, process] of rendererData.processes) {\n for (const [tid, thread] of process.threads) {\n if (!thread.tree) {\n // Drop threads where we could not create the tree; this indicates\n // unexpected data and we won't be able to support all the UI\n // filtering we need.\n continue;\n }\n const threadType = getThreadTypeForRendererThread(pid, thread, auctionWorkletsData);\n foundThreads.push({\n name: thread.name,\n pid,\n tid,\n processIsOnMainFrame: process.isOnMainFrame,\n entries: thread.entries,\n tree: thread.tree,\n type: threadType,\n entryToNode: rendererData.entryToNode,\n });\n }\n }\n }\n return foundThreads;\n}\n\nconst threadsInHandlerDataCache = new WeakMap<HandlerData, readonly ThreadData[]>();\n\n/**\n * Given trace parsed data, this helper will return a high level array of\n * ThreadData. This is useful because it allows you to get a list of threads\n * regardless of if the trace is a CPU Profile or a Tracing profile. Thus you\n * can use this helper to iterate over threads in confidence that it will work\n * for both trace types.\n * The resulting data is cached per-trace, so you can safely call this multiple times.\n */\nexport function threadsInTrace(handlerData: HandlerData): readonly ThreadData[] {\n const cached = threadsInHandlerDataCache.get(handlerData);\n if (cached) {\n return cached;\n }\n\n // If we have Renderer threads, we prefer to use those.\n const threadsFromRenderer = threadsInRenderer(handlerData.Renderer, handlerData.AuctionWorklets);\n if (threadsFromRenderer.length) {\n threadsInHandlerDataCache.set(handlerData, threadsFromRenderer);\n return threadsFromRenderer;\n }\n\n // If it's a CPU Profile trace, there will be no Renderer threads.\n // We can fallback to using the data from the SamplesHandler.\n const foundThreads: ThreadData[] = [];\n if (handlerData.Samples.profilesInProcess.size) {\n for (const [pid, process] of handlerData.Samples.profilesInProcess) {\n for (const [tid, thread] of process) {\n if (!thread.profileTree) {\n // Drop threads where we could not create the tree; this indicates\n // unexpected data and we won't be able to support all the UI\n // filtering we need.\n continue;\n }\n\n foundThreads.push({\n pid,\n tid,\n // CPU Profile threads do not have a name.\n name: null,\n entries: thread.profileCalls,\n // There is no concept of a \"Main Frame\" in a CPU profile.\n processIsOnMainFrame: false,\n tree: thread.profileTree,\n type: ThreadType.CPU_PROFILE,\n entryToNode: handlerData.Samples.entryToNode,\n });\n }\n }\n }\n\n threadsInHandlerDataCache.set(handlerData, foundThreads);\n return foundThreads;\n}\n"]}
|