@paulirish/trace_engine 0.0.59 → 0.0.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.tmp/tsbuildinfo/analyze-trace.d.mts +2 -3
- package/.tmp/tsbuildinfo/analyze-trace.d.mts.map +1 -1
- package/.tmp/tsbuildinfo/tsconfig.tsbuildinfo +1 -1
- package/LICENSE +1 -1
- package/README.md +28 -1
- package/analyze-trace.mjs +5 -3
- package/core/platform/ArrayUtilities.d.ts +1 -0
- package/core/platform/ArrayUtilities.js +2 -2
- package/core/platform/ArrayUtilities.js.map +1 -1
- package/core/platform/Brand.js +1 -1
- package/core/platform/Brand.js.map +1 -1
- package/core/platform/Constructor.js +1 -1
- package/core/platform/Constructor.js.map +1 -1
- package/core/platform/DOMUtilities.js +1 -1
- package/core/platform/DOMUtilities.js.map +1 -1
- package/core/platform/DateUtilities.js +1 -1
- package/core/platform/DateUtilities.js.map +1 -1
- package/core/platform/DevToolsPath.js +1 -1
- package/core/platform/DevToolsPath.js.map +1 -1
- package/core/platform/KeyboardUtilities.js +1 -1
- package/core/platform/KeyboardUtilities.js.map +1 -1
- package/core/platform/MapUtilities.js +1 -1
- package/core/platform/MapUtilities.js.map +1 -1
- package/core/platform/MimeType.js +1 -1
- package/core/platform/MimeType.js.map +1 -1
- package/core/platform/NumberUtilities.js +1 -1
- package/core/platform/NumberUtilities.js.map +1 -1
- package/core/platform/StringUtilities.d.ts +2 -1
- package/core/platform/StringUtilities.js +34 -32
- package/core/platform/StringUtilities.js.map +1 -1
- package/core/platform/Timing.js +1 -1
- package/core/platform/Timing.js.map +1 -1
- package/core/platform/TypedArrayUtilities.js +1 -1
- package/core/platform/TypedArrayUtilities.js.map +1 -1
- package/core/platform/TypescriptUtilities.js +1 -1
- package/core/platform/TypescriptUtilities.js.map +1 -1
- package/core/platform/UIString.js +1 -1
- package/core/platform/UIString.js.map +1 -1
- package/core/platform/UserVisibleError.js +1 -1
- package/core/platform/UserVisibleError.js.map +1 -1
- package/core/platform/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/core/platform/platform-tsconfig.json +6 -2
- package/core/platform/platform.js +3 -29
- package/core/platform/platform.js.map +1 -1
- package/generated/protocol.d.ts +188 -15
- package/generated/protocol.js +1 -1
- package/locales/af.json +3 -3
- package/locales/am.json +4 -4
- package/locales/ar.json +14 -14
- package/locales/as.json +3 -3
- package/locales/az.json +4 -4
- package/locales/be.json +3 -3
- package/locales/bg.json +3 -3
- package/locales/bn.json +4 -4
- package/locales/bs.json +4 -4
- package/locales/ca.json +3 -3
- package/locales/cs.json +3 -3
- package/locales/cy.json +4 -4
- package/locales/da.json +3 -3
- package/locales/de.json +3 -3
- package/locales/el.json +3 -3
- package/locales/en-GB.json +3 -3
- package/locales/en-US.json +26 -26
- package/locales/en-XL.json +26 -26
- package/locales/es-419.json +3 -3
- package/locales/es.json +3 -3
- package/locales/et.json +3 -3
- package/locales/eu.json +4 -4
- package/locales/fa.json +5 -5
- package/locales/fi.json +3 -3
- package/locales/fil.json +3 -3
- package/locales/fr-CA.json +4 -4
- package/locales/fr.json +3 -3
- package/locales/gl.json +3 -3
- package/locales/gu.json +3 -3
- package/locales/he.json +26 -26
- package/locales/hi.json +3 -3
- package/locales/hr.json +7 -7
- package/locales/hu.json +3 -3
- package/locales/hy.json +3 -3
- package/locales/id.json +3 -3
- package/locales/is.json +3 -3
- package/locales/it.json +3 -3
- package/locales/ja.json +3 -3
- package/locales/ka.json +4 -4
- package/locales/kk.json +3 -3
- package/locales/km.json +4 -4
- package/locales/kn.json +5 -5
- package/locales/ko.json +4 -4
- package/locales/ky.json +3 -3
- package/locales/lo.json +4 -4
- package/locales/lt.json +3 -3
- package/locales/lv.json +4 -4
- package/locales/mk.json +3 -3
- package/locales/ml.json +5 -5
- package/locales/mn.json +3 -3
- package/locales/mr.json +3 -3
- package/locales/ms.json +3 -3
- package/locales/my.json +6 -6
- package/locales/ne.json +25 -25
- package/locales/nl.json +3 -3
- package/locales/no.json +3 -3
- package/locales/or.json +3 -3
- package/locales/pa.json +3 -3
- package/locales/pl.json +3 -3
- package/locales/pt-PT.json +3 -3
- package/locales/pt.json +3 -3
- package/locales/ro.json +4 -4
- package/locales/ru.json +3 -3
- package/locales/si.json +4 -4
- package/locales/sk.json +3 -3
- package/locales/sl.json +3 -3
- package/locales/sq.json +4 -4
- package/locales/sr-Latn.json +3 -3
- package/locales/sr.json +3 -3
- package/locales/sv.json +3 -3
- package/locales/sw.json +3 -3
- package/locales/ta.json +3 -3
- package/locales/te.json +4 -4
- package/locales/th.json +3 -3
- package/locales/tr.json +3 -3
- package/locales/uk.json +3 -3
- package/locales/ur.json +4 -4
- package/locales/uz.json +3 -3
- package/locales/vi.json +3 -3
- package/locales/zh-HK.json +3 -3
- package/locales/zh-TW.json +4 -4
- package/locales/zh.json +3 -3
- package/locales/zu.json +3 -3
- package/models/cpu_profile/CPUProfileDataModel.d.ts +1 -0
- package/models/cpu_profile/CPUProfileDataModel.js +1 -1
- package/models/cpu_profile/CPUProfileDataModel.js.map +1 -1
- package/models/cpu_profile/ProfileTreeModel.d.ts +1 -1
- package/models/cpu_profile/ProfileTreeModel.js +1 -1
- package/models/cpu_profile/ProfileTreeModel.js.map +1 -1
- package/models/cpu_profile/cpu_profile-tsconfig.json +6 -2
- package/models/cpu_profile/cpu_profile.js +1 -1
- package/models/cpu_profile/cpu_profile.js.map +1 -1
- package/models/cpu_profile/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/EntityMapper.d.ts +33 -0
- package/models/trace/EntityMapper.js +123 -0
- package/models/trace/EntityMapper.js.map +1 -0
- package/models/trace/EventsSerializer.d.ts +11 -0
- package/models/trace/EventsSerializer.js +82 -0
- package/models/trace/EventsSerializer.js.map +1 -0
- package/models/trace/LanternComputationData.d.ts +3 -3
- package/models/trace/LanternComputationData.js +11 -10
- package/models/trace/LanternComputationData.js.map +1 -1
- package/models/trace/ModelImpl.d.ts +7 -14
- package/models/trace/ModelImpl.js +25 -52
- package/models/trace/ModelImpl.js.map +1 -1
- package/models/trace/Name.d.ts +12 -0
- package/models/trace/Name.js +115 -0
- package/models/trace/Name.js.map +1 -0
- package/models/trace/Processor.d.ts +1 -1
- package/models/trace/Processor.js +42 -61
- package/models/trace/Processor.js.map +1 -1
- package/models/trace/Styles.d.ts +50 -0
- package/models/trace/Styles.js +816 -0
- package/models/trace/Styles.js.map +1 -0
- package/models/trace/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/extras/FilmStrip.d.ts +1 -1
- package/models/trace/extras/FilmStrip.js +7 -7
- package/models/trace/extras/FilmStrip.js.map +1 -1
- package/models/trace/extras/MainThreadActivity.js +1 -1
- package/models/trace/extras/MainThreadActivity.js.map +1 -1
- package/models/trace/extras/ScriptDuplication.js +1 -1
- package/models/trace/extras/ScriptDuplication.js.map +1 -1
- package/models/trace/extras/StackTraceForEvent.d.ts +2 -2
- package/models/trace/extras/StackTraceForEvent.js +21 -21
- package/models/trace/extras/StackTraceForEvent.js.map +1 -1
- package/models/trace/extras/ThirdParties.d.ts +2 -2
- package/models/trace/extras/ThirdParties.js +17 -17
- package/models/trace/extras/ThirdParties.js.map +1 -1
- package/models/trace/extras/TraceFilter.d.ts +1 -1
- package/models/trace/extras/TraceFilter.js +1 -1
- package/models/trace/extras/TraceFilter.js.map +1 -1
- package/models/trace/extras/TraceTree.d.ts +1 -0
- package/models/trace/extras/TraceTree.js +2 -2
- package/models/trace/extras/TraceTree.js.map +1 -1
- package/models/trace/extras/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/extras/extras-tsconfig.json +6 -2
- package/models/trace/extras/extras.d.ts +0 -3978
- package/models/trace/extras/extras.js +0 -3978
- package/models/trace/extras/extras.js.map +1 -1
- package/models/trace/handlers/AnimationFramesHandler.js +11 -11
- package/models/trace/handlers/AnimationFramesHandler.js.map +1 -1
- package/models/trace/handlers/AnimationHandler.js +5 -5
- package/models/trace/handlers/AnimationHandler.js.map +1 -1
- package/models/trace/handlers/AsyncJSCallsHandler.d.ts +3 -3
- package/models/trace/handlers/AsyncJSCallsHandler.js +9 -9
- package/models/trace/handlers/AsyncJSCallsHandler.js.map +1 -1
- package/models/trace/handlers/AuctionWorkletsHandler.js +12 -12
- package/models/trace/handlers/AuctionWorkletsHandler.js.map +1 -1
- package/models/trace/handlers/DOMStatsHandler.js +3 -3
- package/models/trace/handlers/DOMStatsHandler.js.map +1 -1
- package/models/trace/handlers/ExtensionTraceDataHandler.d.ts +15 -2
- package/models/trace/handlers/ExtensionTraceDataHandler.js +53 -41
- package/models/trace/handlers/ExtensionTraceDataHandler.js.map +1 -1
- package/models/trace/handlers/FlowsHandler.js +11 -11
- package/models/trace/handlers/FlowsHandler.js.map +1 -1
- package/models/trace/handlers/FramesHandler.d.ts +7 -0
- package/models/trace/handlers/FramesHandler.js +12 -10
- package/models/trace/handlers/FramesHandler.js.map +1 -1
- package/models/trace/handlers/GPUHandler.js +3 -3
- package/models/trace/handlers/GPUHandler.js.map +1 -1
- package/models/trace/handlers/ImagePaintingHandler.js +13 -13
- package/models/trace/handlers/ImagePaintingHandler.js.map +1 -1
- package/models/trace/handlers/InitiatorsHandler.js +32 -41
- package/models/trace/handlers/InitiatorsHandler.js.map +1 -1
- package/models/trace/handlers/InvalidationsHandler.js +63 -44
- package/models/trace/handlers/InvalidationsHandler.js.map +1 -1
- package/models/trace/handlers/LargestImagePaintHandler.js +5 -4
- package/models/trace/handlers/LargestImagePaintHandler.js.map +1 -1
- package/models/trace/handlers/LargestTextPaintHandler.js +3 -3
- package/models/trace/handlers/LargestTextPaintHandler.js.map +1 -1
- package/models/trace/handlers/LayerTreeHandler.js +11 -11
- package/models/trace/handlers/LayerTreeHandler.js.map +1 -1
- package/models/trace/handlers/LayoutShiftsHandler.d.ts +17 -4
- package/models/trace/handlers/LayoutShiftsHandler.js +41 -38
- package/models/trace/handlers/LayoutShiftsHandler.js.map +1 -1
- package/models/trace/handlers/MemoryHandler.js +3 -3
- package/models/trace/handlers/MemoryHandler.js.map +1 -1
- package/models/trace/handlers/MetaHandler.d.ts +16 -0
- package/models/trace/handlers/MetaHandler.js +29 -28
- package/models/trace/handlers/MetaHandler.js.map +1 -1
- package/models/trace/handlers/ModelHandlers.js +1 -1
- package/models/trace/handlers/ModelHandlers.js.map +1 -1
- package/models/trace/handlers/NetworkRequestsHandler.d.ts +10 -0
- package/models/trace/handlers/NetworkRequestsHandler.js +44 -25
- package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -1
- package/models/trace/handlers/PageFramesHandler.js +3 -3
- package/models/trace/handlers/PageFramesHandler.js.map +1 -1
- package/models/trace/handlers/PageLoadMetricsHandler.js +5 -5
- package/models/trace/handlers/PageLoadMetricsHandler.js.map +1 -1
- package/models/trace/handlers/RendererHandler.d.ts +1 -1
- package/models/trace/handlers/RendererHandler.js +22 -22
- package/models/trace/handlers/RendererHandler.js.map +1 -1
- package/models/trace/handlers/SamplesHandler.d.ts +2 -2
- package/models/trace/handlers/SamplesHandler.js +7 -9
- package/models/trace/handlers/SamplesHandler.js.map +1 -1
- package/models/trace/handlers/ScreenshotsHandler.js +9 -10
- package/models/trace/handlers/ScreenshotsHandler.js.map +1 -1
- package/models/trace/handlers/ScriptsHandler.js +9 -8
- package/models/trace/handlers/ScriptsHandler.js.map +1 -1
- package/models/trace/handlers/SelectorStatsHandler.d.ts +2 -2
- package/models/trace/handlers/SelectorStatsHandler.js +13 -13
- package/models/trace/handlers/SelectorStatsHandler.js.map +1 -1
- package/models/trace/handlers/Threads.d.ts +2 -2
- package/models/trace/handlers/Threads.js +9 -9
- package/models/trace/handlers/Threads.js.map +1 -1
- package/models/trace/handlers/UserInteractionsHandler.d.ts +10 -3
- package/models/trace/handlers/UserInteractionsHandler.js +104 -84
- package/models/trace/handlers/UserInteractionsHandler.js.map +1 -1
- package/models/trace/handlers/UserTimingsHandler.d.ts +1 -1
- package/models/trace/handlers/UserTimingsHandler.js +16 -17
- package/models/trace/handlers/UserTimingsHandler.js.map +1 -1
- package/models/trace/handlers/WarningsHandler.js +14 -14
- package/models/trace/handlers/WarningsHandler.js.map +1 -1
- package/models/trace/handlers/WorkersHandler.js +7 -7
- package/models/trace/handlers/WorkersHandler.js.map +1 -1
- package/models/trace/handlers/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/handlers/handlers-tsconfig.json +6 -2
- package/models/trace/handlers/handlers.js +1 -1
- package/models/trace/handlers/handlers.js.map +1 -1
- package/models/trace/handlers/helpers.d.ts +3 -2
- package/models/trace/handlers/helpers.js +10 -10
- package/models/trace/handlers/helpers.js.map +1 -1
- package/models/trace/handlers/types.d.ts +25 -2
- package/models/trace/handlers/types.js.map +1 -1
- package/models/trace/helpers/Extensions.js +8 -8
- package/models/trace/helpers/Extensions.js.map +1 -1
- package/models/trace/helpers/Network.js.map +1 -1
- package/models/trace/helpers/SamplesIntegrator.js +11 -9
- package/models/trace/helpers/SamplesIntegrator.js.map +1 -1
- package/models/trace/helpers/SyntheticEvents.js +1 -1
- package/models/trace/helpers/SyntheticEvents.js.map +1 -1
- package/models/trace/helpers/Timing.d.ts +4 -0
- package/models/trace/helpers/Timing.js +6 -4
- package/models/trace/helpers/Timing.js.map +1 -1
- package/models/trace/helpers/Trace.d.ts +19 -20
- package/models/trace/helpers/Trace.js +148 -60
- package/models/trace/helpers/Trace.js.map +1 -1
- package/models/trace/helpers/TreeHelpers.js +1 -1
- package/models/trace/helpers/TreeHelpers.js.map +1 -1
- package/models/trace/helpers/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/helpers/helpers-tsconfig.json +6 -2
- package/models/trace/helpers/helpers.js +1 -1
- package/models/trace/helpers/helpers.js.map +1 -1
- package/models/trace/insights/CLSCulprits.d.ts +3 -3
- package/models/trace/insights/CLSCulprits.js +16 -15
- package/models/trace/insights/CLSCulprits.js.map +1 -1
- package/models/trace/insights/Cache.d.ts +3 -2
- package/models/trace/insights/Cache.js +10 -6
- package/models/trace/insights/Cache.js.map +1 -1
- package/models/trace/insights/Common.d.ts +8 -1
- package/models/trace/insights/Common.js +16 -1
- package/models/trace/insights/Common.js.map +1 -1
- package/models/trace/insights/DOMSize.d.ts +4 -3
- package/models/trace/insights/DOMSize.js +12 -8
- package/models/trace/insights/DOMSize.js.map +1 -1
- package/models/trace/insights/DocumentLatency.d.ts +3 -3
- package/models/trace/insights/DocumentLatency.js +20 -18
- package/models/trace/insights/DocumentLatency.js.map +1 -1
- package/models/trace/insights/DuplicatedJavaScript.d.ts +3 -3
- package/models/trace/insights/DuplicatedJavaScript.js +7 -6
- package/models/trace/insights/DuplicatedJavaScript.js.map +1 -1
- package/models/trace/insights/FontDisplay.d.ts +3 -2
- package/models/trace/insights/FontDisplay.js +9 -5
- package/models/trace/insights/FontDisplay.js.map +1 -1
- package/models/trace/insights/ForcedReflow.d.ts +3 -2
- package/models/trace/insights/ForcedReflow.js +8 -4
- package/models/trace/insights/ForcedReflow.js.map +1 -1
- package/models/trace/insights/INPBreakdown.d.ts +4 -4
- package/models/trace/insights/INPBreakdown.js +18 -6
- package/models/trace/insights/INPBreakdown.js.map +1 -1
- package/models/trace/insights/ImageDelivery.d.ts +3 -3
- package/models/trace/insights/ImageDelivery.js +15 -14
- package/models/trace/insights/ImageDelivery.js.map +1 -1
- package/models/trace/insights/LCPBreakdown.d.ts +4 -3
- package/models/trace/insights/LCPBreakdown.js +19 -8
- package/models/trace/insights/LCPBreakdown.js.map +1 -1
- package/models/trace/insights/LCPDiscovery.d.ts +3 -3
- package/models/trace/insights/LCPDiscovery.js +8 -7
- package/models/trace/insights/LCPDiscovery.js.map +1 -1
- package/models/trace/insights/LegacyJavaScript.d.ts +2 -2
- package/models/trace/insights/LegacyJavaScript.js +7 -5
- package/models/trace/insights/LegacyJavaScript.js.map +1 -1
- package/models/trace/insights/Models.js +1 -1
- package/models/trace/insights/Models.js.map +1 -1
- package/models/trace/insights/ModernHTTP.d.ts +3 -3
- package/models/trace/insights/ModernHTTP.js +8 -7
- package/models/trace/insights/ModernHTTP.js.map +1 -1
- package/models/trace/insights/NetworkDependencyTree.d.ts +7 -4
- package/models/trace/insights/NetworkDependencyTree.js +21 -17
- package/models/trace/insights/NetworkDependencyTree.js.map +1 -1
- package/models/trace/insights/RenderBlocking.d.ts +2 -2
- package/models/trace/insights/RenderBlocking.js +13 -12
- package/models/trace/insights/RenderBlocking.js.map +1 -1
- package/models/trace/insights/SlowCSSSelector.d.ts +4 -3
- package/models/trace/insights/SlowCSSSelector.js +11 -7
- package/models/trace/insights/SlowCSSSelector.js.map +1 -1
- package/models/trace/insights/Statistics.js +1 -1
- package/models/trace/insights/Statistics.js.map +1 -1
- package/models/trace/insights/ThirdParties.d.ts +2 -1
- package/models/trace/insights/ThirdParties.js +10 -6
- package/models/trace/insights/ThirdParties.js.map +1 -1
- package/models/trace/insights/Viewport.d.ts +3 -2
- package/models/trace/insights/Viewport.js +10 -6
- package/models/trace/insights/Viewport.js.map +1 -1
- package/models/trace/insights/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/insights/insights-tsconfig.json +6 -2
- package/models/trace/insights/insights.d.ts +2 -0
- package/models/trace/insights/insights.js +3 -1
- package/models/trace/insights/insights.js.map +1 -1
- package/models/trace/insights/types.d.ts +6 -2
- package/models/trace/insights/types.js +2 -1
- package/models/trace/insights/types.js.map +1 -1
- package/models/trace/lantern/core/LanternError.js +1 -1
- package/models/trace/lantern/core/LanternError.js.map +1 -1
- package/models/trace/lantern/core/NetworkAnalyzer.js +1 -1
- package/models/trace/lantern/core/NetworkAnalyzer.js.map +1 -1
- package/models/trace/lantern/core/core-tsconfig.json +6 -2
- package/models/trace/lantern/core/core.js +1 -1
- package/models/trace/lantern/core/core.js.map +1 -1
- package/models/trace/lantern/core/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/lantern/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/lantern/graph/BaseNode.js +1 -1
- package/models/trace/lantern/graph/BaseNode.js.map +1 -1
- package/models/trace/lantern/graph/CPUNode.js +1 -1
- package/models/trace/lantern/graph/CPUNode.js.map +1 -1
- package/models/trace/lantern/graph/NetworkNode.js +1 -1
- package/models/trace/lantern/graph/NetworkNode.js.map +1 -1
- package/models/trace/lantern/graph/PageDependencyGraph.js +1 -1
- package/models/trace/lantern/graph/PageDependencyGraph.js.map +1 -1
- package/models/trace/lantern/graph/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/lantern/graph/graph-tsconfig.json +6 -2
- package/models/trace/lantern/graph/graph.js +1 -1
- package/models/trace/lantern/graph/graph.js.map +1 -1
- package/models/trace/lantern/lantern-tsconfig.json +6 -2
- package/models/trace/lantern/lantern.js +1 -1
- package/models/trace/lantern/lantern.js.map +1 -1
- package/models/trace/lantern/metrics/FirstContentfulPaint.js +1 -1
- package/models/trace/lantern/metrics/FirstContentfulPaint.js.map +1 -1
- package/models/trace/lantern/metrics/Interactive.js +1 -1
- package/models/trace/lantern/metrics/Interactive.js.map +1 -1
- package/models/trace/lantern/metrics/LargestContentfulPaint.js +1 -1
- package/models/trace/lantern/metrics/LargestContentfulPaint.js.map +1 -1
- package/models/trace/lantern/metrics/MaxPotentialFID.js +1 -1
- package/models/trace/lantern/metrics/MaxPotentialFID.js.map +1 -1
- package/models/trace/lantern/metrics/Metric.js +1 -1
- package/models/trace/lantern/metrics/Metric.js.map +1 -1
- package/models/trace/lantern/metrics/SpeedIndex.js +1 -1
- package/models/trace/lantern/metrics/SpeedIndex.js.map +1 -1
- package/models/trace/lantern/metrics/TBTUtils.js +1 -1
- package/models/trace/lantern/metrics/TBTUtils.js.map +1 -1
- package/models/trace/lantern/metrics/TotalBlockingTime.js +1 -1
- package/models/trace/lantern/metrics/TotalBlockingTime.js.map +1 -1
- package/models/trace/lantern/metrics/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/lantern/metrics/metrics-tsconfig.json +6 -2
- package/models/trace/lantern/metrics/metrics.js +1 -1
- package/models/trace/lantern/metrics/metrics.js.map +1 -1
- package/models/trace/lantern/simulation/ConnectionPool.js +1 -1
- package/models/trace/lantern/simulation/ConnectionPool.js.map +1 -1
- package/models/trace/lantern/simulation/Constants.js +1 -1
- package/models/trace/lantern/simulation/Constants.js.map +1 -1
- package/models/trace/lantern/simulation/DNSCache.js +1 -1
- package/models/trace/lantern/simulation/DNSCache.js.map +1 -1
- package/models/trace/lantern/simulation/SimulationTimingMap.js +1 -1
- package/models/trace/lantern/simulation/SimulationTimingMap.js.map +1 -1
- package/models/trace/lantern/simulation/Simulator.js +1 -1
- package/models/trace/lantern/simulation/Simulator.js.map +1 -1
- package/models/trace/lantern/simulation/TCPConnection.js +1 -1
- package/models/trace/lantern/simulation/TCPConnection.js.map +1 -1
- package/models/trace/lantern/simulation/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/lantern/simulation/simulation-tsconfig.json +6 -2
- package/models/trace/lantern/simulation/simulation.js +1 -1
- package/models/trace/lantern/simulation/simulation.js.map +1 -1
- package/models/trace/lantern/types/Lantern.js +1 -1
- package/models/trace/lantern/types/Lantern.js.map +1 -1
- package/models/trace/lantern/types/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/lantern/types/types-tsconfig.json +6 -2
- package/models/trace/lantern/types/types.js +1 -1
- package/models/trace/lantern/types/types.js.map +1 -1
- package/models/trace/trace-tsconfig.json +10 -2
- package/models/trace/trace.d.ts +5 -1
- package/models/trace/trace.js +6 -2
- package/models/trace/trace.js.map +1 -1
- package/models/trace/types/Configuration.d.ts +11 -0
- package/models/trace/types/Configuration.js +1 -1
- package/models/trace/types/Configuration.js.map +1 -1
- package/models/trace/types/Extensions.d.ts +25 -13
- package/models/trace/types/Extensions.js +6 -3
- package/models/trace/types/Extensions.js.map +1 -1
- package/models/trace/types/File.d.ts +12 -0
- package/models/trace/types/File.js +1 -1
- package/models/trace/types/File.js.map +1 -1
- package/models/trace/types/Overlays.d.ts +1 -2
- package/models/trace/types/Overlays.js +1 -1
- package/models/trace/types/Overlays.js.map +1 -1
- package/models/trace/types/Timing.d.ts +1 -0
- package/models/trace/types/Timing.js +1 -1
- package/models/trace/types/Timing.js.map +1 -1
- package/models/trace/types/TraceEvents.d.ts +75 -56
- package/models/trace/types/TraceEvents.js +42 -29
- package/models/trace/types/TraceEvents.js.map +1 -1
- package/models/trace/types/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/types/types-tsconfig.json +6 -2
- package/models/trace/types/types.js +1 -1
- package/models/trace/types/types.js.map +1 -1
- package/package.json +1 -1
- package/test/test-trace-engine.mjs +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImagePaintingHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/ImagePaintingHandler.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,IAAI,IAAI,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAGzD;;;;;;;;;;;;;;GAcG;AAEH,yCAAyC;AACzC,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAiF,CAAC;AAClH,MAAM,wBAAwB,GAC1B,IAAI,GAAG,EAAyF,CAAC;AAErG,iEAAiE;AACjE,8EAA8E;AAC9E,8EAA8E;AAC9E,0BAA0B;AAC1B,MAAM,wBAAwB,GAAG,IAAI,GAAG,EAAmC,CAAC;AAE5E,qGAAqG;AACrG,+EAA+E;AAC/E,8EAA8E;AAC9E,wDAAwD;AACxD,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAA+C,CAAC;AAEjF,MAAM,eAAe,GAAG,IAAI,GAAG,EAAqC,CAAC;AAErE,MAAM,gCAAgC,GAAG,IAAI,GAAG,EAA4D,CAAC;AAE7G,IAAI,oB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AI,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;YAC5C,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;gBACrC,MAAM,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;gBAC7E,MAAM,eAAe,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;gBAC/E,MAAM,KAAK,GAAG,cAAc,GAAG,WAAW,CAAC;gBAC3C,MAAM,MAAM,GAAG,eAAe,GAAG,WAAW,CAAC;gBAC7C,gCAAgC,CAAC,GAAG,CAAC,UAAU,EAAE,EAAC,KAAK,EAAE,MAAM,EAAC,CAAC,CAAC;YACpE,CAAC;QACH,CAAC;IACH,CAAC;IAED,oBAAoB,GAAG,IAAI,CAAC;AAC9B,CAAC;AAWD,MAAM,UAAU,IAAI;IAClB,OAAO;QACL,4BAA4B,EAAE,wBAAwB;QACtD,kBAAkB,EAAE,iBAAiB;QACrC,qBAAqB,EAAE,eAAe;QACtC,gCAAgC;QAChC,oBAAoB;KACrB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Platform from '../../../core/platform/platform.js';\nimport * as Types from '../types/types.js';\n\nimport {data as metaHandlerData} from './MetaHandler.js';\nimport type {FinalizeOptions} from './types.js';\n\n/**\n * This handler is responsible for the relationships between:\n * DecodeImage/ResizeImage, PaintImage and DrawLazyPixelRef events.\n *\n * When we get a DecodeImage event, we want to associate it to a PaintImage\n * event, primarily so we can determine the NodeID of the image that was\n * decoded.\n * We can do this in two ways:\n *\n * 1. If there is a PaintImage event on the same thread, use that\n * (if there are multiple, use the latest one).\n *\n * 2. If not, we can find the DecodeLazyPixelRef event on the same thread, and\n * use the PaintImage event associated with it via the `LazyPixelRef` key.\n */\n\n// Track paintImageEvents across threads.\nconst paintImageEvents = new Map<Types.Events.ProcessID, Map<Types.Events.ThreadID, Types.Events.PaintImage[]>>();\nconst decodeLazyPixelRefEvents =\n new Map<Types.Events.ProcessID, Map<Types.Events.ThreadID, Types.Events.DecodeLazyPixelRef[]>>();\n\n// A DrawLazyPixelRef event will contain a numerical reference in\n// args.LazyPixelRef. As we parse each DrawLazyPixelRef, we can assign it to a\n// paint event. Later we want to look up paint events by this reference, so we\n// store them in this map.\nconst paintImageByLazyPixelRef = new Map<number, Types.Events.PaintImage>();\n\n// When we find events that we want to tie to a particular PaintImage event, we add them to this map.\n// These are currently only DecodeImage and ResizeImage events, but the type is\n// deliberately generic as in the future we might want to add more events that\n// have a relationship to a individual PaintImage event.\nconst eventToPaintImage = new Map<Types.Events.Event, Types.Events.PaintImage>();\n\nconst urlToPaintImage = new Map<string, Types.Events.PaintImage[]>();\n\nconst paintEventToCorrectedDisplaySize = new Map<Types.Events.PaintImage, {width: number, height: number}>();\n\nlet didCorrectForHostDpr = false;\n\nexport function reset(): void {\n paintImageEvents.clear();\n decodeLazyPixelRefEvents.clear();\n paintImageByLazyPixelRef.clear();\n eventToPaintImage.clear();\n urlToPaintImage.clear();\n paintEventToCorrectedDisplaySize.clear();\n didCorrectForHostDpr = false;\n}\n\nexport function handleEvent(event: Types.Events.Event): void {\n if (Types.Events.isPaintImage(event)) {\n const forProcess = paintImageEvents.get(event.pid) || new Map<Types.Events.ThreadID, Types.Events.PaintImage[]>();\n const forThread = forProcess.get(event.tid) || [];\n forThread.push(event);\n forProcess.set(event.tid, forThread);\n paintImageEvents.set(event.pid, forProcess);\n\n if (event.args.data.url) {\n const paintsForUrl = Platform.MapUtilities.getWithDefault(urlToPaintImage, event.args.data.url, () => []);\n paintsForUrl.push(event);\n }\n\n return;\n }\n\n if (Types.Events.isDecodeLazyPixelRef(event) && typeof event.args?.LazyPixelRef !== 'undefined') {\n // Store these because we use them to tie DecodeImage to a PaintEvent.\n const forProcess =\n decodeLazyPixelRefEvents.get(event.pid) || new Map<Types.Events.ThreadID, Types.Events.DecodeLazyPixelRef[]>();\n const forThread = forProcess.get(event.tid) || [];\n forThread.push(event);\n forProcess.set(event.tid, forThread);\n decodeLazyPixelRefEvents.set(event.pid, forProcess);\n }\n\n // If we see a DrawLazyPixelRef event, we need to find the last PaintImage\n // event on the thread and associate it to the LazyPixelRef that is supplied\n // in the DrawLazyPixelRef event.\n // This means that later on if we see a DecodeLazyPixelRef event with the\n // same LazyPixelRef key, we can find its associated PaintImage event by\n // looking it up.\n if (Types.Events.isDrawLazyPixelRef(event) && typeof event.args?.LazyPixelRef !== 'undefined') {\n const lastPaintEvent = paintImageEvents.get(event.pid)?.get(event.tid)?.at(-1);\n if (!lastPaintEvent) {\n return;\n }\n paintImageByLazyPixelRef.set(event.args.LazyPixelRef, lastPaintEvent);\n return;\n }\n\n if (Types.Events.isDecodeImage(event)) {\n // When we see a DecodeImage, we want to associate it to a PaintImage\n // event. We try two approaches:\n //\n // 1. If the thread of the DecodeImage event has a previous PaintImage\n // event, that is the associated event.\n //\n // 2. If that is false, we then look on the thread for a DecodeLazyPixelRef\n // event. If we find that, we then look for its associated PaintImage\n // event, which we associate via DrawLazyPixelRef events (the code block\n // above this one)\n //\n // 1. Find a PaintImage event on the same thread. If we find it, that's our association done.\n const lastPaintImageEventOnThread = paintImageEvents.get(event.pid)?.get(event.tid)?.at(-1);\n if (lastPaintImageEventOnThread) {\n eventToPaintImage.set(event, lastPaintImageEventOnThread);\n return;\n }\n\n // 2. Find the last DecodeLazyPixelRef event and, if we find it, find its associated PaintImage event.\n const lastDecodeLazyPixelRef = decodeLazyPixelRefEvents.get(event.pid)?.get(event.tid)?.at(-1);\n if (typeof lastDecodeLazyPixelRef?.args?.LazyPixelRef === 'undefined') {\n return;\n }\n\n const paintEvent = paintImageByLazyPixelRef.get(lastDecodeLazyPixelRef.args.LazyPixelRef);\n if (!paintEvent) {\n return;\n }\n eventToPaintImage.set(event, paintEvent);\n }\n}\n\nexport async function finalize(options: FinalizeOptions): Promise<void> {\n // Painting in Chrome never uses the emulated DPR, but instead used the host's DPR.\n // We need to correct for that for our responsive image checks in the ImageDelivery\n // insight.\n // See: crbug.com/427552461 crbug.com/416580500#comment5\n\n if (!options.metadata?.hostDPR) {\n return;\n }\n\n // Note: this isn't necessarily emulated (for desktop+no DPR emulation, it's equal\n // to host DPR).\n const {devicePixelRatio: emulatedDpr} = metaHandlerData();\n if (!emulatedDpr) {\n return;\n }\n\n for (const byThread of paintImageEvents.values()) {\n for (const paintEvents of byThread.values()) {\n for (const paintEvent of paintEvents) {\n const cssPixelsWidth = paintEvent.args.data.width / options.metadata.hostDPR;\n const cssPixelsHeight = paintEvent.args.data.height / options.metadata.hostDPR;\n const width = cssPixelsWidth * emulatedDpr;\n const height = cssPixelsHeight * emulatedDpr;\n paintEventToCorrectedDisplaySize.set(paintEvent, {width, height});\n }\n }\n }\n\n didCorrectForHostDpr = true;\n}\n\nexport interface ImagePaintData {\n paintImageByDrawLazyPixelRef: Map<number, Types.Events.PaintImage>;\n paintImageForEvent: Map<Types.Events.Event, Types.Events.PaintImage>;\n paintImageEventForUrl: Map<string, Types.Events.PaintImage[]>;\n paintEventToCorrectedDisplaySize: Map<Types.Events.PaintImage, {width: number, height: number}>;\n /** Go read the comment in finalize(). */\n didCorrectForHostDpr: boolean;\n}\n\nexport function data(): ImagePaintData {\n return {\n paintImageByDrawLazyPixelRef: paintImageByLazyPixelRef,\n paintImageForEvent: eventToPaintImage,\n paintImageEventForUrl: urlToPaintImage,\n paintEventToCorrectedDisplaySize,\n didCorrectForHostDpr,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ImagePaintingHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/ImagePaintingHandler.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAC/D,OAA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AI;IAClB,OAAO;QACL,4BAA4B,EAAE,wBAAwB;QACtD,kBAAkB,EAAE,iBAAiB;QACrC,qBAAqB,EAAE,eAAe;QACtC,gCAAgC;QAChC,oBAAoB;KACrB,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 * as Platform from '../../../core/platform/platform.js';\nimport * as Types from '../types/types.js';\n\nimport {data as metaHandlerData} from './MetaHandler.js';\nimport type {FinalizeOptions} from './types.js';\n\n/**\n * This handler is responsible for the relationships between:\n * DecodeImage/ResizeImage, PaintImage and DrawLazyPixelRef events.\n *\n * When we get a DecodeImage event, we want to associate it to a PaintImage\n * event, primarily so we can determine the NodeID of the image that was\n * decoded.\n * We can do this in two ways:\n *\n * 1. If there is a PaintImage event on the same thread, use that\n * (if there are multiple, use the latest one).\n *\n * 2. If not, we can find the DecodeLazyPixelRef event on the same thread, and\n * use the PaintImage event associated with it via the `LazyPixelRef` key.\n */\n\n// Track paintImageEvents across threads.\nlet paintImageEvents = new Map<Types.Events.ProcessID, Map<Types.Events.ThreadID, Types.Events.PaintImage[]>>();\nlet decodeLazyPixelRefEvents =\n new Map<Types.Events.ProcessID, Map<Types.Events.ThreadID, Types.Events.DecodeLazyPixelRef[]>>();\n\n// A DrawLazyPixelRef event will contain a numerical reference in\n// args.LazyPixelRef. As we parse each DrawLazyPixelRef, we can assign it to a\n// paint event. Later we want to look up paint events by this reference, so we\n// store them in this map.\nlet paintImageByLazyPixelRef = new Map<number, Types.Events.PaintImage>();\n\n// When we find events that we want to tie to a particular PaintImage event, we add them to this map.\n// These are currently only DecodeImage and ResizeImage events, but the type is\n// deliberately generic as in the future we might want to add more events that\n// have a relationship to a individual PaintImage event.\nlet eventToPaintImage = new Map<Types.Events.Event, Types.Events.PaintImage>();\n\nlet urlToPaintImage = new Map<string, Types.Events.PaintImage[]>();\n\nlet paintEventToCorrectedDisplaySize = new Map<Types.Events.PaintImage, {width: number, height: number}>();\n\nlet didCorrectForHostDpr = false;\n\nexport function reset(): void {\n paintImageEvents = new Map();\n decodeLazyPixelRefEvents = new Map();\n paintImageByLazyPixelRef = new Map();\n eventToPaintImage = new Map();\n urlToPaintImage = new Map();\n paintEventToCorrectedDisplaySize = new Map();\n didCorrectForHostDpr = false;\n}\n\nexport function handleEvent(event: Types.Events.Event): void {\n if (Types.Events.isPaintImage(event)) {\n const forProcess = paintImageEvents.get(event.pid) || new Map<Types.Events.ThreadID, Types.Events.PaintImage[]>();\n const forThread = forProcess.get(event.tid) || [];\n forThread.push(event);\n forProcess.set(event.tid, forThread);\n paintImageEvents.set(event.pid, forProcess);\n\n if (event.args.data.url) {\n const paintsForUrl = Platform.MapUtilities.getWithDefault(urlToPaintImage, event.args.data.url, () => []);\n paintsForUrl.push(event);\n }\n\n return;\n }\n\n if (Types.Events.isDecodeLazyPixelRef(event) && typeof event.args?.LazyPixelRef !== 'undefined') {\n // Store these because we use them to tie DecodeImage to a PaintEvent.\n const forProcess =\n decodeLazyPixelRefEvents.get(event.pid) || new Map<Types.Events.ThreadID, Types.Events.DecodeLazyPixelRef[]>();\n const forThread = forProcess.get(event.tid) || [];\n forThread.push(event);\n forProcess.set(event.tid, forThread);\n decodeLazyPixelRefEvents.set(event.pid, forProcess);\n }\n\n // If we see a DrawLazyPixelRef event, we need to find the last PaintImage\n // event on the thread and associate it to the LazyPixelRef that is supplied\n // in the DrawLazyPixelRef event.\n // This means that later on if we see a DecodeLazyPixelRef event with the\n // same LazyPixelRef key, we can find its associated PaintImage event by\n // looking it up.\n if (Types.Events.isDrawLazyPixelRef(event) && typeof event.args?.LazyPixelRef !== 'undefined') {\n const lastPaintEvent = paintImageEvents.get(event.pid)?.get(event.tid)?.at(-1);\n if (!lastPaintEvent) {\n return;\n }\n paintImageByLazyPixelRef.set(event.args.LazyPixelRef, lastPaintEvent);\n return;\n }\n\n if (Types.Events.isDecodeImage(event)) {\n // When we see a DecodeImage, we want to associate it to a PaintImage\n // event. We try two approaches:\n //\n // 1. If the thread of the DecodeImage event has a previous PaintImage\n // event, that is the associated event.\n //\n // 2. If that is false, we then look on the thread for a DecodeLazyPixelRef\n // event. If we find that, we then look for its associated PaintImage\n // event, which we associate via DrawLazyPixelRef events (the code block\n // above this one)\n //\n // 1. Find a PaintImage event on the same thread. If we find it, that's our association done.\n const lastPaintImageEventOnThread = paintImageEvents.get(event.pid)?.get(event.tid)?.at(-1);\n if (lastPaintImageEventOnThread) {\n eventToPaintImage.set(event, lastPaintImageEventOnThread);\n return;\n }\n\n // 2. Find the last DecodeLazyPixelRef event and, if we find it, find its associated PaintImage event.\n const lastDecodeLazyPixelRef = decodeLazyPixelRefEvents.get(event.pid)?.get(event.tid)?.at(-1);\n if (typeof lastDecodeLazyPixelRef?.args?.LazyPixelRef === 'undefined') {\n return;\n }\n\n const paintEvent = paintImageByLazyPixelRef.get(lastDecodeLazyPixelRef.args.LazyPixelRef);\n if (!paintEvent) {\n return;\n }\n eventToPaintImage.set(event, paintEvent);\n }\n}\n\nexport async function finalize(options: FinalizeOptions): Promise<void> {\n // Painting in Chrome never uses the emulated DPR, but instead used the host's DPR.\n // We need to correct for that for our responsive image checks in the ImageDelivery\n // insight.\n // See: crbug.com/427552461 crbug.com/416580500#comment5\n\n if (!options.metadata?.hostDPR) {\n return;\n }\n\n // Note: this isn't necessarily emulated (for desktop+no DPR emulation, it's equal\n // to host DPR).\n const {devicePixelRatio: emulatedDpr} = metaHandlerData();\n if (!emulatedDpr) {\n return;\n }\n\n for (const byThread of paintImageEvents.values()) {\n for (const paintEvents of byThread.values()) {\n for (const paintEvent of paintEvents) {\n const cssPixelsWidth = paintEvent.args.data.width / options.metadata.hostDPR;\n const cssPixelsHeight = paintEvent.args.data.height / options.metadata.hostDPR;\n const width = cssPixelsWidth * emulatedDpr;\n const height = cssPixelsHeight * emulatedDpr;\n paintEventToCorrectedDisplaySize.set(paintEvent, {width, height});\n }\n }\n }\n\n didCorrectForHostDpr = true;\n}\n\nexport interface ImagePaintData {\n paintImageByDrawLazyPixelRef: Map<number, Types.Events.PaintImage>;\n paintImageForEvent: Map<Types.Events.Event, Types.Events.PaintImage>;\n paintImageEventForUrl: Map<string, Types.Events.PaintImage[]>;\n paintEventToCorrectedDisplaySize: Map<Types.Events.PaintImage, {width: number, height: number}>;\n /** Go read the comment in finalize(). */\n didCorrectForHostDpr: boolean;\n}\n\nexport function data(): ImagePaintData {\n return {\n paintImageByDrawLazyPixelRef: paintImageByLazyPixelRef,\n paintImageForEvent: eventToPaintImage,\n paintImageEventForUrl: urlToPaintImage,\n paintEventToCorrectedDisplaySize,\n didCorrectForHostDpr,\n };\n}\n"]}
|
|
@@ -1,44 +1,38 @@
|
|
|
1
|
-
// Copyright 2023 The Chromium Authors
|
|
1
|
+
// Copyright 2023 The Chromium Authors
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
import * as Helpers from '../helpers/helpers.js';
|
|
5
5
|
import * as Types from '../types/types.js';
|
|
6
6
|
import { data as AsyncJSCallsHandlerData } from './AsyncJSCallsHandler.js';
|
|
7
7
|
import { data as flowsHandlerData } from './FlowsHandler.js';
|
|
8
|
-
|
|
8
|
+
let lastScheduleStyleRecalcByFrame = new Map();
|
|
9
9
|
// This tracks the last event that is considered to have invalidated the layout
|
|
10
10
|
// for a given frame.
|
|
11
11
|
// Note that although there is an InvalidateLayout event, there are also other
|
|
12
12
|
// events (ScheduleStyleRecalculation) that could be the reason a layout was
|
|
13
13
|
// invalidated.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// present these to the user as "Recalculate Style". So don't get confused!
|
|
17
|
-
// These are the same - just UpdateLayoutTree is what the event from Chromium
|
|
18
|
-
// is called.
|
|
19
|
-
const lastUpdateLayoutTreeByFrame = new Map();
|
|
14
|
+
let lastInvalidationEventForFrame = new Map();
|
|
15
|
+
let lastRecalcByFrame = new Map();
|
|
20
16
|
// These two maps store the same data but in different directions.
|
|
21
17
|
// For a given event, tell me what its initiator was. An event can only have one initiator.
|
|
22
|
-
|
|
18
|
+
let eventToInitiatorMap = new Map();
|
|
23
19
|
// For a given event, tell me what events it initiated. An event can initiate
|
|
24
20
|
// multiple events, hence why the value for this map is an array.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const schedulePostTaskCallbackEventsById = new Map();
|
|
21
|
+
let initiatorToEventsMap = new Map();
|
|
22
|
+
let timerInstallEventsById = new Map();
|
|
23
|
+
let requestIdleCallbackEventsById = new Map();
|
|
24
|
+
let webSocketCreateEventsById = new Map();
|
|
25
|
+
let schedulePostTaskCallbackEventsById = new Map();
|
|
31
26
|
export function reset() {
|
|
32
|
-
lastScheduleStyleRecalcByFrame
|
|
33
|
-
lastInvalidationEventForFrame
|
|
34
|
-
|
|
35
|
-
timerInstallEventsById
|
|
36
|
-
eventToInitiatorMap
|
|
37
|
-
initiatorToEventsMap
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
schedulePostTaskCallbackEventsById.clear();
|
|
27
|
+
lastScheduleStyleRecalcByFrame = new Map();
|
|
28
|
+
lastInvalidationEventForFrame = new Map();
|
|
29
|
+
lastRecalcByFrame = new Map();
|
|
30
|
+
timerInstallEventsById = new Map();
|
|
31
|
+
eventToInitiatorMap = new Map();
|
|
32
|
+
initiatorToEventsMap = new Map();
|
|
33
|
+
requestIdleCallbackEventsById = new Map();
|
|
34
|
+
webSocketCreateEventsById = new Map();
|
|
35
|
+
schedulePostTaskCallbackEventsById = new Map();
|
|
42
36
|
}
|
|
43
37
|
function storeInitiator(data) {
|
|
44
38
|
eventToInitiatorMap.set(data.event, data.initiator);
|
|
@@ -60,14 +54,11 @@ export function handleEvent(event) {
|
|
|
60
54
|
if (Types.Events.isScheduleStyleRecalculation(event)) {
|
|
61
55
|
lastScheduleStyleRecalcByFrame.set(event.args.data.frame, event);
|
|
62
56
|
}
|
|
63
|
-
else if (Types.Events.
|
|
64
|
-
// IMPORTANT: although the trace event is called UpdateLayoutTree, this
|
|
65
|
-
// represents a Styles Recalculation. This event in the timeline is shown to
|
|
66
|
-
// the user as "Recalculate Styles."
|
|
57
|
+
else if (Types.Events.isRecalcStyle(event)) {
|
|
67
58
|
if (event.args.beginData) {
|
|
68
|
-
// Store the last
|
|
59
|
+
// Store the last RecalcStyle event: we use this when we see an
|
|
69
60
|
// InvalidateLayout and try to figure out its initiator.
|
|
70
|
-
|
|
61
|
+
lastRecalcByFrame.set(event.args.beginData.frame, event);
|
|
71
62
|
// If this frame has seen a ScheduleStyleRecalc event, then that event is
|
|
72
63
|
// considered to be the initiator of this StylesRecalc.
|
|
73
64
|
const scheduledStyleForFrame = lastScheduleStyleRecalcByFrame.get(event.args.beginData.frame);
|
|
@@ -87,16 +78,16 @@ export function handleEvent(event) {
|
|
|
87
78
|
// cause of this layout invalidation.
|
|
88
79
|
if (!lastInvalidationEventForFrame.has(event.args.data.frame)) {
|
|
89
80
|
// 1. If we have not had an invalidation event for this frame
|
|
90
|
-
// 2. AND we have had an
|
|
91
|
-
// 3. AND the
|
|
92
|
-
// 4. AND we have an initiator for the
|
|
93
|
-
// 5. Then we set the last invalidation event for this frame to be the
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
96
|
-
const { endTime } = Helpers.Timing.eventTimingsMicroSeconds(
|
|
97
|
-
const
|
|
98
|
-
if (
|
|
99
|
-
invalidationInitiator =
|
|
81
|
+
// 2. AND we have had an RecalcStyle for this frame
|
|
82
|
+
// 3. AND the RecalcStyle event ended AFTER the InvalidateLayout startTime
|
|
83
|
+
// 4. AND we have an initiator for the RecalcStyle event
|
|
84
|
+
// 5. Then we set the last invalidation event for this frame to be the RecalcStyle's initiator.
|
|
85
|
+
const lastRecalcStyleForFrame = lastRecalcByFrame.get(event.args.data.frame);
|
|
86
|
+
if (lastRecalcStyleForFrame) {
|
|
87
|
+
const { endTime } = Helpers.Timing.eventTimingsMicroSeconds(lastRecalcStyleForFrame);
|
|
88
|
+
const initiatorOfRecalcStyle = eventToInitiatorMap.get(lastRecalcStyleForFrame);
|
|
89
|
+
if (initiatorOfRecalcStyle && endTime && endTime > event.ts) {
|
|
90
|
+
invalidationInitiator = initiatorOfRecalcStyle;
|
|
100
91
|
}
|
|
101
92
|
}
|
|
102
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitiatorsHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/InitiatorsHandler.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,IAAI,IAAI,uBAAuB,EAAC,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAC,IAAI,IAAI,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAE3D,MAAM,8BAA8B,GAAG,IAAI,GAAG,EAAmD,CAAC;AAElG,+EAA+E;AAC/E,qBAAqB;AACrB,8EAA8E;AAC9E,4EAA4E;AAC5E,eAAe;AACf,MAAM,6BAA6B,GAAG,IAAI,GAAG,EAA8B,CAAC;AAE5E,yEAAyE;AACzE,2EAA2E;AAC3E,6EAA6E;AAC7E,aAAa;AACb,MAAM,2BAA2B,GAAG,IAAI,GAAG,EAAyC,CAAC;AAErF,kEAAkE;AAClE,2FAA2F;AAC3F,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAA0C,CAAC;AAC9E,6EAA6E;AAC7E,iEAAiE;AACjE,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAA4C,CAAC;AAEjF,MAAM,+BAA+B,GAAG,IAAI,GAAG,EAA8C,CAAC;AAC9F,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAqC,CAAC;AAC5E,MAAM,6BAA6B,GAAG,IAAI,GAAG,EAA4C,CAAC;AAE1F,MAAM,yBAAyB,G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L,gBAAgB,EAAE,mBAAmB;QACrC,iBAAiB,EAAE,oBAAoB;KACxC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;AACnC,CAAC","sourcesContent":["// Copyright 2023 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport {data as AsyncJSCallsHandlerData} from './AsyncJSCallsHandler.js';\nimport {data as flowsHandlerData} from './FlowsHandler.js';\n\nconst lastScheduleStyleRecalcByFrame = new Map<string, Types.Events.ScheduleStyleRecalculation>();\n\n// This tracks the last event that is considered to have invalidated the layout\n// for a given frame.\n// Note that although there is an InvalidateLayout event, there are also other\n// events (ScheduleStyleRecalculation) that could be the reason a layout was\n// invalidated.\nconst lastInvalidationEventForFrame = new Map<string, Types.Events.Event>();\n\n// Important: although the event is called UpdateLayoutTree, in the UI we\n// present these to the user as \"Recalculate Style\". So don't get confused!\n// These are the same - just UpdateLayoutTree is what the event from Chromium\n// is called.\nconst lastUpdateLayoutTreeByFrame = new Map<string, Types.Events.UpdateLayoutTree>();\n\n// These two maps store the same data but in different directions.\n// For a given event, tell me what its initiator was. An event can only have one initiator.\nconst eventToInitiatorMap = new Map<Types.Events.Event, Types.Events.Event>();\n// For a given event, tell me what events it initiated. An event can initiate\n// multiple events, hence why the value for this map is an array.\nconst initiatorToEventsMap = new Map<Types.Events.Event, Types.Events.Event[]>();\n\nconst requestAnimationFrameEventsById = new Map<number, Types.Events.RequestAnimationFrame>();\nconst timerInstallEventsById = new Map<number, Types.Events.TimerInstall>();\nconst requestIdleCallbackEventsById = new Map<number, Types.Events.RequestIdleCallback>();\n\nconst webSocketCreateEventsById = new Map<number, Types.Events.WebSocketCreate>();\nconst schedulePostTaskCallbackEventsById = new Map<number, Types.Events.SchedulePostTaskCallback>();\n\nexport function reset(): void {\n lastScheduleStyleRecalcByFrame.clear();\n lastInvalidationEventForFrame.clear();\n lastUpdateLayoutTreeByFrame.clear();\n timerInstallEventsById.clear();\n eventToInitiatorMap.clear();\n initiatorToEventsMap.clear();\n requestAnimationFrameEventsById.clear();\n requestIdleCallbackEventsById.clear();\n webSocketCreateEventsById.clear();\n schedulePostTaskCallbackEventsById.clear();\n}\n\nfunction storeInitiator(data: {initiator: Types.Events.Event, event: Types.Events.Event}): void {\n eventToInitiatorMap.set(data.event, data.initiator);\n const eventsForInitiator = initiatorToEventsMap.get(data.initiator) || [];\n eventsForInitiator.push(data.event);\n initiatorToEventsMap.set(data.initiator, eventsForInitiator);\n}\n\n/**\n * IMPORTANT: Before adding support for new initiator relationships in\n * trace events consider using Perfetto's flow API on the events in\n * question, so that they get automatically computed.\n * @see {@link flowsHandlerData}\n *\n * The events manually computed here were added before we had support\n * for flow events. As such they should be migrated to use the flow\n * API so that no manual parsing is needed.\n */\nexport function handleEvent(event: Types.Events.Event): void {\n if (Types.Events.isScheduleStyleRecalculation(event)) {\n lastScheduleStyleRecalcByFrame.set(event.args.data.frame, event);\n } else if (Types.Events.isUpdateLayoutTree(event)) {\n // IMPORTANT: although the trace event is called UpdateLayoutTree, this\n // represents a Styles Recalculation. This event in the timeline is shown to\n // the user as \"Recalculate Styles.\"\n if (event.args.beginData) {\n // Store the last UpdateLayout event: we use this when we see an\n // InvalidateLayout and try to figure out its initiator.\n lastUpdateLayoutTreeByFrame.set(event.args.beginData.frame, event);\n\n // If this frame has seen a ScheduleStyleRecalc event, then that event is\n // considered to be the initiator of this StylesRecalc.\n const scheduledStyleForFrame = lastScheduleStyleRecalcByFrame.get(event.args.beginData.frame);\n if (scheduledStyleForFrame) {\n storeInitiator({\n event,\n initiator: scheduledStyleForFrame,\n });\n }\n }\n } else if (Types.Events.isInvalidateLayout(event)) {\n // By default, the InvalidateLayout event is what triggered the layout invalidation for this frame.\n let invalidationInitiator: Types.Events.Event = event;\n\n // However, if we have not had any prior invalidations for this frame, we\n // want to consider StyleRecalculation events as they might be the actual\n // cause of this layout invalidation.\n if (!lastInvalidationEventForFrame.has(event.args.data.frame)) {\n // 1. If we have not had an invalidation event for this frame\n // 2. AND we have had an UpdateLayoutTree for this frame\n // 3. AND the UpdateLayoutTree event ended AFTER the InvalidateLayout startTime\n // 4. AND we have an initiator for the UpdateLayoutTree event\n // 5. Then we set the last invalidation event for this frame to be the UpdateLayoutTree's initiator.\n const lastUpdateLayoutTreeForFrame = lastUpdateLayoutTreeByFrame.get(event.args.data.frame);\n if (lastUpdateLayoutTreeForFrame) {\n const {endTime} = Helpers.Timing.eventTimingsMicroSeconds(lastUpdateLayoutTreeForFrame);\n const initiatorOfUpdateLayout = eventToInitiatorMap.get(lastUpdateLayoutTreeForFrame);\n\n if (initiatorOfUpdateLayout && endTime && endTime > event.ts) {\n invalidationInitiator = initiatorOfUpdateLayout;\n }\n }\n }\n lastInvalidationEventForFrame.set(event.args.data.frame, invalidationInitiator);\n } else if (Types.Events.isLayout(event)) {\n // The initiator of a Layout event is the last Invalidation event.\n const lastInvalidation = lastInvalidationEventForFrame.get(event.args.beginData.frame);\n if (lastInvalidation) {\n storeInitiator({\n event,\n initiator: lastInvalidation,\n });\n }\n // Now clear the last invalidation for the frame: the last invalidation has been linked to a Layout event, so it cannot be the initiator for any future layouts.\n lastInvalidationEventForFrame.delete(event.args.beginData.frame);\n } else if (Types.Events.isTimerInstall(event)) {\n timerInstallEventsById.set(event.args.data.timerId, event);\n } else if (Types.Events.isTimerFire(event)) {\n const matchingInstall = timerInstallEventsById.get(event.args.data.timerId);\n if (matchingInstall) {\n storeInitiator({event, initiator: matchingInstall});\n }\n } else if (Types.Events.isRequestIdleCallback(event)) {\n requestIdleCallbackEventsById.set(event.args.data.id, event);\n } else if (Types.Events.isFireIdleCallback(event)) {\n const matchingRequestEvent = requestIdleCallbackEventsById.get(event.args.data.id);\n if (matchingRequestEvent) {\n storeInitiator({\n event,\n initiator: matchingRequestEvent,\n });\n }\n } else if (Types.Events.isWebSocketCreate(event)) {\n webSocketCreateEventsById.set(event.args.data.identifier, event);\n } else if (Types.Events.isWebSocketInfo(event) || Types.Events.isWebSocketTransfer(event)) {\n const matchingCreateEvent = webSocketCreateEventsById.get(event.args.data.identifier);\n if (matchingCreateEvent) {\n storeInitiator({\n event,\n initiator: matchingCreateEvent,\n });\n }\n } else if (Types.Events.isSchedulePostTaskCallback(event)) {\n schedulePostTaskCallbackEventsById.set(event.args.data.taskId, event);\n } else if (Types.Events.isRunPostTaskCallback(event) || Types.Events.isAbortPostTaskCallback(event)) {\n const matchingSchedule = schedulePostTaskCallbackEventsById.get(event.args.data.taskId);\n if (matchingSchedule) {\n storeInitiator({event, initiator: matchingSchedule});\n }\n }\n}\n\nfunction createRelationshipsFromFlows(): void {\n const flows = flowsHandlerData().flows;\n for (let i = 0; i < flows.length; i++) {\n const flow = flows[i];\n for (let j = 0; j < flow.length - 1; j++) {\n storeInitiator({event: flow[j + 1], initiator: flow[j]});\n }\n }\n}\n\nfunction createRelationshipsFromAsyncJSCalls(): void {\n const asyncCallEntries = AsyncJSCallsHandlerData().schedulerToRunEntryPoints.entries();\n for (const [asyncCaller, asyncCallees] of asyncCallEntries) {\n for (const asyncCallee of asyncCallees) {\n storeInitiator({event: asyncCallee, initiator: asyncCaller});\n }\n }\n}\n\nexport async function finalize(): Promise<void> {\n createRelationshipsFromFlows();\n createRelationshipsFromAsyncJSCalls();\n}\n\nexport interface InitiatorsData {\n eventToInitiator: Map<Types.Events.Event, Types.Events.Event>;\n initiatorToEvents: Map<Types.Events.Event, Types.Events.Event[]>;\n}\n\nexport function data(): InitiatorsData {\n return {\n eventToInitiator: eventToInitiatorMap,\n initiatorToEvents: initiatorToEventsMap,\n };\n}\n\nexport function deps(): ['Flows', 'AsyncJSCalls'] {\n return ['Flows', 'AsyncJSCalls'];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InitiatorsHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/Initiators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AAC,CAAC,CAAC;QACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACzC,cAAc,CAAC,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,mCAAmC;IAC1C,MAAM,gBAAgB,GAAG,uBAAuB,EAAE,CAAC,yBAAyB,CAAC,OAAO,EAAE,CAAC;IACvF,KAAK,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,IAAI,gBAAgB,EAAE,CAAC;QAC3D,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;YACvC,cAAc,CAAC,EAAC,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAC,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC5B,4BAA4B,EAAE,CAAC;IAC/B,mCAAmC,EAAE,CAAC;AACxC,CAAC;AAOD,MAAM,UAAU,IAAI;IAClB,OAAO;QACL,gBAAgB,EAAE,mBAAmB;QACrC,iBAAiB,EAAE,oBAAoB;KACxC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;AACnC,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 * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport {data as AsyncJSCallsHandlerData} from './AsyncJSCallsHandler.js';\nimport {data as flowsHandlerData} from './FlowsHandler.js';\n\nlet lastScheduleStyleRecalcByFrame = new Map<string, Types.Events.ScheduleStyleRecalculation>();\n\n// This tracks the last event that is considered to have invalidated the layout\n// for a given frame.\n// Note that although there is an InvalidateLayout event, there are also other\n// events (ScheduleStyleRecalculation) that could be the reason a layout was\n// invalidated.\nlet lastInvalidationEventForFrame = new Map<string, Types.Events.Event>();\n\nlet lastRecalcByFrame = new Map<string, Types.Events.RecalcStyle>();\n\n// These two maps store the same data but in different directions.\n// For a given event, tell me what its initiator was. An event can only have one initiator.\nlet eventToInitiatorMap = new Map<Types.Events.Event, Types.Events.Event>();\n// For a given event, tell me what events it initiated. An event can initiate\n// multiple events, hence why the value for this map is an array.\nlet initiatorToEventsMap = new Map<Types.Events.Event, Types.Events.Event[]>();\n\nlet timerInstallEventsById = new Map<number, Types.Events.TimerInstall>();\nlet requestIdleCallbackEventsById = new Map<number, Types.Events.RequestIdleCallback>();\n\nlet webSocketCreateEventsById = new Map<number, Types.Events.WebSocketCreate>();\nlet schedulePostTaskCallbackEventsById = new Map<number, Types.Events.SchedulePostTaskCallback>();\n\nexport function reset(): void {\n lastScheduleStyleRecalcByFrame = new Map();\n lastInvalidationEventForFrame = new Map();\n lastRecalcByFrame = new Map();\n timerInstallEventsById = new Map();\n eventToInitiatorMap = new Map();\n initiatorToEventsMap = new Map();\n requestIdleCallbackEventsById = new Map();\n webSocketCreateEventsById = new Map();\n schedulePostTaskCallbackEventsById = new Map();\n}\n\nfunction storeInitiator(data: {initiator: Types.Events.Event, event: Types.Events.Event}): void {\n eventToInitiatorMap.set(data.event, data.initiator);\n const eventsForInitiator = initiatorToEventsMap.get(data.initiator) || [];\n eventsForInitiator.push(data.event);\n initiatorToEventsMap.set(data.initiator, eventsForInitiator);\n}\n\n/**\n * IMPORTANT: Before adding support for new initiator relationships in\n * trace events consider using Perfetto's flow API on the events in\n * question, so that they get automatically computed.\n * @see {@link flowsHandlerData}\n *\n * The events manually computed here were added before we had support\n * for flow events. As such they should be migrated to use the flow\n * API so that no manual parsing is needed.\n */\nexport function handleEvent(event: Types.Events.Event): void {\n if (Types.Events.isScheduleStyleRecalculation(event)) {\n lastScheduleStyleRecalcByFrame.set(event.args.data.frame, event);\n } else if (Types.Events.isRecalcStyle(event)) {\n if (event.args.beginData) {\n // Store the last RecalcStyle event: we use this when we see an\n // InvalidateLayout and try to figure out its initiator.\n lastRecalcByFrame.set(event.args.beginData.frame, event);\n\n // If this frame has seen a ScheduleStyleRecalc event, then that event is\n // considered to be the initiator of this StylesRecalc.\n const scheduledStyleForFrame = lastScheduleStyleRecalcByFrame.get(event.args.beginData.frame);\n if (scheduledStyleForFrame) {\n storeInitiator({\n event,\n initiator: scheduledStyleForFrame,\n });\n }\n }\n } else if (Types.Events.isInvalidateLayout(event)) {\n // By default, the InvalidateLayout event is what triggered the layout invalidation for this frame.\n let invalidationInitiator: Types.Events.Event = event;\n\n // However, if we have not had any prior invalidations for this frame, we\n // want to consider StyleRecalculation events as they might be the actual\n // cause of this layout invalidation.\n if (!lastInvalidationEventForFrame.has(event.args.data.frame)) {\n // 1. If we have not had an invalidation event for this frame\n // 2. AND we have had an RecalcStyle for this frame\n // 3. AND the RecalcStyle event ended AFTER the InvalidateLayout startTime\n // 4. AND we have an initiator for the RecalcStyle event\n // 5. Then we set the last invalidation event for this frame to be the RecalcStyle's initiator.\n const lastRecalcStyleForFrame = lastRecalcByFrame.get(event.args.data.frame);\n if (lastRecalcStyleForFrame) {\n const {endTime} = Helpers.Timing.eventTimingsMicroSeconds(lastRecalcStyleForFrame);\n const initiatorOfRecalcStyle = eventToInitiatorMap.get(lastRecalcStyleForFrame);\n\n if (initiatorOfRecalcStyle && endTime && endTime > event.ts) {\n invalidationInitiator = initiatorOfRecalcStyle;\n }\n }\n }\n lastInvalidationEventForFrame.set(event.args.data.frame, invalidationInitiator);\n } else if (Types.Events.isLayout(event)) {\n // The initiator of a Layout event is the last Invalidation event.\n const lastInvalidation = lastInvalidationEventForFrame.get(event.args.beginData.frame);\n if (lastInvalidation) {\n storeInitiator({\n event,\n initiator: lastInvalidation,\n });\n }\n // Now clear the last invalidation for the frame: the last invalidation has been linked to a Layout event, so it cannot be the initiator for any future layouts.\n lastInvalidationEventForFrame.delete(event.args.beginData.frame);\n } else if (Types.Events.isTimerInstall(event)) {\n timerInstallEventsById.set(event.args.data.timerId, event);\n } else if (Types.Events.isTimerFire(event)) {\n const matchingInstall = timerInstallEventsById.get(event.args.data.timerId);\n if (matchingInstall) {\n storeInitiator({event, initiator: matchingInstall});\n }\n } else if (Types.Events.isRequestIdleCallback(event)) {\n requestIdleCallbackEventsById.set(event.args.data.id, event);\n } else if (Types.Events.isFireIdleCallback(event)) {\n const matchingRequestEvent = requestIdleCallbackEventsById.get(event.args.data.id);\n if (matchingRequestEvent) {\n storeInitiator({\n event,\n initiator: matchingRequestEvent,\n });\n }\n } else if (Types.Events.isWebSocketCreate(event)) {\n webSocketCreateEventsById.set(event.args.data.identifier, event);\n } else if (Types.Events.isWebSocketInfo(event) || Types.Events.isWebSocketTransfer(event)) {\n const matchingCreateEvent = webSocketCreateEventsById.get(event.args.data.identifier);\n if (matchingCreateEvent) {\n storeInitiator({\n event,\n initiator: matchingCreateEvent,\n });\n }\n } else if (Types.Events.isSchedulePostTaskCallback(event)) {\n schedulePostTaskCallbackEventsById.set(event.args.data.taskId, event);\n } else if (Types.Events.isRunPostTaskCallback(event) || Types.Events.isAbortPostTaskCallback(event)) {\n const matchingSchedule = schedulePostTaskCallbackEventsById.get(event.args.data.taskId);\n if (matchingSchedule) {\n storeInitiator({event, initiator: matchingSchedule});\n }\n }\n}\n\nfunction createRelationshipsFromFlows(): void {\n const flows = flowsHandlerData().flows;\n for (let i = 0; i < flows.length; i++) {\n const flow = flows[i];\n for (let j = 0; j < flow.length - 1; j++) {\n storeInitiator({event: flow[j + 1], initiator: flow[j]});\n }\n }\n}\n\nfunction createRelationshipsFromAsyncJSCalls(): void {\n const asyncCallEntries = AsyncJSCallsHandlerData().schedulerToRunEntryPoints.entries();\n for (const [asyncCaller, asyncCallees] of asyncCallEntries) {\n for (const asyncCallee of asyncCallees) {\n storeInitiator({event: asyncCallee, initiator: asyncCaller});\n }\n }\n}\n\nexport async function finalize(): Promise<void> {\n createRelationshipsFromFlows();\n createRelationshipsFromAsyncJSCalls();\n}\n\nexport interface InitiatorsData {\n eventToInitiator: Map<Types.Events.Event, Types.Events.Event>;\n initiatorToEvents: Map<Types.Events.Event, Types.Events.Event[]>;\n}\n\nexport function data(): InitiatorsData {\n return {\n eventToInitiator: eventToInitiatorMap,\n initiatorToEvents: initiatorToEventsMap,\n };\n}\n\nexport function deps(): ['Flows', 'AsyncJSCalls'] {\n return ['Flows', 'AsyncJSCalls'];\n}\n"]}
|
|
@@ -1,34 +1,45 @@
|
|
|
1
|
-
// Copyright 2023 The Chromium Authors
|
|
1
|
+
// Copyright 2023 The Chromium Authors
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
import * as Types from '../types/types.js';
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
let lastRecalcStyleEvent = null;
|
|
8
|
-
// Used to track paints so we track invalidations correctly per paint.
|
|
9
|
-
let hasPainted = false;
|
|
10
|
-
const allInvalidationTrackingEvents = [];
|
|
5
|
+
const frameStateByFrame = new Map();
|
|
6
|
+
let maxInvalidationsPerEvent = null;
|
|
11
7
|
export function reset() {
|
|
12
|
-
|
|
13
|
-
invalidationCountForEvent.clear();
|
|
14
|
-
lastRecalcStyleEvent = null;
|
|
15
|
-
allInvalidationTrackingEvents.length = 0;
|
|
16
|
-
hasPainted = false;
|
|
8
|
+
frameStateByFrame.clear();
|
|
17
9
|
maxInvalidationsPerEvent = null;
|
|
18
10
|
}
|
|
19
|
-
let maxInvalidationsPerEvent = null;
|
|
20
11
|
export function handleUserConfig(userConfig) {
|
|
21
12
|
maxInvalidationsPerEvent = userConfig.maxInvalidationEventsPerEvent;
|
|
22
13
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
14
|
+
function getState(frameId) {
|
|
15
|
+
let frameState = frameStateByFrame.get(frameId);
|
|
16
|
+
if (!frameState) {
|
|
17
|
+
frameState = {
|
|
18
|
+
invalidationsForEvent: new Map(),
|
|
19
|
+
invalidationCountForEvent: new Map(),
|
|
20
|
+
lastRecalcStyleEvent: null,
|
|
21
|
+
pendingInvalidations: [],
|
|
22
|
+
hasPainted: false,
|
|
23
|
+
};
|
|
24
|
+
frameStateByFrame.set(frameId, frameState);
|
|
25
|
+
}
|
|
26
|
+
return frameState;
|
|
27
|
+
}
|
|
28
|
+
function getFrameId(event) {
|
|
29
|
+
if (Types.Events.isRecalcStyle(event) || Types.Events.isLayout(event)) {
|
|
30
|
+
return event.args.beginData?.frame ?? null;
|
|
31
|
+
}
|
|
32
|
+
return event.args?.data?.frame ?? null;
|
|
33
|
+
}
|
|
34
|
+
function addInvalidationToEvent(frameState, event, invalidation) {
|
|
35
|
+
const existingInvalidations = frameState.invalidationsForEvent.get(event) || [];
|
|
25
36
|
existingInvalidations.push(invalidation);
|
|
26
37
|
if (maxInvalidationsPerEvent !== null && existingInvalidations.length > maxInvalidationsPerEvent) {
|
|
27
38
|
existingInvalidations.shift();
|
|
28
39
|
}
|
|
29
|
-
invalidationsForEvent.set(event, existingInvalidations);
|
|
30
|
-
const count = invalidationCountForEvent.get(event) ?? 0;
|
|
31
|
-
invalidationCountForEvent.set(event, count + 1);
|
|
40
|
+
frameState.invalidationsForEvent.set(event, existingInvalidations);
|
|
41
|
+
const count = frameState.invalidationCountForEvent.get(event) ?? 0;
|
|
42
|
+
frameState.invalidationCountForEvent.set(event, count + 1);
|
|
32
43
|
}
|
|
33
44
|
export function handleEvent(event) {
|
|
34
45
|
// Special case: if we have been configured to not store any invalidations,
|
|
@@ -37,69 +48,77 @@ export function handleEvent(event) {
|
|
|
37
48
|
if (maxInvalidationsPerEvent === 0) {
|
|
38
49
|
return;
|
|
39
50
|
}
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
const frameId = getFrameId(event);
|
|
52
|
+
if (!frameId) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const thisFrame = getState(frameId);
|
|
56
|
+
if (Types.Events.isRecalcStyle(event)) {
|
|
57
|
+
thisFrame.lastRecalcStyleEvent = event;
|
|
42
58
|
// Associate any prior invalidations with this recalc event.
|
|
43
|
-
for (const invalidation of
|
|
59
|
+
for (const invalidation of thisFrame.pendingInvalidations) {
|
|
44
60
|
if (Types.Events.isLayoutInvalidationTracking(invalidation)) {
|
|
45
61
|
// LayoutInvalidation events cannot be associated with a LayoutTree
|
|
46
62
|
// event.
|
|
47
63
|
continue;
|
|
48
64
|
}
|
|
49
|
-
|
|
50
|
-
if (recalcFrameId && invalidation.args.data.frame === recalcFrameId) {
|
|
51
|
-
addInvalidationToEvent(event, invalidation);
|
|
52
|
-
}
|
|
65
|
+
addInvalidationToEvent(thisFrame, event, invalidation);
|
|
53
66
|
}
|
|
54
67
|
return;
|
|
55
68
|
}
|
|
56
69
|
if (Types.Events.isInvalidationTracking(event)) {
|
|
57
|
-
if (hasPainted) {
|
|
70
|
+
if (thisFrame.hasPainted) {
|
|
58
71
|
// If we have painted, then we can clear out the list of all existing
|
|
59
72
|
// invalidations, as we cannot associate them across frames.
|
|
60
|
-
|
|
61
|
-
lastRecalcStyleEvent = null;
|
|
62
|
-
hasPainted = false;
|
|
73
|
+
thisFrame.pendingInvalidations.length = 0;
|
|
74
|
+
thisFrame.lastRecalcStyleEvent = null;
|
|
75
|
+
thisFrame.hasPainted = false;
|
|
63
76
|
}
|
|
64
|
-
// Style invalidation events can occur before and during recalc styles. When we get a recalc style event
|
|
65
|
-
// But any invalidations that occur during a
|
|
77
|
+
// Style invalidation events can occur before and during recalc styles. When we get a recalc style event, we check and associate any prior invalidations with it.
|
|
78
|
+
// But any invalidations that occur during a RecalcStyle
|
|
66
79
|
// event would be reported in trace events after. So each time we get an
|
|
67
80
|
// invalidation that might be due to a style recalc, we check if the
|
|
68
81
|
// timings overlap and if so associate them.
|
|
69
|
-
if (lastRecalcStyleEvent &&
|
|
82
|
+
if (thisFrame.lastRecalcStyleEvent &&
|
|
70
83
|
(Types.Events.isScheduleStyleInvalidationTracking(event) ||
|
|
71
84
|
Types.Events.isStyleRecalcInvalidationTracking(event) ||
|
|
72
85
|
Types.Events.isStyleInvalidatorInvalidationTracking(event))) {
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
addInvalidationToEvent(
|
|
86
|
+
const recalcLastRecalc = thisFrame.lastRecalcStyleEvent;
|
|
87
|
+
const recalcEndTime = recalcLastRecalc.ts + (recalcLastRecalc.dur || 0);
|
|
88
|
+
if (event.ts >= recalcLastRecalc.ts && event.ts <= recalcEndTime) {
|
|
89
|
+
addInvalidationToEvent(thisFrame, recalcLastRecalc, event);
|
|
77
90
|
}
|
|
78
91
|
}
|
|
79
|
-
|
|
92
|
+
thisFrame.pendingInvalidations.push(event);
|
|
80
93
|
return;
|
|
81
94
|
}
|
|
82
95
|
if (Types.Events.isPaint(event)) {
|
|
83
|
-
|
|
84
|
-
hasPainted = true;
|
|
96
|
+
thisFrame.hasPainted = true;
|
|
85
97
|
return;
|
|
86
98
|
}
|
|
87
99
|
if (Types.Events.isLayout(event)) {
|
|
88
|
-
const
|
|
89
|
-
for (const invalidation of allInvalidationTrackingEvents) {
|
|
100
|
+
for (const invalidation of thisFrame.pendingInvalidations) {
|
|
90
101
|
// The only invalidations that cause a Layout are LayoutInvalidations :)
|
|
91
102
|
if (!Types.Events.isLayoutInvalidationTracking(invalidation)) {
|
|
92
103
|
continue;
|
|
93
104
|
}
|
|
94
|
-
|
|
95
|
-
addInvalidationToEvent(event, invalidation);
|
|
96
|
-
}
|
|
105
|
+
addInvalidationToEvent(thisFrame, event, invalidation);
|
|
97
106
|
}
|
|
98
107
|
}
|
|
99
108
|
}
|
|
100
109
|
export async function finalize() {
|
|
101
110
|
}
|
|
102
111
|
export function data() {
|
|
112
|
+
const invalidationsForEvent = new Map();
|
|
113
|
+
const invalidationCountForEvent = new Map();
|
|
114
|
+
for (const frame of frameStateByFrame.values()) {
|
|
115
|
+
for (const [event, invalidations] of frame.invalidationsForEvent.entries()) {
|
|
116
|
+
invalidationsForEvent.set(event, invalidations);
|
|
117
|
+
}
|
|
118
|
+
for (const [event, count] of frame.invalidationCountForEvent.entries()) {
|
|
119
|
+
invalidationCountForEvent.set(event, count);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
103
122
|
return {
|
|
104
123
|
invalidationsForEvent,
|
|
105
124
|
invalidationCountForEvent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InvalidationsHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/InvalidationsHandler.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAAgE,CAAC;AACtG,MAAM,yBAAyB,GAAG,IAAI,GAAG,EAA8B,CAAC;AAExE,IAAI,oBAAoB,GAAuC,IAAI,CAAC;AAEpE,sEAAsE;AACtE,IAAI,UAAU,GAAG,KAAK,CAAC;AAEvB,MAAM,6BAA6B,GAA6C,EAAE,CAAC;AAEnF,MAAM,UAAU,KAAK;IACnB,qBAAqB,CAAC,KAAK,EAAE,CAAC;IAC9B,yBAAyB,CAAC,KAAK,EAAE,CAAC;IAClC,oBAAoB,GAAG,IAAI,CAAC;IAC5B,6BAA6B,CAAC,MAAM,GAAG,CAAC,CAAC;IACzC,UAAU,GAAG,KAAK,CAAC;IACnB,wBAAwB,GAAG,IAAI,CAAC;AAClC,CAAC;AAED,IAAI,wBAAwB,GAAgB,IAAI,CAAC;AACjD,MAAM,UAAU,gBAAgB,CAAC,UAA6C;IAC5E,wBAAwB,GAAG,UAAU,CAAC,6BAA6B,CAAC;AACtE,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAyB,EAAE,YAAoD;IAC7G,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI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A6B,EAAE,CAAC;YACzD,wEAAwE;YACxE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,4BAA4B,CAAC,YAAY,CAAC,EAAE,CAAC;gBAC7D,SAAS;YACX,CAAC;YAED,IAAI,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,WAAW,EAAE,CAAC;gBACjD,sBAAsB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ;AAC9B,CAAC;AAOD,MAAM,UAAU,IAAI;IAClB,OAAO;QACL,qBAAqB;QACrB,yBAAyB;KAC1B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright 2023 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Types from '../types/types.js';\n\nconst invalidationsForEvent = new Map<Types.Events.Event, Types.Events.InvalidationTrackingEvent[]>();\nconst invalidationCountForEvent = new Map<Types.Events.Event, number>();\n\nlet lastRecalcStyleEvent: Types.Events.UpdateLayoutTree|null = null;\n\n// Used to track paints so we track invalidations correctly per paint.\nlet hasPainted = false;\n\nconst allInvalidationTrackingEvents: Types.Events.InvalidationTrackingEvent[] = [];\n\nexport function reset(): void {\n invalidationsForEvent.clear();\n invalidationCountForEvent.clear();\n lastRecalcStyleEvent = null;\n allInvalidationTrackingEvents.length = 0;\n hasPainted = false;\n maxInvalidationsPerEvent = null;\n}\n\nlet maxInvalidationsPerEvent: number|null = null;\nexport function handleUserConfig(userConfig: Types.Configuration.Configuration): void {\n maxInvalidationsPerEvent = userConfig.maxInvalidationEventsPerEvent;\n}\n\nfunction addInvalidationToEvent(event: Types.Events.Event, invalidation: Types.Events.InvalidationTrackingEvent): void {\n const existingInvalidations = invalidationsForEvent.get(event) || [];\n existingInvalidations.push(invalidation);\n\n if (maxInvalidationsPerEvent !== null && existingInvalidations.length > maxInvalidationsPerEvent) {\n existingInvalidations.shift();\n }\n invalidationsForEvent.set(event, existingInvalidations);\n\n const count = invalidationCountForEvent.get(event) ?? 0;\n invalidationCountForEvent.set(event, count + 1);\n}\n\nexport function handleEvent(event: Types.Events.Event): void {\n // Special case: if we have been configured to not store any invalidations,\n // we take that as a sign that we don't even want to gather any invalidations\n // data at all and early exit.\n if (maxInvalidationsPerEvent === 0) {\n return;\n }\n\n if (Types.Events.isUpdateLayoutTree(event)) {\n lastRecalcStyleEvent = event;\n\n // Associate any prior invalidations with this recalc event.\n for (const invalidation of allInvalidationTrackingEvents) {\n if (Types.Events.isLayoutInvalidationTracking(invalidation)) {\n // LayoutInvalidation events cannot be associated with a LayoutTree\n // event.\n continue;\n }\n\n const recalcFrameId = lastRecalcStyleEvent.args.beginData?.frame;\n\n if (recalcFrameId && invalidation.args.data.frame === recalcFrameId) {\n addInvalidationToEvent(event, invalidation);\n }\n }\n return;\n }\n\n if (Types.Events.isInvalidationTracking(event)) {\n if (hasPainted) {\n // If we have painted, then we can clear out the list of all existing\n // invalidations, as we cannot associate them across frames.\n allInvalidationTrackingEvents.length = 0;\n lastRecalcStyleEvent = null;\n hasPainted = false;\n }\n\n // Style invalidation events can occur before and during recalc styles. When we get a recalc style event (aka UpdateLayoutTree), we check and associate any prior invalidations with it.\n // But any invalidations that occur during a UpdateLayoutTree\n // event would be reported in trace events after. So each time we get an\n // invalidation that might be due to a style recalc, we check if the\n // timings overlap and if so associate them.\n if (lastRecalcStyleEvent &&\n (Types.Events.isScheduleStyleInvalidationTracking(event) ||\n Types.Events.isStyleRecalcInvalidationTracking(event) ||\n Types.Events.isStyleInvalidatorInvalidationTracking(event))) {\n const recalcEndTime = lastRecalcStyleEvent.ts + (lastRecalcStyleEvent.dur || 0);\n if (event.ts >= lastRecalcStyleEvent.ts && event.ts <= recalcEndTime &&\n lastRecalcStyleEvent.args.beginData?.frame === event.args.data.frame) {\n addInvalidationToEvent(lastRecalcStyleEvent, event);\n }\n }\n\n allInvalidationTrackingEvents.push(event);\n return;\n }\n\n if (Types.Events.isPaint(event)) {\n // Used to ensure that we do not create relationships across frames.\n hasPainted = true;\n return;\n }\n\n if (Types.Events.isLayout(event)) {\n const layoutFrame = event.args.beginData.frame;\n for (const invalidation of allInvalidationTrackingEvents) {\n // The only invalidations that cause a Layout are LayoutInvalidations :)\n if (!Types.Events.isLayoutInvalidationTracking(invalidation)) {\n continue;\n }\n\n if (invalidation.args.data.frame === layoutFrame) {\n addInvalidationToEvent(event, invalidation);\n }\n }\n }\n}\n\nexport async function finalize(): Promise<void> {\n}\n\ninterface InvalidationsData {\n invalidationsForEvent: Map<Types.Events.Event, Types.Events.InvalidationTrackingEvent[]>;\n invalidationCountForEvent: Map<Types.Events.Event, number>;\n}\n\nexport function data(): InvalidationsData {\n return {\n invalidationsForEvent,\n invalidationCountForEvent,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InvalidationsHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/InvalidationsHandler.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAiB3C,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAsC,CAAC;AACxE,IAAI,wBAAwB,GAAgB,IAAI,CAAC;AAEjD,MAAM,UAAU,KAAK;IACnB,iBAAiB,CAAC,KAAK,EAAE,CAAC;IAC1B,wBAAwB,GAAG,IAAI,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,UAA6C;IAC5E,wBAAwB,GAAG,UAAU,CAAC,6BAA6B,CAAC;AACtE,CAAC;AAED,SAAS,QAAQ,CAAC,OAAe;IAC/B,IAAI,UAAU,GAAG,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,UAAU,GAAG;YACX,qBAAqB,EAAE,IAAI,GAAG,EAAE;YAChC,yBAAy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CAAC,KAAK,EAAE,aAAa,CAAC,IAAI,KAAK,CAAC,qBAAqB,CAAC,OAAO,EAAE,EAAE,CAAC;YAC3E,qBAAqB,CAAC,GAAG,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QAClD,CAAC;QACD,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,KAAK,CAAC,yBAAyB,CAAC,OAAO,EAAE,EAAE,CAAC;YACvE,yBAAyB,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IACD,OAAO;QACL,qBAAqB;QACrB,yBAAyB;KAC1B,CAAC;AACJ,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 * as Types from '../types/types.js';\n\n/**\n * @file Associates invalidation to recalc/layout events; mostly used in \"invalidation tracking\" experiment.\n * \"Invalidations\" == \"mutations\" == \"damage\".\n * A DOM change that means we need to recompute style or layout is an invalidation that's tracked here.\n * If the experiment `timeline-invalidation-tracking` is enabled, the `disabledByDefault('devtools.timeline.invalidationTracking')` trace category is enabled, which contains most of these events.\n */\n\ninterface InvalidationsStatePerFrame {\n invalidationsForEvent: Map<Types.Events.Event, Types.Events.InvalidationTrackingEvent[]>;\n invalidationCountForEvent: Map<Types.Events.Event, number>;\n lastRecalcStyleEvent: Types.Events.RecalcStyle|null;\n hasPainted: boolean;\n pendingInvalidations: Types.Events.InvalidationTrackingEvent[];\n}\n\nconst frameStateByFrame = new Map<string, InvalidationsStatePerFrame>();\nlet maxInvalidationsPerEvent: number|null = null;\n\nexport function reset(): void {\n frameStateByFrame.clear();\n maxInvalidationsPerEvent = null;\n}\n\nexport function handleUserConfig(userConfig: Types.Configuration.Configuration): void {\n maxInvalidationsPerEvent = userConfig.maxInvalidationEventsPerEvent;\n}\n\nfunction getState(frameId: string): InvalidationsStatePerFrame {\n let frameState = frameStateByFrame.get(frameId);\n if (!frameState) {\n frameState = {\n invalidationsForEvent: new Map(),\n invalidationCountForEvent: new Map(),\n lastRecalcStyleEvent: null,\n pendingInvalidations: [],\n hasPainted: false,\n };\n frameStateByFrame.set(frameId, frameState);\n }\n return frameState;\n}\n\nfunction getFrameId(event: Types.Events.Event): string|null {\n if (Types.Events.isRecalcStyle(event) || Types.Events.isLayout(event)) {\n return event.args.beginData?.frame ?? null;\n }\n return event.args?.data?.frame ?? null;\n}\n\nfunction addInvalidationToEvent(\n frameState: InvalidationsStatePerFrame, event: Types.Events.Event,\n invalidation: Types.Events.InvalidationTrackingEvent): void {\n const existingInvalidations = frameState.invalidationsForEvent.get(event) || [];\n existingInvalidations.push(invalidation);\n\n if (maxInvalidationsPerEvent !== null && existingInvalidations.length > maxInvalidationsPerEvent) {\n existingInvalidations.shift();\n }\n frameState.invalidationsForEvent.set(event, existingInvalidations);\n\n const count = frameState.invalidationCountForEvent.get(event) ?? 0;\n frameState.invalidationCountForEvent.set(event, count + 1);\n}\n\nexport function handleEvent(event: Types.Events.Event): void {\n // Special case: if we have been configured to not store any invalidations,\n // we take that as a sign that we don't even want to gather any invalidations\n // data at all and early exit.\n if (maxInvalidationsPerEvent === 0) {\n return;\n }\n\n const frameId = getFrameId(event);\n if (!frameId) {\n return;\n }\n const thisFrame = getState(frameId);\n\n if (Types.Events.isRecalcStyle(event)) {\n thisFrame.lastRecalcStyleEvent = event;\n\n // Associate any prior invalidations with this recalc event.\n for (const invalidation of thisFrame.pendingInvalidations) {\n if (Types.Events.isLayoutInvalidationTracking(invalidation)) {\n // LayoutInvalidation events cannot be associated with a LayoutTree\n // event.\n continue;\n }\n addInvalidationToEvent(thisFrame, event, invalidation);\n }\n return;\n }\n\n if (Types.Events.isInvalidationTracking(event)) {\n if (thisFrame.hasPainted) {\n // If we have painted, then we can clear out the list of all existing\n // invalidations, as we cannot associate them across frames.\n thisFrame.pendingInvalidations.length = 0;\n thisFrame.lastRecalcStyleEvent = null;\n thisFrame.hasPainted = false;\n }\n\n // Style invalidation events can occur before and during recalc styles. When we get a recalc style event, we check and associate any prior invalidations with it.\n // But any invalidations that occur during a RecalcStyle\n // event would be reported in trace events after. So each time we get an\n // invalidation that might be due to a style recalc, we check if the\n // timings overlap and if so associate them.\n if (thisFrame.lastRecalcStyleEvent &&\n (Types.Events.isScheduleStyleInvalidationTracking(event) ||\n Types.Events.isStyleRecalcInvalidationTracking(event) ||\n Types.Events.isStyleInvalidatorInvalidationTracking(event))) {\n const recalcLastRecalc = thisFrame.lastRecalcStyleEvent;\n const recalcEndTime = recalcLastRecalc.ts + (recalcLastRecalc.dur || 0);\n if (event.ts >= recalcLastRecalc.ts && event.ts <= recalcEndTime) {\n addInvalidationToEvent(thisFrame, recalcLastRecalc, event);\n }\n }\n\n thisFrame.pendingInvalidations.push(event);\n return;\n }\n\n if (Types.Events.isPaint(event)) {\n thisFrame.hasPainted = true;\n return;\n }\n\n if (Types.Events.isLayout(event)) {\n for (const invalidation of thisFrame.pendingInvalidations) {\n // The only invalidations that cause a Layout are LayoutInvalidations :)\n if (!Types.Events.isLayoutInvalidationTracking(invalidation)) {\n continue;\n }\n addInvalidationToEvent(thisFrame, event, invalidation);\n }\n }\n}\n\nexport async function finalize(): Promise<void> {\n}\n\ninterface InvalidationsData {\n invalidationsForEvent: Map<Types.Events.Event, Types.Events.InvalidationTrackingEvent[]>;\n invalidationCountForEvent: Map<Types.Events.Event, number>;\n}\n\nexport function data(): InvalidationsData {\n const invalidationsForEvent = new Map<Types.Events.Event, Types.Events.InvalidationTrackingEvent[]>();\n const invalidationCountForEvent = new Map<Types.Events.Event, number>();\n for (const frame of frameStateByFrame.values()) {\n for (const [event, invalidations] of frame.invalidationsForEvent.entries()) {\n invalidationsForEvent.set(event, invalidations);\n }\n for (const [event, count] of frame.invalidationCountForEvent.entries()) {\n invalidationCountForEvent.set(event, count);\n }\n }\n return {\n invalidationsForEvent,\n invalidationCountForEvent,\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2022 The Chromium Authors
|
|
1
|
+
// Copyright 2022 The Chromium Authors
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
import * as Platform from '../../../core/platform/platform.js';
|
|
@@ -25,10 +25,11 @@ import { data as pageLoadMetricsData, MetricName } from './PageLoadMetricsHandle
|
|
|
25
25
|
* `BackendNodeId`s are only unique within a given renderer process, so this is
|
|
26
26
|
* also keyed on `ProcessId`.
|
|
27
27
|
**/
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
let imagePaintsByNodeIdAndProcess = new Map();
|
|
29
|
+
let lcpRequestByNavigationId = new Map();
|
|
30
30
|
export function reset() {
|
|
31
|
-
imagePaintsByNodeIdAndProcess
|
|
31
|
+
imagePaintsByNodeIdAndProcess = new Map();
|
|
32
|
+
lcpRequestByNavigationId = new Map();
|
|
32
33
|
}
|
|
33
34
|
export function handleEvent(event) {
|
|
34
35
|
if (!Types.Events.isLargestImagePaintCandidate(event) || !event.args.data) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LargestImagePaintHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/LargestImagePaintHandler.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"LargestImagePaintHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/LargestImagePaintHandler.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAE/D,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,IAAI,IAAI,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAC,IAAI,IAAI,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAC,IAAI,IAAI,mBAAmB,EAAE,UAAU,EAAC,MAAM,6BAA6B,C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C;IACH,CAAC;AACH,CAAC;AAMD,MAAM,UAAU,IAAI;IAClB,OAAO,EAAC,wBAAwB,EAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;AACxD,CAAC","sourcesContent":["// Copyright 2022 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 Protocol from '../../../generated/protocol.js';\nimport * as Types from '../types/types.js';\n\nimport {data as metaData} from './MetaHandler.js';\nimport {data as networkRequestsData} from './NetworkRequestsHandler.js';\nimport {data as pageLoadMetricsData, MetricName} from './PageLoadMetricsHandler.js';\nimport type {HandlerName} from './types.js';\n\n/**\n * If the LCP resource was an image, and that image was fetched over the\n * network, we want to be able to find the network request in order to construct\n * the critical path for an LCP image.\n * Within the trace file there are `LargestImagePaint::Candidate` events.\n * Within their data object, they contain a `DOMNodeId` property, which maps to\n * the DOM Node ID for that image.\n *\n * This id maps exactly to the `data.nodeId` property that a\n * `LargestContentfulPaint::Candidate` will have. So, when we find an image\n * paint candidate, we can store it, keying it on the node ID.\n * Then, when it comes to finding the network request for an LCP image, we can\n * use the nodeId from the LCP candidate to find the image candidate. That image\n * candidate also contains a `imageUrl` property, which will have the full URL\n * to the image.\n *\n * `BackendNodeId`s are only unique within a given renderer process, so this is\n * also keyed on `ProcessId`.\n **/\nlet imagePaintsByNodeIdAndProcess =\n new Map<Types.Events.ProcessID, Map<Protocol.DOM.BackendNodeId, Types.Events.LargestImagePaintCandidate>>();\nlet lcpRequestByNavigationId = new Map<string, Types.Events.SyntheticNetworkRequest>();\n\nexport function reset(): void {\n imagePaintsByNodeIdAndProcess = new Map();\n lcpRequestByNavigationId = new Map();\n}\n\nexport function handleEvent(event: Types.Events.Event): void {\n if (!Types.Events.isLargestImagePaintCandidate(event) || !event.args.data) {\n return;\n }\n\n const imagePaintsByNodeId =\n Platform.MapUtilities.getWithDefault(imagePaintsByNodeIdAndProcess, event.pid, () => new Map());\n imagePaintsByNodeId.set(event.args.data.DOMNodeId, event);\n}\n\nexport async function finalize(): Promise<void> {\n const requests = networkRequestsData().byTime;\n const {traceBounds, navigationsByNavigationId} = metaData();\n const metricScoresByFrameId = pageLoadMetricsData().metricScoresByFrameId;\n\n for (const [navigationId, navigation] of navigationsByNavigationId) {\n const lcpMetric = metricScoresByFrameId.get(navigation.args.frame)?.get(navigationId)?.get(MetricName.LCP);\n const lcpEvent = lcpMetric?.event;\n if (!lcpEvent || !Types.Events.isLargestContentfulPaintCandidate(lcpEvent)) {\n continue;\n }\n\n const nodeId = lcpEvent.args.data?.nodeId;\n if (!nodeId) {\n continue;\n }\n\n const lcpImagePaintEvent = imagePaintsByNodeIdAndProcess.get(lcpEvent.pid)?.get(nodeId);\n const lcpUrl = lcpImagePaintEvent?.args.data?.imageUrl;\n if (!lcpUrl) {\n continue;\n }\n\n const startTime = navigation?.ts ?? traceBounds.min;\n const endTime = lcpImagePaintEvent.ts;\n\n let lcpRequest;\n for (const request of requests) {\n if (request.ts < startTime) {\n continue;\n }\n if (request.ts >= endTime) {\n break;\n }\n\n if (request.args.data.url === lcpUrl || request.args.data.redirects.some(r => r.url === lcpUrl)) {\n lcpRequest = request;\n break;\n }\n }\n\n if (lcpRequest) {\n lcpRequestByNavigationId.set(navigationId, lcpRequest);\n }\n }\n}\n\nexport interface LargestImagePaintData {\n lcpRequestByNavigationId: Map<string, Types.Events.SyntheticNetworkRequest>;\n}\n\nexport function data(): LargestImagePaintData {\n return {lcpRequestByNavigationId};\n}\n\nexport function deps(): HandlerName[] {\n return ['Meta', 'NetworkRequests', 'PageLoadMetrics'];\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2022 The Chromium Authors
|
|
1
|
+
// Copyright 2022 The Chromium Authors
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
import * as Types from '../types/types.js';
|
|
@@ -7,9 +7,9 @@ import * as Types from '../types/types.js';
|
|
|
7
7
|
* LargestTextPaint. If an LCP event is text, it will point to one of these
|
|
8
8
|
* candidates, so we store them by their DOM Node ID.
|
|
9
9
|
**/
|
|
10
|
-
|
|
10
|
+
let textPaintByDOMNodeId = new Map();
|
|
11
11
|
export function reset() {
|
|
12
|
-
textPaintByDOMNodeId
|
|
12
|
+
textPaintByDOMNodeId = new Map();
|
|
13
13
|
}
|
|
14
14
|
export function handleEvent(event) {
|
|
15
15
|
if (!Types.Events.isLargestTextPaintCandidate(event)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LargestTextPaintHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/LargestTextPaintHandler.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"LargestTextPaintHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/LargestTextPaintHandler.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAG7B,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C;;;;IAII;AACJ,IAAI,oBAAoB,GAAG,IAAI,GAAG,EAAsE,CAAC;AAEzG,MAAM,UAAU,KAAK;IACnB,oBAAoB,GAAG,IAAI,GAAG,EAAE,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAyB;IACnD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,2BAA2B,CAAC,KAAK,CAAC,EAAE,CAAC;QACrD,OAAO;IACT,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IAED,oBAAoB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAC7D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ;AAC9B,CAAC;AAED,MAAM,UAAU,IAAI;IAClB,OAAO,oBAAoB,CAAC;AAC9B,CAAC","sourcesContent":["// Copyright 2022 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/**\n * A trace file will contain all the text paints that were candidates for the\n * LargestTextPaint. If an LCP event is text, it will point to one of these\n * candidates, so we store them by their DOM Node ID.\n **/\nlet textPaintByDOMNodeId = new Map<Protocol.DOM.BackendNodeId, Types.Events.LargestTextPaintCandidate>();\n\nexport function reset(): void {\n textPaintByDOMNodeId = new Map();\n}\n\nexport function handleEvent(event: Types.Events.Event): void {\n if (!Types.Events.isLargestTextPaintCandidate(event)) {\n return;\n }\n\n if (!event.args.data) {\n return;\n }\n\n textPaintByDOMNodeId.set(event.args.data.DOMNodeId, event);\n}\n\nexport async function finalize(): Promise<void> {\n}\n\nexport function data(): Map<Protocol.DOM.BackendNodeId, Types.Events.LargestTextPaintCandidate> {\n return textPaintByDOMNodeId;\n}\n"]}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
// Copyright 2023 The Chromium Authors
|
|
1
|
+
// Copyright 2023 The Chromium Authors
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
import * as Helpers from '../helpers/helpers.js';
|
|
5
5
|
import * as Types from '../types/types.js';
|
|
6
6
|
import { data as metaHandlerData } from './MetaHandler.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
let paintEvents = [];
|
|
8
|
+
let snapshotEvents = [];
|
|
9
|
+
let paintToSnapshotMap = new Map();
|
|
10
10
|
let lastPaintForLayerId = {};
|
|
11
11
|
let currentMainFrameLayerTreeId = null;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
let updateLayerEvents = [];
|
|
13
|
+
let relevantEvents = [];
|
|
14
14
|
export function reset() {
|
|
15
|
-
paintEvents
|
|
16
|
-
snapshotEvents
|
|
17
|
-
paintToSnapshotMap
|
|
15
|
+
paintEvents = [];
|
|
16
|
+
snapshotEvents = [];
|
|
17
|
+
paintToSnapshotMap = new Map();
|
|
18
18
|
lastPaintForLayerId = {};
|
|
19
19
|
currentMainFrameLayerTreeId = null;
|
|
20
|
-
updateLayerEvents
|
|
21
|
-
relevantEvents
|
|
20
|
+
updateLayerEvents = [];
|
|
21
|
+
relevantEvents = [];
|
|
22
22
|
}
|
|
23
23
|
export function handleEvent(event) {
|
|
24
24
|
// We gather up the events here but do all the processing in finalize(). This
|