@paulirish/trace_engine 0.0.50 → 0.0.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/.tmp/tsbuildinfo/tsconfig.tsbuildinfo +1 -1
  2. package/core/platform/Constructor.d.ts +2 -2
  3. package/core/platform/Constructor.js.map +1 -1
  4. package/core/platform/StringUtilities.d.ts +2 -5
  5. package/core/platform/StringUtilities.js +0 -3
  6. package/core/platform/StringUtilities.js.map +1 -1
  7. package/core/platform/TypescriptUtilities.d.ts +1 -1
  8. package/core/platform/TypescriptUtilities.js +1 -1
  9. package/core/platform/TypescriptUtilities.js.map +1 -1
  10. package/core/platform/devtools_entrypoint-bundle-typescript-tsconfig.json +2 -2
  11. package/core/platform/platform-tsconfig.json +2 -3
  12. package/core/platform/platform.d.ts +1 -2
  13. package/core/platform/platform.js +1 -2
  14. package/core/platform/platform.js.map +1 -1
  15. package/generated/protocol.d.ts +156 -31
  16. package/locales/af.json +63 -3
  17. package/locales/am.json +63 -3
  18. package/locales/ar.json +63 -3
  19. package/locales/as.json +63 -3
  20. package/locales/az.json +63 -3
  21. package/locales/be.json +64 -4
  22. package/locales/bg.json +62 -2
  23. package/locales/bn.json +63 -3
  24. package/locales/bs.json +63 -3
  25. package/locales/ca.json +62 -2
  26. package/locales/cs.json +62 -2
  27. package/locales/cy.json +63 -3
  28. package/locales/da.json +63 -3
  29. package/locales/de.json +63 -3
  30. package/locales/el.json +62 -2
  31. package/locales/en-GB.json +63 -3
  32. package/locales/en-US.json +55 -22
  33. package/locales/en-XL.json +55 -22
  34. package/locales/es-419.json +63 -3
  35. package/locales/es.json +64 -4
  36. package/locales/et.json +64 -4
  37. package/locales/eu.json +79 -19
  38. package/locales/fa.json +62 -2
  39. package/locales/fi.json +63 -3
  40. package/locales/fil.json +63 -3
  41. package/locales/fr-CA.json +63 -3
  42. package/locales/fr.json +63 -3
  43. package/locales/gl.json +62 -2
  44. package/locales/gu.json +63 -3
  45. package/locales/he.json +63 -3
  46. package/locales/hi.json +62 -2
  47. package/locales/hr.json +63 -3
  48. package/locales/hu.json +62 -2
  49. package/locales/hy.json +63 -3
  50. package/locales/id.json +62 -2
  51. package/locales/is.json +64 -4
  52. package/locales/it.json +64 -4
  53. package/locales/ja.json +63 -3
  54. package/locales/ka.json +63 -3
  55. package/locales/kk.json +62 -2
  56. package/locales/km.json +62 -2
  57. package/locales/kn.json +63 -3
  58. package/locales/ko.json +63 -3
  59. package/locales/ky.json +63 -3
  60. package/locales/lo.json +63 -3
  61. package/locales/lt.json +62 -2
  62. package/locales/lv.json +62 -2
  63. package/locales/mk.json +62 -2
  64. package/locales/ml.json +63 -3
  65. package/locales/mn.json +63 -3
  66. package/locales/mr.json +64 -4
  67. package/locales/ms.json +63 -3
  68. package/locales/my.json +63 -3
  69. package/locales/ne.json +64 -4
  70. package/locales/nl.json +63 -3
  71. package/locales/no.json +62 -2
  72. package/locales/or.json +63 -3
  73. package/locales/pa.json +62 -2
  74. package/locales/pl.json +62 -2
  75. package/locales/pt-PT.json +62 -2
  76. package/locales/pt.json +63 -3
  77. package/locales/ro.json +63 -3
  78. package/locales/ru.json +63 -3
  79. package/locales/si.json +63 -3
  80. package/locales/sk.json +63 -3
  81. package/locales/sl.json +62 -2
  82. package/locales/sq.json +63 -3
  83. package/locales/sr-Latn.json +62 -2
  84. package/locales/sr.json +62 -2
  85. package/locales/sv.json +62 -2
  86. package/locales/sw.json +63 -3
  87. package/locales/ta.json +66 -6
  88. package/locales/te.json +63 -3
  89. package/locales/th.json +63 -3
  90. package/locales/tr.json +63 -3
  91. package/locales/uk.json +63 -3
  92. package/locales/ur.json +64 -4
  93. package/locales/uz.json +62 -2
  94. package/locales/vi.json +62 -2
  95. package/locales/zh-HK.json +63 -3
  96. package/locales/zh-TW.json +63 -3
  97. package/locales/zh.json +62 -2
  98. package/locales/zu.json +63 -3
  99. package/models/cpu_profile/CPUProfileDataModel.d.ts +8 -0
  100. package/models/cpu_profile/CPUProfileDataModel.js.map +1 -1
  101. package/models/cpu_profile/cpu_profile-tsconfig.json +2 -2
  102. package/models/cpu_profile/devtools_entrypoint-bundle-typescript-tsconfig.json +2 -2
  103. package/models/trace/Processor.d.ts +1 -1
  104. package/models/trace/Processor.js +94 -74
  105. package/models/trace/Processor.js.map +1 -1
  106. package/models/trace/TracingManager.js.map +1 -1
  107. package/models/trace/bundle-tsconfig.json +1 -1
  108. package/models/trace/devtools_entrypoint-bundle-typescript-tsconfig.json +20 -2
  109. package/models/trace/extras/ScriptDuplication.d.ts +11 -15
  110. package/models/trace/extras/ScriptDuplication.js +59 -77
  111. package/models/trace/extras/ScriptDuplication.js.map +1 -1
  112. package/models/trace/extras/ThirdParties.d.ts +6 -13
  113. package/models/trace/extras/ThirdParties.js +69 -133
  114. package/models/trace/extras/ThirdParties.js.map +1 -1
  115. package/models/trace/extras/TraceTree.d.ts +15 -3
  116. package/models/trace/extras/TraceTree.js +36 -8
  117. package/models/trace/extras/TraceTree.js.map +1 -1
  118. package/models/trace/extras/devtools_entrypoint-bundle-typescript-tsconfig.json +2 -2
  119. package/models/trace/extras/extras-tsconfig.json +2 -2
  120. package/models/trace/extras/extras.d.ts +880 -787
  121. package/models/trace/extras/extras.js +880 -787
  122. package/models/trace/handlers/AsyncJSCallsHandler.js +36 -4
  123. package/models/trace/handlers/AsyncJSCallsHandler.js.map +1 -1
  124. package/models/trace/handlers/InvalidationsHandler.js +1 -0
  125. package/models/trace/handlers/InvalidationsHandler.js.map +1 -1
  126. package/models/trace/handlers/ModelHandlers.d.ts +0 -1
  127. package/models/trace/handlers/ModelHandlers.js +0 -1
  128. package/models/trace/handlers/ModelHandlers.js.map +1 -1
  129. package/models/trace/handlers/NetworkRequestsHandler.js +1 -1
  130. package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -1
  131. package/models/trace/handlers/RendererHandler.d.ts +1 -1
  132. package/models/trace/handlers/RendererHandler.js +2 -2
  133. package/models/trace/handlers/RendererHandler.js.map +1 -1
  134. package/models/trace/handlers/ScreenshotsHandler.js +3 -1
  135. package/models/trace/handlers/ScreenshotsHandler.js.map +1 -1
  136. package/models/trace/handlers/ScriptsHandler.d.ts +12 -0
  137. package/models/trace/handlers/ScriptsHandler.js +93 -1
  138. package/models/trace/handlers/ScriptsHandler.js.map +1 -1
  139. package/models/trace/handlers/devtools_entrypoint-bundle-typescript-tsconfig.json +2 -2
  140. package/models/trace/handlers/handlers-tsconfig.json +2 -3
  141. package/models/trace/helpers/Network.d.ts +5 -0
  142. package/models/trace/helpers/Network.js +17 -0
  143. package/models/trace/helpers/Network.js.map +1 -1
  144. package/models/trace/helpers/SamplesIntegrator.js +19 -23
  145. package/models/trace/helpers/SamplesIntegrator.js.map +1 -1
  146. package/models/trace/helpers/SyntheticEvents.d.ts +0 -1
  147. package/models/trace/helpers/SyntheticEvents.js +0 -4
  148. package/models/trace/helpers/SyntheticEvents.js.map +1 -1
  149. package/models/trace/helpers/Trace.d.ts +2 -1
  150. package/models/trace/helpers/Trace.js +101 -1
  151. package/models/trace/helpers/Trace.js.map +1 -1
  152. package/models/trace/helpers/TreeHelpers.d.ts +2 -5
  153. package/models/trace/helpers/TreeHelpers.js +0 -4
  154. package/models/trace/helpers/TreeHelpers.js.map +1 -1
  155. package/models/trace/helpers/devtools_entrypoint-bundle-typescript-tsconfig.json +2 -2
  156. package/models/trace/helpers/helpers-tsconfig.json +2 -2
  157. package/models/trace/insights/{UseCache.d.ts → Cache.d.ts} +2 -2
  158. package/models/trace/insights/{UseCache.js → Cache.js} +11 -5
  159. package/models/trace/insights/Cache.js.map +1 -0
  160. package/models/trace/insights/Common.d.ts +21 -2
  161. package/models/trace/insights/Common.js +86 -2
  162. package/models/trace/insights/Common.js.map +1 -1
  163. package/models/trace/insights/DocumentLatency.js +2 -8
  164. package/models/trace/insights/DocumentLatency.js.map +1 -1
  165. package/models/trace/insights/DuplicatedJavaScript.d.ts +7 -4
  166. package/models/trace/insights/DuplicatedJavaScript.js +25 -5
  167. package/models/trace/insights/DuplicatedJavaScript.js.map +1 -1
  168. package/models/trace/insights/ForcedReflow.d.ts +5 -1
  169. package/models/trace/insights/ForcedReflow.js +6 -2
  170. package/models/trace/insights/ForcedReflow.js.map +1 -1
  171. package/models/trace/insights/InteractionToNextPaint.d.ts +1 -0
  172. package/models/trace/insights/InteractionToNextPaint.js +3 -0
  173. package/models/trace/insights/InteractionToNextPaint.js.map +1 -1
  174. package/models/trace/insights/LegacyJavaScript.d.ts +32 -0
  175. package/models/trace/insights/LegacyJavaScript.js +77 -0
  176. package/models/trace/insights/LegacyJavaScript.js.map +1 -0
  177. package/models/trace/insights/Models.d.ts +3 -1
  178. package/models/trace/insights/Models.js +3 -1
  179. package/models/trace/insights/Models.js.map +1 -1
  180. package/models/trace/insights/ModernHTTP.d.ts +51 -0
  181. package/models/trace/insights/ModernHTTP.js +187 -0
  182. package/models/trace/insights/ModernHTTP.js.map +1 -0
  183. package/models/trace/insights/NetworkDependencyTree.js +1 -1
  184. package/models/trace/insights/NetworkDependencyTree.js.map +1 -1
  185. package/models/trace/insights/ThirdParties.d.ts +1 -5
  186. package/models/trace/insights/ThirdParties.js +8 -21
  187. package/models/trace/insights/ThirdParties.js.map +1 -1
  188. package/models/trace/insights/devtools_entrypoint-bundle-typescript-tsconfig.json +2 -2
  189. package/models/trace/insights/insights-tsconfig.json +8 -3
  190. package/models/trace/insights/types.d.ts +1 -0
  191. package/models/trace/insights/types.js.map +1 -1
  192. package/models/trace/lantern/core/core-tsconfig.json +2 -2
  193. package/models/trace/lantern/core/devtools_entrypoint-bundle-typescript-tsconfig.json +2 -2
  194. package/models/trace/lantern/devtools_entrypoint-bundle-typescript-tsconfig.json +2 -2
  195. package/models/trace/lantern/graph/devtools_entrypoint-bundle-typescript-tsconfig.json +2 -2
  196. package/models/trace/lantern/graph/graph-tsconfig.json +2 -2
  197. package/models/trace/lantern/lantern-tsconfig.json +2 -2
  198. package/models/trace/lantern/metrics/Metric.d.ts +4 -4
  199. package/models/trace/lantern/metrics/Metric.js +4 -6
  200. package/models/trace/lantern/metrics/Metric.js.map +1 -1
  201. package/models/trace/lantern/metrics/devtools_entrypoint-bundle-typescript-tsconfig.json +2 -2
  202. package/models/trace/lantern/metrics/metrics-tsconfig.json +2 -2
  203. package/models/trace/lantern/simulation/devtools_entrypoint-bundle-typescript-tsconfig.json +2 -2
  204. package/models/trace/lantern/simulation/simulation-tsconfig.json +2 -2
  205. package/models/trace/lantern/types/devtools_entrypoint-bundle-typescript-tsconfig.json +2 -2
  206. package/models/trace/lantern/types/types-tsconfig.json +2 -2
  207. package/models/trace/trace-tsconfig.json +2 -2
  208. package/models/trace/types/Configuration.d.ts +2 -0
  209. package/models/trace/types/Configuration.js.map +1 -1
  210. package/models/trace/types/TraceEvents.d.ts +28 -50
  211. package/models/trace/types/TraceEvents.js +8 -23
  212. package/models/trace/types/TraceEvents.js.map +1 -1
  213. package/models/trace/types/devtools_entrypoint-bundle-typescript-tsconfig.json +2 -2
  214. package/models/trace/types/types-tsconfig.json +2 -2
  215. package/package.json +3 -2
  216. package/test/test-trace-engine.mjs +19 -17
  217. package/third_party/legacy-javascript/legacy-javascript.d.ts +1 -0
  218. package/third_party/legacy-javascript/legacy-javascript.js +1 -0
  219. package/core/platform/ServerTiming.d.ts +0 -31
  220. package/core/platform/ServerTiming.js +0 -212
  221. package/core/platform/ServerTiming.js.map +0 -1
  222. package/models/trace/handlers/ServerTimingsHandler.d.ts +0 -9
  223. package/models/trace/handlers/ServerTimingsHandler.js +0 -106
  224. package/models/trace/handlers/ServerTimingsHandler.js.map +0 -1
  225. package/models/trace/insights/UseCache.js.map +0 -1
@@ -6,10 +6,12 @@ import * as Types from '../types/types.js';
6
6
  import { data as flowsHandlerData } from './FlowsHandler.js';
7
7
  import { data as rendererHandlerData } from './RendererHandler.js';
8
8
  const schedulerToRunEntryPoints = new Map();
9
+ const taskScheduleForTaskRunEvent = new Map();
9
10
  const asyncCallToScheduler = new Map();
10
11
  export function reset() {
11
12
  schedulerToRunEntryPoints.clear();
12
13
  asyncCallToScheduler.clear();
14
+ taskScheduleForTaskRunEvent.clear();
13
15
  }
14
16
  export function handleEvent(_) {
15
17
  }
@@ -18,17 +20,47 @@ export async function finalize() {
18
20
  const { entryToNode } = rendererHandlerData();
19
21
  // Process async task flows
20
22
  for (const flow of flows) {
21
- const asyncTaskScheduled = flow.at(0);
22
- if (!asyncTaskScheduled || !Types.Events.isDebuggerAsyncTaskScheduled(asyncTaskScheduled)) {
23
+ let maybeAsyncTaskScheduled = flow.at(0);
24
+ if (!maybeAsyncTaskScheduled) {
23
25
  continue;
24
26
  }
25
- const taskName = asyncTaskScheduled.args.taskName;
27
+ if (Types.Events.isDebuggerAsyncTaskRun(maybeAsyncTaskScheduled)) {
28
+ // Sometimes a AsyncTaskRun event run can incorrectly appear as
29
+ // initiated by another AsyncTaskRun from Perfetto's flows
30
+ // perspective.
31
+ // For example, in this snippet:
32
+ //
33
+ // const myTask = console.createTask('hola'); // creates an AsyncTaskSchedule
34
+ // myTask.run(something); // creates an AsyncTaskRun
35
+ // myTask.run(somethingElse); // creates an AsyncTaskRun
36
+ //
37
+ // or also in this one
38
+ //
39
+ // setInterval(something); // creates multiple connected AsyncTaskRun.
40
+ //
41
+ // Because the flow id is created based on the task's memory address,
42
+ // the three events will end up belonging to the same flow (even if
43
+ // in the frontend we receive it as pairs), and elements in a flow
44
+ // are connected to their immediately consecutive neighbor.
45
+ //
46
+ // To ensure we use the right Schedule event, if the "initiating"
47
+ // portion of the flow is a Run event, we look for any corresponding
48
+ // Schedule event that we might have found before.
49
+ maybeAsyncTaskScheduled = taskScheduleForTaskRunEvent.get(maybeAsyncTaskScheduled);
50
+ }
51
+ if (!maybeAsyncTaskScheduled || !Types.Events.isDebuggerAsyncTaskScheduled(maybeAsyncTaskScheduled)) {
52
+ continue;
53
+ }
54
+ const taskName = maybeAsyncTaskScheduled.args.taskName;
26
55
  const asyncTaskRun = flow.at(1);
27
56
  if (!asyncTaskRun || !Types.Events.isDebuggerAsyncTaskRun(asyncTaskRun)) {
28
57
  // Unexpected flow shape, ignore.
29
58
  continue;
30
59
  }
31
- const asyncCaller = findNearestJSAncestor(asyncTaskScheduled, entryToNode);
60
+ // Cache the Schedule event for this Run for future reference.
61
+ taskScheduleForTaskRunEvent.set(asyncTaskRun, maybeAsyncTaskScheduled);
62
+ // Get the JS call scheduled the task.
63
+ const asyncCaller = findNearestJSAncestor(maybeAsyncTaskScheduled, entryToNode);
32
64
  if (!asyncCaller) {
33
65
  // Unexpected async call trace data shape, ignore.
34
66
  continue;
@@ -1 +1 @@
1
- {"version":3,"file":"AsyncJSCallsHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/AsyncJSCallsHandler.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAC7B,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAE/D,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,IAAI,IAAI,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAC,IAAI,IAAI,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AAEjE,MAAM,yBAAyB,GAAG,IAAI,GAAG,EAA4C,CAAC;AACtF,MAAM,oBAAoB,GACtB,IAAI,GAAG,EAAwF,CAAC;AAEpG,MAAM,UAAU,KAAK;IACnB,yBAAyB,CAAC,KAAK,EAAE,CAAC;IAClC,oBAAoB,CAAC,KAAK,EAAE,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,CAAqB;AACjD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC5B,MAAM,EAAC,KAAK,EAAC,GAAG,gBAAgB,EAAE,CAAC;IACnC,MAAM,EAAC,WAAW,EAAC,GAAG,mBAAmB,EAAE,CAAC;IAC5C,2BAA2B;IAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACz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,UAAU,IAAI;IAClB,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC/B,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.\nimport * as Platform from '../../../core/platform/platform.js';\nimport type * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport {data as flowsHandlerData} from './FlowsHandler.js';\nimport {data as rendererHandlerData} from './RendererHandler.js';\n\nconst schedulerToRunEntryPoints = new Map<Types.Events.Event, Types.Events.Event[]>();\nconst asyncCallToScheduler =\n new Map<Types.Events.SyntheticProfileCall, {taskName: string, scheduler: Types.Events.Event}>();\n\nexport function reset(): void {\n schedulerToRunEntryPoints.clear();\n asyncCallToScheduler.clear();\n}\n\nexport function handleEvent(_: Types.Events.Event): void {\n}\n\nexport async function finalize(): Promise<void> {\n const {flows} = flowsHandlerData();\n const {entryToNode} = rendererHandlerData();\n // Process async task flows\n for (const flow of flows) {\n const asyncTaskScheduled = flow.at(0);\n if (!asyncTaskScheduled || !Types.Events.isDebuggerAsyncTaskScheduled(asyncTaskScheduled)) {\n continue;\n }\n const taskName = asyncTaskScheduled.args.taskName;\n const asyncTaskRun = flow.at(1);\n if (!asyncTaskRun || !Types.Events.isDebuggerAsyncTaskRun(asyncTaskRun)) {\n // Unexpected flow shape, ignore.\n continue;\n }\n const asyncCaller = findNearestJSAncestor(asyncTaskScheduled, entryToNode);\n if (!asyncCaller) {\n // Unexpected async call trace data shape, ignore.\n continue;\n }\n const asyncEntryPoint = findFirstJsInvocationForAsyncTaskRun(asyncTaskRun, entryToNode);\n if (!asyncEntryPoint) {\n // Unexpected async call trace data shape, ignore.\n continue;\n }\n // Set scheduler -> schedulee mapping.\n // The schedulee being the JS entrypoint\n const entryPoints = Platform.MapUtilities.getWithDefault(schedulerToRunEntryPoints, asyncCaller, () => []);\n entryPoints.push(asyncEntryPoint);\n\n // Set schedulee -> scheduler mapping.\n // The schedulees being the JS calls (instead of the entrypoints as\n // above, for usage ergonomics).\n const scheduledProfileCalls = findFirstJSCallsForAsyncTaskRun(asyncTaskRun, entryToNode);\n for (const call of scheduledProfileCalls) {\n asyncCallToScheduler.set(call, {taskName, scheduler: asyncCaller});\n }\n }\n}\n/**\n * Given a DebuggerAsyncTaskScheduled event, returns its closest\n * ProfileCall or JS invocation ancestor, which represents the JS call\n * that scheduled the async task.\n */\nfunction findNearestJSAncestor(\n asyncTaskScheduled: Types.Events.DebuggerAsyncTaskScheduled,\n entryToNode: Map<Types.Events.Event, Helpers.TreeHelpers.TraceEntryNode>): Types.Events.Event|null {\n let node = entryToNode.get(asyncTaskScheduled)?.parent;\n while (node) {\n if (Types.Events.isProfileCall(node.entry) || acceptJSInvocationsPredicate(node.entry)) {\n return node.entry;\n }\n node = node.parent;\n }\n return null;\n}\n/**\n * Entrypoints to JS execution in the timeline. We ignore those starting\n * with 'v8' because they aren't shown in the timeline, and ultimately\n * this function's output results in \"initiated\" events, so ideally this\n * returns events that end up in the flame chart.\n */\nfunction acceptJSInvocationsPredicate(event: Types.Events.Event): event is Types.Events.Event {\n const eventIsConsoleRunTask = Types.Events.isConsoleRunTask(event);\n const eventIsV8EntryPoint = event.name.startsWith('v8') || event.name.startsWith('V8');\n return Types.Events.isJSInvocationEvent(event) && (eventIsConsoleRunTask || !eventIsV8EntryPoint);\n}\n\n/**\n * Given a DebuggerAsyncTaskRun event, returns its closest JS entry\n * point descendant, which contains the task being scheduled.\n */\nfunction findFirstJsInvocationForAsyncTaskRun(\n asyncTaskRun: Types.Events.DebuggerAsyncTaskRun,\n entryToNode: Map<Types.Events.Event, Helpers.TreeHelpers.TraceEntryNode>): Types.Events.Event|undefined {\n // Ignore descendants of other DebuggerAsyncTaskRuns since they\n // are part of another async task and have to be handled separately\n return findFirstDescendantsOfType(\n asyncTaskRun, entryToNode, acceptJSInvocationsPredicate, Types.Events.isDebuggerAsyncTaskRun)\n .at(0);\n}\n\n/**\n * Given an async task run event, returns the top level call frames\n * (profile calls) directly called by the async task. This implies that\n * any profile calls under another async task run event are ignored.\n * These profile calls represent the JS task being scheduled, AKA\n * the other part of the async stack.\n *\n * For example, here the profile calls \"js 1\", \"js 2\" and \"js 4\" would\n * be returned:\n *\n * |------------------Async Task Run------------------|\n * |--FunctionCall--| |--FunctionCall--|\n * |-js 1-||-js 2-| |-js 4-|\n * |-js 3-|\n *\n * But here, only \"js 1\" and \"js 2\" would be returned:\n *\n * |------------------Async Task Run------------------|\n * |--FunctionCall--| |------------------------|\n * |-js 1-||-js 2-| |---Async Task Run--|\n * |-js 3-| |--FunctionCall--|\n * |-js 4-|\n */\nfunction findFirstJSCallsForAsyncTaskRun(\n asyncTaskRun: Types.Events.DebuggerAsyncTaskRun,\n entryToNode: Map<Types.Events.Event, Helpers.TreeHelpers.TraceEntryNode>): Types.Events.SyntheticProfileCall[] {\n // Ignore descendants of other DebuggerAsyncTaskRuns since they\n // are part of another async task and have to be handled separately\n return findFirstDescendantsOfType(\n asyncTaskRun, entryToNode, Types.Events.isProfileCall, Types.Events.isDebuggerAsyncTaskRun);\n}\n\n/**\n * Given a root event returns all the first descendants that meet a\n * predicate condition (predicateAccept) while ignoring subtrees whose\n * top event meets an ignore condition (predicateIgnore).\n */\nfunction findFirstDescendantsOfType<T extends Types.Events.Event>(\n root: Types.Events.Event, entryToNode: Map<Types.Events.Event, Helpers.TreeHelpers.TraceEntryNode>,\n predicateAccept: (event: Types.Events.Event) => event is T,\n predicateIgnore: (event: Types.Events.Event) => boolean): T[] {\n const node = entryToNode.get(root);\n if (!node) {\n return [];\n }\n const childrenGroups = [[...node.children]];\n const firstDescendants = [];\n for (let i = 0; i < childrenGroups.length; i++) {\n const siblings = childrenGroups[i];\n for (let j = 0; j < siblings.length; j++) {\n const node = siblings[j];\n if (predicateAccept(node.entry)) {\n firstDescendants.push(node.entry);\n } else if (!predicateIgnore(node.entry)) {\n childrenGroups.push([...node.children]);\n }\n }\n }\n return firstDescendants;\n}\n\nexport function data(): {\n // Given a profile call, returns the JS entrypoint it scheduled (if any).\n // For example, given a setTimeout call, returns the JS entry point\n // trace event for the timeout callback run event (usually a\n // FunctionCall event).\n schedulerToRunEntryPoints: typeof schedulerToRunEntryPoints,\n // Given a profile call, returns the profile call that scheduled it.\n // For example given a timeout callback run event, returns its\n // setTimeout call event.\n asyncCallToScheduler: typeof asyncCallToScheduler,\n} {\n return {\n schedulerToRunEntryPoints,\n asyncCallToScheduler,\n };\n}\n\nexport function deps(): ['Renderer', 'Flows'] {\n return ['Renderer', 'Flows'];\n}\n"]}
1
+ {"version":3,"file":"AsyncJSCallsHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/AsyncJSCallsHandler.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAC7B,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAE/D,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,IAAI,IAAI,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAC,IAAI,IAAI,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AAEjE,MAAM,yBAAyB,GAAG,IAAI,GAAG,EAA4C,CAAC;AAEtF,MAAM,2BAA2B,GAC7B,IAAI,GAAG,EAA8E,CAAC;AAC1F,MAAM,oBAAoB,GACtB,IAAI,GAAG,EAAwF,CAAC;AAEpG,MAAM,UAAU,KAAK;IACnB,yBAAyB,CAAC,KAAK,EAAE,CAAC;IAClC,oBAAoB,CAAC,KAAK,EAAE,CAAC;IAC7B,2BAA2B,CAAC,KAAK,EAAE,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,CAAqB;AACjD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC5B,MAAM,EAAC,KAAK,EAAC,GAAG,gBAAgB,EAAE,CAAC;IACnC,MAAM,EAAC,WAAW,EAAC,GAAG,mBAAmB,E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CAAC;QAC/C,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;QACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACzC,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YACzB,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBAChC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACpC,CAAC;iBAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBACxC,cAAc,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,IAAI;IAWlB,OAAO;QACL,yBAAyB;QACzB,oBAAoB;KACrB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC/B,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.\nimport * as Platform from '../../../core/platform/platform.js';\nimport type * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport {data as flowsHandlerData} from './FlowsHandler.js';\nimport {data as rendererHandlerData} from './RendererHandler.js';\n\nconst schedulerToRunEntryPoints = new Map<Types.Events.Event, Types.Events.Event[]>();\n\nconst taskScheduleForTaskRunEvent =\n new Map<Types.Events.DebuggerAsyncTaskRun, Types.Events.DebuggerAsyncTaskScheduled>();\nconst asyncCallToScheduler =\n new Map<Types.Events.SyntheticProfileCall, {taskName: string, scheduler: Types.Events.Event}>();\n\nexport function reset(): void {\n schedulerToRunEntryPoints.clear();\n asyncCallToScheduler.clear();\n taskScheduleForTaskRunEvent.clear();\n}\n\nexport function handleEvent(_: Types.Events.Event): void {\n}\n\nexport async function finalize(): Promise<void> {\n const {flows} = flowsHandlerData();\n const {entryToNode} = rendererHandlerData();\n // Process async task flows\n for (const flow of flows) {\n let maybeAsyncTaskScheduled = flow.at(0);\n if (!maybeAsyncTaskScheduled) {\n continue;\n }\n if (Types.Events.isDebuggerAsyncTaskRun(maybeAsyncTaskScheduled)) {\n // Sometimes a AsyncTaskRun event run can incorrectly appear as\n // initiated by another AsyncTaskRun from Perfetto's flows\n // perspective.\n // For example, in this snippet:\n //\n // const myTask = console.createTask('hola'); // creates an AsyncTaskSchedule\n // myTask.run(something); // creates an AsyncTaskRun\n // myTask.run(somethingElse); // creates an AsyncTaskRun\n //\n // or also in this one\n //\n // setInterval(something); // creates multiple connected AsyncTaskRun.\n //\n // Because the flow id is created based on the task's memory address,\n // the three events will end up belonging to the same flow (even if\n // in the frontend we receive it as pairs), and elements in a flow\n // are connected to their immediately consecutive neighbor.\n //\n // To ensure we use the right Schedule event, if the \"initiating\"\n // portion of the flow is a Run event, we look for any corresponding\n // Schedule event that we might have found before.\n maybeAsyncTaskScheduled = taskScheduleForTaskRunEvent.get(maybeAsyncTaskScheduled);\n }\n if (!maybeAsyncTaskScheduled || !Types.Events.isDebuggerAsyncTaskScheduled(maybeAsyncTaskScheduled)) {\n continue;\n }\n const taskName = maybeAsyncTaskScheduled.args.taskName;\n const asyncTaskRun = flow.at(1);\n if (!asyncTaskRun || !Types.Events.isDebuggerAsyncTaskRun(asyncTaskRun)) {\n // Unexpected flow shape, ignore.\n continue;\n }\n // Cache the Schedule event for this Run for future reference.\n taskScheduleForTaskRunEvent.set(asyncTaskRun, maybeAsyncTaskScheduled);\n\n // Get the JS call scheduled the task.\n const asyncCaller = findNearestJSAncestor(maybeAsyncTaskScheduled, entryToNode);\n if (!asyncCaller) {\n // Unexpected async call trace data shape, ignore.\n continue;\n }\n const asyncEntryPoint = findFirstJsInvocationForAsyncTaskRun(asyncTaskRun, entryToNode);\n if (!asyncEntryPoint) {\n // Unexpected async call trace data shape, ignore.\n continue;\n }\n // Set scheduler -> schedulee mapping.\n // The schedulee being the JS entrypoint\n const entryPoints = Platform.MapUtilities.getWithDefault(schedulerToRunEntryPoints, asyncCaller, () => []);\n entryPoints.push(asyncEntryPoint);\n\n // Set schedulee -> scheduler mapping.\n // The schedulees being the JS calls (instead of the entrypoints as\n // above, for usage ergonomics).\n const scheduledProfileCalls = findFirstJSCallsForAsyncTaskRun(asyncTaskRun, entryToNode);\n for (const call of scheduledProfileCalls) {\n asyncCallToScheduler.set(call, {taskName, scheduler: asyncCaller});\n }\n }\n}\n/**\n * Given a DebuggerAsyncTaskScheduled event, returns its closest\n * ProfileCall or JS invocation ancestor, which represents the JS call\n * that scheduled the async task.\n */\nfunction findNearestJSAncestor(\n asyncTaskScheduled: Types.Events.DebuggerAsyncTaskScheduled,\n entryToNode: Map<Types.Events.Event, Helpers.TreeHelpers.TraceEntryNode>): Types.Events.Event|null {\n let node = entryToNode.get(asyncTaskScheduled)?.parent;\n while (node) {\n if (Types.Events.isProfileCall(node.entry) || acceptJSInvocationsPredicate(node.entry)) {\n return node.entry;\n }\n node = node.parent;\n }\n return null;\n}\n/**\n * Entrypoints to JS execution in the timeline. We ignore those starting\n * with 'v8' because they aren't shown in the timeline, and ultimately\n * this function's output results in \"initiated\" events, so ideally this\n * returns events that end up in the flame chart.\n */\nfunction acceptJSInvocationsPredicate(event: Types.Events.Event): event is Types.Events.Event {\n const eventIsConsoleRunTask = Types.Events.isConsoleRunTask(event);\n const eventIsV8EntryPoint = event.name.startsWith('v8') || event.name.startsWith('V8');\n return Types.Events.isJSInvocationEvent(event) && (eventIsConsoleRunTask || !eventIsV8EntryPoint);\n}\n\n/**\n * Given a DebuggerAsyncTaskRun event, returns its closest JS entry\n * point descendant, which contains the task being scheduled.\n */\nfunction findFirstJsInvocationForAsyncTaskRun(\n asyncTaskRun: Types.Events.DebuggerAsyncTaskRun,\n entryToNode: Map<Types.Events.Event, Helpers.TreeHelpers.TraceEntryNode>): Types.Events.Event|undefined {\n // Ignore descendants of other DebuggerAsyncTaskRuns since they\n // are part of another async task and have to be handled separately\n return findFirstDescendantsOfType(\n asyncTaskRun, entryToNode, acceptJSInvocationsPredicate, Types.Events.isDebuggerAsyncTaskRun)\n .at(0);\n}\n\n/**\n * Given an async task run event, returns the top level call frames\n * (profile calls) directly called by the async task. This implies that\n * any profile calls under another async task run event are ignored.\n * These profile calls represent the JS task being scheduled, AKA\n * the other part of the async stack.\n *\n * For example, here the profile calls \"js 1\", \"js 2\" and \"js 4\" would\n * be returned:\n *\n * |------------------Async Task Run------------------|\n * |--FunctionCall--| |--FunctionCall--|\n * |-js 1-||-js 2-| |-js 4-|\n * |-js 3-|\n *\n * But here, only \"js 1\" and \"js 2\" would be returned:\n *\n * |------------------Async Task Run------------------|\n * |--FunctionCall--| |------------------------|\n * |-js 1-||-js 2-| |---Async Task Run--|\n * |-js 3-| |--FunctionCall--|\n * |-js 4-|\n */\nfunction findFirstJSCallsForAsyncTaskRun(\n asyncTaskRun: Types.Events.DebuggerAsyncTaskRun,\n entryToNode: Map<Types.Events.Event, Helpers.TreeHelpers.TraceEntryNode>): Types.Events.SyntheticProfileCall[] {\n // Ignore descendants of other DebuggerAsyncTaskRuns since they\n // are part of another async task and have to be handled separately\n return findFirstDescendantsOfType(\n asyncTaskRun, entryToNode, Types.Events.isProfileCall, Types.Events.isDebuggerAsyncTaskRun);\n}\n\n/**\n * Given a root event returns all the first descendants that meet a\n * predicate condition (predicateAccept) while ignoring subtrees whose\n * top event meets an ignore condition (predicateIgnore).\n */\nfunction findFirstDescendantsOfType<T extends Types.Events.Event>(\n root: Types.Events.Event, entryToNode: Map<Types.Events.Event, Helpers.TreeHelpers.TraceEntryNode>,\n predicateAccept: (event: Types.Events.Event) => event is T,\n predicateIgnore: (event: Types.Events.Event) => boolean): T[] {\n const node = entryToNode.get(root);\n if (!node) {\n return [];\n }\n const childrenGroups = [[...node.children]];\n const firstDescendants = [];\n for (let i = 0; i < childrenGroups.length; i++) {\n const siblings = childrenGroups[i];\n for (let j = 0; j < siblings.length; j++) {\n const node = siblings[j];\n if (predicateAccept(node.entry)) {\n firstDescendants.push(node.entry);\n } else if (!predicateIgnore(node.entry)) {\n childrenGroups.push([...node.children]);\n }\n }\n }\n return firstDescendants;\n}\n\nexport function data(): {\n // Given a profile call, returns the JS entrypoint it scheduled (if any).\n // For example, given a setTimeout call, returns the JS entry point\n // trace event for the timeout callback run event (usually a\n // FunctionCall event).\n schedulerToRunEntryPoints: typeof schedulerToRunEntryPoints,\n // Given a profile call, returns the profile call that scheduled it.\n // For example given a timeout callback run event, returns its\n // setTimeout call event.\n asyncCallToScheduler: typeof asyncCallToScheduler,\n} {\n return {\n schedulerToRunEntryPoints,\n asyncCallToScheduler,\n };\n}\n\nexport function deps(): ['Renderer', 'Flows'] {\n return ['Renderer', 'Flows'];\n}\n"]}
@@ -10,6 +10,7 @@ let hasPainted = false;
10
10
  const allInvalidationTrackingEvents = [];
11
11
  export function reset() {
12
12
  invalidationsForEvent.clear();
13
+ invalidationCountForEvent.clear();
13
14
  lastRecalcStyleEvent = null;
14
15
  allInvalidationTrackingEvents.length = 0;
15
16
  hasPainted = false;
@@ -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,GAA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C,KAAK,EAAE,CAAC;gBACzE,sBAAsB,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;QAED,6BAA6B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1C,OAAO;IACT,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAChC,oEAAoE;QACpE,UAAU,GAAG,IAAI,CAAC;QAClB,OAAO;IACT,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;QAC/C,KAAK,MAAM,YAAY,IAAI,6BAA6B,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 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,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,MAAM,qBAAqB,GAAG,IAAI,GAAG,EA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AC,GAAG,IAAI,CAAC,CAAC,CAAC;YAChF,IAAI,KAAK,CAAC,EAAE,IAAI,oBAAoB,CAAC,EAAE,IAAI,KAAK,CAAC,EAAE,IAAI,aAAa;gBAChE,oBAAoB,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;gBACzE,sBAAsB,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;QAED,6BAA6B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1C,OAAO;IACT,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAChC,oEAAoE;QACpE,UAAU,GAAG,IAAI,CAAC;QAClB,OAAO;IACT,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;QAC/C,KAAK,MAAM,YAAY,IAAI,6BAA6B,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"]}
@@ -24,7 +24,6 @@ export * as Samples from './SamplesHandler.js';
24
24
  export * as Screenshots from './ScreenshotsHandler.js';
25
25
  export * as Scripts from './ScriptsHandler.js';
26
26
  export * as SelectorStats from './SelectorStatsHandler.js';
27
- export * as ServerTimings from './ServerTimingsHandler.js';
28
27
  export * as UserInteractions from './UserInteractionsHandler.js';
29
28
  export * as UserTimings from './UserTimingsHandler.js';
30
29
  export * as Warnings from './WarningsHandler.js';
@@ -27,7 +27,6 @@ export * as Samples from './SamplesHandler.js';
27
27
  export * as Screenshots from './ScreenshotsHandler.js';
28
28
  export * as Scripts from './ScriptsHandler.js';
29
29
  export * as SelectorStats from './SelectorStatsHandler.js';
30
- export * as ServerTimings from './ServerTimingsHandler.js';
31
30
  export * as UserInteractions from './UserInteractionsHandler.js';
32
31
  export * as UserTimings from './UserTimingsHandler.js';
33
32
  export * as Warnings from './WarningsHandler.js';
@@ -1 +1 @@
1
- {"version":3,"file":"ModelHandlers.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/ModelHandlers.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,kBAAkB,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AACvC,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,iBAAiB,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,gBAAgB,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,gBAAgB,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC","sourcesContent":["// Copyright 2022 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nexport * as AnimationFrames from './AnimationFramesHandler.js';\nexport * as Animations from './AnimationHandler.js';\nexport * as AsyncJSCalls from './AsyncJSCallsHandler.js';\nexport * as AuctionWorklets from './AuctionWorkletsHandler.js';\nexport * as DOMStats from './DOMStatsHandler.js';\nexport * as ExtensionTraceData from './ExtensionTraceDataHandler.js';\nexport * as Flows from './FlowsHandler.js';\nexport * as Frames from './FramesHandler.js';\nexport * as GPU from './GPUHandler.js';\nexport * as ImagePainting from './ImagePaintingHandler.js';\nexport * as Initiators from './InitiatorsHandler.js';\nexport * as Invalidations from './InvalidationsHandler.js';\nexport * as LargestImagePaint from './LargestImagePaintHandler.js';\nexport * as LargestTextPaint from './LargestTextPaintHandler.js';\nexport * as LayerTree from './LayerTreeHandler.js';\nexport * as LayoutShifts from './LayoutShiftsHandler.js';\nexport * as Memory from './MemoryHandler.js';\nexport * as Meta from './MetaHandler.js';\nexport * as NetworkRequests from './NetworkRequestsHandler.js';\nexport * as PageFrames from './PageFramesHandler.js';\nexport * as PageLoadMetrics from './PageLoadMetricsHandler.js';\nexport * as Renderer from './RendererHandler.js';\nexport * as Samples from './SamplesHandler.js';\nexport * as Screenshots from './ScreenshotsHandler.js';\nexport * as Scripts from './ScriptsHandler.js';\nexport * as SelectorStats from './SelectorStatsHandler.js';\nexport * as ServerTimings from './ServerTimingsHandler.js';\nexport * as UserInteractions from './UserInteractionsHandler.js';\nexport * as UserTimings from './UserTimingsHandler.js';\nexport * as Warnings from './WarningsHandler.js';\nexport * as Workers from './WorkersHandler.js';\n"]}
1
+ {"version":3,"file":"ModelHandlers.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/ModelHandlers.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,kBAAkB,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AACvC,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,iBAAiB,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,gBAAgB,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,gBAAgB,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC","sourcesContent":["// Copyright 2022 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nexport * as AnimationFrames from './AnimationFramesHandler.js';\nexport * as Animations from './AnimationHandler.js';\nexport * as AsyncJSCalls from './AsyncJSCallsHandler.js';\nexport * as AuctionWorklets from './AuctionWorkletsHandler.js';\nexport * as DOMStats from './DOMStatsHandler.js';\nexport * as ExtensionTraceData from './ExtensionTraceDataHandler.js';\nexport * as Flows from './FlowsHandler.js';\nexport * as Frames from './FramesHandler.js';\nexport * as GPU from './GPUHandler.js';\nexport * as ImagePainting from './ImagePaintingHandler.js';\nexport * as Initiators from './InitiatorsHandler.js';\nexport * as Invalidations from './InvalidationsHandler.js';\nexport * as LargestImagePaint from './LargestImagePaintHandler.js';\nexport * as LargestTextPaint from './LargestTextPaintHandler.js';\nexport * as LayerTree from './LayerTreeHandler.js';\nexport * as LayoutShifts from './LayoutShiftsHandler.js';\nexport * as Memory from './MemoryHandler.js';\nexport * as Meta from './MetaHandler.js';\nexport * as NetworkRequests from './NetworkRequestsHandler.js';\nexport * as PageFrames from './PageFramesHandler.js';\nexport * as PageLoadMetrics from './PageLoadMetricsHandler.js';\nexport * as Renderer from './RendererHandler.js';\nexport * as Samples from './SamplesHandler.js';\nexport * as Screenshots from './ScreenshotsHandler.js';\nexport * as Scripts from './ScriptsHandler.js';\nexport * as SelectorStats from './SelectorStatsHandler.js';\nexport * as UserInteractions from './UserInteractionsHandler.js';\nexport * as UserTimings from './UserTimingsHandler.js';\nexport * as Warnings from './WarningsHandler.js';\nexport * as Workers from './WorkersHandler.js';\n"]}
@@ -388,7 +388,7 @@ export async function finalize() {
388
388
  HandlerHelpers.addNetworkRequestToEntityMapping(networkEvent, entityMappings, request);
389
389
  // Establish initiator relationships
390
390
  const initiatorUrl = networkEvent.args.data.initiator?.url ||
391
- Helpers.Trace.getZeroIndexedStackTraceForEvent(networkEvent)?.at(0)?.url;
391
+ Helpers.Trace.getZeroIndexedStackTraceInEventPayload(networkEvent)?.at(0)?.url;
392
392
  if (initiatorUrl) {
393
393
  const events = networkRequestEventByInitiatorUrl.get(initiatorUrl) ?? [];
394
394
  events.push(networkEvent);
@@ -1 +1 @@
1
- {"version":3,"file":"NetworkRequestsHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/NetworkRequestsHandler.ts"],"names":[],"mappings":"AAAA,4DAA4D;AA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AAC,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC;IAC7D,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC;IACvD,MAAM,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAC;IACjC,MAAM,SAAS,GAAG,UAAU,IAAI,QAAQ,IAAI,kBAAkB,CAAC;IAC/D,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,GAAG,EAAE,SAAS,CAAC,GAAG;QAClB,EAAE,uCAA6B;QAC/B,EAAE,EAAE,OAAO;QACX,GAAG,EAAE,QAA8B;QACnC,GAAG,EAAE,SAAS,CAAC,GAAG;QAClB,GAAG,EAAE,SAAS,CAAC,GAAG;QAClB,CAAC,EAAE,SAAS,CAAC,CAAC;QACd,cAAc,EAAE,SAAS;QACzB,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE;YACJ,IAAI,EAAE;gBACJ,UAAU,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU;gBAC1C,QAAQ,mDAAuC;gBAC/C,GAAG,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE;aACnC;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright 2022 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Platform from '../../../core/platform/platform.js';\nimport * as Protocol from '../../../generated/protocol.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport * as HandlerHelpers from './helpers.js';\nimport {data as metaHandlerData} from './MetaHandler.js';\nimport type {HandlerName} from './types.js';\n\nconst MILLISECONDS_TO_MICROSECONDS = 1000;\nconst SECONDS_TO_MICROSECONDS = 1000000;\n\n// Network requests from traces are actually formed of 5 trace records.\n// This handler tracks all trace records based on the request ID, and\n// then creates a new synthetic trace event for those network requests.\n//\n// This interface, then, defines the shape of the object we intend to\n// keep for each request in the trace. In the finalize we will convert\n// these 5 types of trace records to a synthetic complete event that\n// represents a composite of these trace records.\nexport interface TraceEventsForNetworkRequest {\n changePriority?: Types.Events.ResourceChangePriority;\n willSendRequests?: Types.Events.ResourceWillSendRequest[];\n sendRequests?: Types.Events.ResourceSendRequest[];\n receiveResponse?: Types.Events.ResourceReceiveResponse;\n resourceFinish?: Types.Events.ResourceFinish;\n receivedData?: Types.Events.ResourceReceivedData[];\n resourceMarkAsCached?: Types.Events.ResourceMarkAsCached;\n}\n\nexport interface WebSocketTraceDataForFrame {\n frame: string;\n webSocketIdentifier: number;\n events: Types.Events.WebSocketEvent[];\n syntheticConnection: Types.Events.SyntheticWebSocketConnection|null;\n}\nexport interface WebSocketTraceDataForWorker {\n workerId: string;\n webSocketIdentifier: number;\n events: Types.Events.WebSocketEvent[];\n syntheticConnection: Types.Events.SyntheticWebSocketConnection|null;\n}\nexport type WebSocketTraceData = WebSocketTraceDataForFrame|WebSocketTraceDataForWorker;\n\nconst webSocketData = new Map<number, WebSocketTraceData>();\ninterface NetworkRequestData {\n byId: Map<string, Types.Events.SyntheticNetworkRequest>;\n byOrigin: Map<string, {\n renderBlocking: Types.Events.SyntheticNetworkRequest[],\n nonRenderBlocking: Types.Events.SyntheticNetworkRequest[],\n all: Types.Events.SyntheticNetworkRequest[],\n }>;\n byTime: Types.Events.SyntheticNetworkRequest[];\n eventToInitiator: Map<Types.Events.SyntheticNetworkRequest, Types.Events.SyntheticNetworkRequest>;\n webSocket: WebSocketTraceData[];\n entityMappings: HandlerHelpers.EntityMappings;\n}\n\nconst requestMap = new Map<string, TraceEventsForNetworkRequest>();\nconst requestsById = new Map<string, Types.Events.SyntheticNetworkRequest>();\nconst requestsByOrigin = new Map<string, {\n renderBlocking: Types.Events.SyntheticNetworkRequest[],\n nonRenderBlocking: Types.Events.SyntheticNetworkRequest[],\n all: Types.Events.SyntheticNetworkRequest[],\n}>();\nconst requestsByTime: Types.Events.SyntheticNetworkRequest[] = [];\n\nconst networkRequestEventByInitiatorUrl = new Map<string, Types.Events.SyntheticNetworkRequest[]>();\nconst eventToInitiatorMap = new Map<Types.Events.SyntheticNetworkRequest, Types.Events.SyntheticNetworkRequest>();\n\n/**\n * These are to store ThirdParty data relationships between entities and events. To reduce iterating through data\n * more than we have to, here we start building the caches. After this, the RendererHandler will update\n * the relationships. When handling ThirdParty references, use the one in the RendererHandler instead.\n */\nconst entityMappings: HandlerHelpers.EntityMappings = {\n eventsByEntity: new Map<HandlerHelpers.Entity, Types.Events.Event[]>(),\n entityByEvent: new Map<Types.Events.Event, HandlerHelpers.Entity>(),\n createdEntityCache: new Map<string, HandlerHelpers.Entity>(),\n};\n\nfunction storeTraceEventWithRequestId<K extends keyof TraceEventsForNetworkRequest>(\n requestId: string, key: K, value: TraceEventsForNetworkRequest[K]): void {\n if (!requestMap.has(requestId)) {\n requestMap.set(requestId, {});\n }\n\n const traceEvents = requestMap.get(requestId);\n if (!traceEvents) {\n throw new Error(`Unable to locate trace events for request ID ${requestId}`);\n }\n\n if (Array.isArray(traceEvents[key])) {\n const target = traceEvents[key] as Types.Events.Event[];\n const values = value as Types.Events.Event[];\n target.push(...values);\n } else {\n traceEvents[key] = value;\n }\n}\n\nfunction firstPositiveValueInList(entries: number[]): number {\n for (const entry of entries) {\n if (entry > 0) {\n return entry;\n }\n }\n\n // In the event we don't find a positive value, we return 0 so as to\n // be a mathematical noop. It's typically not correct to return – say –\n // a -1 here because it would affect the calculation of stats below.\n return 0;\n}\n\nexport function reset(): void {\n requestsById.clear();\n requestsByOrigin.clear();\n requestMap.clear();\n requestsByTime.length = 0;\n networkRequestEventByInitiatorUrl.clear();\n eventToInitiatorMap.clear();\n webSocketData.clear();\n entityMappings.eventsByEntity.clear();\n entityMappings.entityByEvent.clear();\n entityMappings.createdEntityCache.clear();\n}\n\nexport function handleEvent(event: Types.Events.Event): void {\n if (Types.Events.isResourceChangePriority(event)) {\n storeTraceEventWithRequestId(event.args.data.requestId, 'changePriority', event);\n return;\n }\n\n if (Types.Events.isResourceWillSendRequest(event)) {\n storeTraceEventWithRequestId(event.args.data.requestId, 'willSendRequests', [event]);\n return;\n }\n\n if (Types.Events.isResourceSendRequest(event)) {\n storeTraceEventWithRequestId(event.args.data.requestId, 'sendRequests', [event]);\n return;\n }\n\n if (Types.Events.isResourceReceiveResponse(event)) {\n storeTraceEventWithRequestId(event.args.data.requestId, 'receiveResponse', event);\n return;\n }\n\n if (Types.Events.isResourceReceivedData(event)) {\n storeTraceEventWithRequestId(event.args.data.requestId, 'receivedData', [event]);\n return;\n }\n\n if (Types.Events.isResourceFinish(event)) {\n storeTraceEventWithRequestId(event.args.data.requestId, 'resourceFinish', event);\n return;\n }\n\n if (Types.Events.isResourceMarkAsCached(event)) {\n storeTraceEventWithRequestId(event.args.data.requestId, 'resourceMarkAsCached', event);\n return;\n }\n\n if (Types.Events.isWebSocketCreate(event) || Types.Events.isWebSocketInfo(event) ||\n Types.Events.isWebSocketTransfer(event)) {\n const identifier = event.args.data.identifier;\n if (!webSocketData.has(identifier)) {\n if (event.args.data.frame) {\n webSocketData.set(identifier, {\n frame: event.args.data.frame,\n webSocketIdentifier: identifier,\n events: [],\n syntheticConnection: null,\n });\n } else if (event.args.data.workerId) {\n webSocketData.set(identifier, {\n workerId: event.args.data.workerId,\n webSocketIdentifier: identifier,\n events: [],\n syntheticConnection: null,\n });\n }\n }\n\n webSocketData.get(identifier)?.events.push(event);\n }\n}\n\nexport async function finalize(): Promise<void> {\n const {rendererProcessesByFrame} = metaHandlerData();\n for (const [requestId, request] of requestMap.entries()) {\n // If we have an incomplete set of events here, we choose to drop the network\n // request rather than attempt to synthesize the missing data.\n if (!request.sendRequests || !request.receiveResponse) {\n continue;\n }\n\n // In the data we may get multiple willSendRequests and sendRequests, which\n // will indicate that there are redirects for a given (sub)resource. In the\n // case of a navigation, e.g., example.com/ we will get willSendRequests,\n // and we should use these to calculate time spent in redirects.\n // In the case of sub-resources, however, e.g., example.com/foo.js we will\n // *only* get sendRequests, and we use these instead of willSendRequests\n // to detect the time in redirects. We always use the sendRequest for the\n // url, priority etc since it contains those values, but we use the\n // willSendRequest (if it exists) to calculate the timestamp and durations\n // of redirects.\n const redirects: Types.Events.SyntheticNetworkRedirect[] = [];\n for (let i = 0; i < request.sendRequests.length - 1; i++) {\n const sendRequest = request.sendRequests[i];\n const nextSendRequest = request.sendRequests[i + 1];\n\n // Use the willSendRequests as the source for redirects if possible.\n // We default to those of the sendRequests, however, since willSendRequest\n // is not guaranteed to be present in the data for every request.\n let ts = sendRequest.ts;\n let dur = Types.Timing.Micro(nextSendRequest.ts - sendRequest.ts);\n if (request.willSendRequests?.[i] && request.willSendRequests[i + 1]) {\n const willSendRequest = request.willSendRequests[i];\n const nextWillSendRequest = request.willSendRequests[i + 1];\n ts = willSendRequest.ts;\n dur = Types.Timing.Micro(nextWillSendRequest.ts - willSendRequest.ts);\n }\n\n redirects.push({\n url: sendRequest.args.data.url,\n priority: sendRequest.args.data.priority,\n requestMethod: sendRequest.args.data.requestMethod,\n ts,\n dur,\n });\n }\n\n // If a ResourceFinish event with an encoded data length is received,\n // then the resource was not cached; it was fetched before it was\n // requested, e.g. because it was pushed in this navigation.\n const isPushedResource = request.resourceFinish?.args.data.encodedDataLength !== 0;\n // This works around crbug.com/998397, which reports pushed resources, and resources served by a service worker as disk cached.\n const isDiskCached = request.receiveResponse.args.data.fromCache &&\n !request.receiveResponse.args.data.fromServiceWorker && !isPushedResource;\n // If the request contains a resourceMarkAsCached event, it was served from memory cache.\n // The timing data returned is from the original (uncached) request, which\n // means that if we leave the above network record data as-is when the\n // request came from either the disk cache or memory cache, our calculations\n // will be incorrect.\n //\n // So we use this flag so when we calculate the timestamps of the various\n // events, we can overwrite them.\n // These timestamps may not be perfect (indeed they don't always match\n // the Network CDP domain exactly, which is likely an artifact of the way\n // the data is routed on the backend), but they're the closest we have.\n const isMemoryCached = request.resourceMarkAsCached !== undefined;\n // If a request has `resourceMarkAsCached` field, the `timing` field is not correct.\n // So let's discard it and override to 0 (which will be handled in later logic if timing field is undefined).\n const timing = isMemoryCached ? undefined : request.receiveResponse.args.data.timing;\n // If a non-cached request has no |timing| indicates data URLs, we ignore it.\n if (!timing && !isMemoryCached) {\n continue;\n }\n\n const firstSendRequest = request.sendRequests[0];\n const finalSendRequest = request.sendRequests[request.sendRequests.length - 1];\n\n const initialPriority = finalSendRequest.args.data.priority;\n let finalPriority = initialPriority;\n if (request.changePriority) {\n finalPriority = request.changePriority.args.data.priority;\n }\n\n // Network timings are complicated.\n // https://raw.githubusercontent.com/GoogleChrome/lighthouse/main/docs/Network-Timings.svg is generally correct, but.. less so for navigations/redirects/etc.\n\n // Start time\n // =======================\n // The time where the request started, which is either the first willSendRequest\n // event if there is one, or, if there is not, the sendRequest.\n const startTime = (request.willSendRequests?.length) ? Types.Timing.Micro(request.willSendRequests[0].ts) :\n Types.Timing.Micro(firstSendRequest.ts);\n\n // End redirect time\n // =======================\n // It's possible that when we start requesting data we will receive redirections.\n // Here we note the time of the *last* willSendRequest / sendRequest event,\n // which is used later on in the calculations for time queueing etc.\n const endRedirectTime = (request.willSendRequests?.length) ?\n Types.Timing.Micro(request.willSendRequests[request.willSendRequests.length - 1].ts) :\n Types.Timing.Micro(finalSendRequest.ts);\n\n // Finish time and end time\n // =======================\n // The finish time and the end time are subtly different.\n // - Finish time: records the point at which the network stack stopped receiving the data\n // - End time: the timestamp of the finish event itself (if one exists)\n //\n // The end time, then, will be slightly after the finish time.\n const endTime = request.resourceFinish ? request.resourceFinish.ts : endRedirectTime;\n const finishTime = request.resourceFinish?.args.data.finishTime ?\n Types.Timing.Micro(request.resourceFinish.args.data.finishTime * SECONDS_TO_MICROSECONDS) :\n Types.Timing.Micro(endTime);\n\n // Network duration\n // =======================\n // Time spent on the network.\n const networkDuration = Types.Timing.Micro(timing ? (finishTime || endRedirectTime) - endRedirectTime : 0);\n\n // Processing duration\n // =======================\n // Time spent from start to end.\n const processingDuration = Types.Timing.Micro(endTime - (finishTime || endTime));\n\n // Redirection duration\n // =======================\n // Time between the first willSendRequest / sendRequest and last. This we place in *front* of the\n // queueing, since the queueing time that we know about from the trace data is only the last request,\n // i.e., the one that occurs after all the redirects.\n const redirectionDuration = Types.Timing.Micro(endRedirectTime - startTime);\n\n // Queueing\n // =======================\n // The amount of time queueing is the time between the request's start time to the requestTime\n // arg recorded in the receiveResponse event. In the cases where the recorded start time is larger\n // that the requestTime we set queueing time to zero.\n const queueingFromTraceData = timing ? timing.requestTime * SECONDS_TO_MICROSECONDS - endRedirectTime : 0;\n const queueing = Types.Timing.Micro(Platform.NumberUtilities.clamp(queueingFromTraceData, 0, Number.MAX_VALUE));\n\n // Stalled\n // =======================\n // If the request is cached, the amount of time stalled is the time between the start time and\n // receiving a response.\n // Otherwise it is whichever positive number comes first from the following timing info:\n // DNS start, Connection start, Send Start, or the time duration between our start time and\n // receiving a response.\n const stalled = timing ? Types.Timing.Micro(firstPositiveValueInList([\n timing.dnsStart * MILLISECONDS_TO_MICROSECONDS,\n timing.connectStart * MILLISECONDS_TO_MICROSECONDS,\n timing.sendStart * MILLISECONDS_TO_MICROSECONDS,\n (request.receiveResponse.ts - endRedirectTime),\n ])) :\n Types.Timing.Micro(request.receiveResponse.ts - startTime);\n\n // Sending HTTP request\n // =======================\n // Time when the HTTP request is sent.\n const sendStartTime = timing ?\n Types.Timing.Micro(\n timing.requestTime * SECONDS_TO_MICROSECONDS + timing.sendStart * MILLISECONDS_TO_MICROSECONDS) :\n startTime;\n\n // Waiting\n // =======================\n // Time from when the send finished going to when the headers were received.\n const waiting = timing ?\n Types.Timing.Micro((timing.receiveHeadersEnd - timing.sendEnd) * MILLISECONDS_TO_MICROSECONDS) :\n Types.Timing.Micro(0);\n\n // Download\n // =======================\n // Time from receipt of headers to the finish time.\n const downloadStart = timing ?\n Types.Timing.Micro(\n timing.requestTime * SECONDS_TO_MICROSECONDS + timing.receiveHeadersEnd * MILLISECONDS_TO_MICROSECONDS) :\n startTime;\n const download = timing ? Types.Timing.Micro(((finishTime || downloadStart) - downloadStart)) :\n Types.Timing.Micro(endTime - request.receiveResponse.ts);\n\n const totalTime = Types.Timing.Micro(networkDuration + processingDuration);\n\n // Collect a few values from the timing info.\n // If the Network request is cached, these fields will be zero, so the minus will zero out them.\n const dnsLookup = timing ? Types.Timing.Micro((timing.dnsEnd - timing.dnsStart) * MILLISECONDS_TO_MICROSECONDS) :\n Types.Timing.Micro(0);\n const ssl = timing ? Types.Timing.Micro((timing.sslEnd - timing.sslStart) * MILLISECONDS_TO_MICROSECONDS) :\n Types.Timing.Micro(0);\n const proxyNegotiation = timing ?\n Types.Timing.Micro((timing.proxyEnd - timing.proxyStart) * MILLISECONDS_TO_MICROSECONDS) :\n Types.Timing.Micro(0);\n const requestSent = timing ?\n Types.Timing.Micro((timing.sendEnd - timing.sendStart) * MILLISECONDS_TO_MICROSECONDS) :\n Types.Timing.Micro(0);\n const initialConnection = timing ?\n Types.Timing.Micro((timing.connectEnd - timing.connectStart) * MILLISECONDS_TO_MICROSECONDS) :\n Types.Timing.Micro(0);\n\n // Finally get some of the general data from the trace events.\n const {frame, url, renderBlocking} = finalSendRequest.args.data;\n const {encodedDataLength, decodedBodyLength} =\n request.resourceFinish ? request.resourceFinish.args.data : {encodedDataLength: 0, decodedBodyLength: 0};\n const parsedUrl = new URL(url);\n const isHttps = parsedUrl.protocol === 'https:';\n const requestingFrameUrl =\n Helpers.Trace.activeURLForFrameAtTime(frame, finalSendRequest.ts, rendererProcessesByFrame) || '';\n // Construct a synthetic trace event for this network request.\n const networkEvent =\n Helpers.SyntheticEvents.SyntheticEventsManager.registerSyntheticEvent<Types.Events.SyntheticNetworkRequest>({\n rawSourceEvent: finalSendRequest,\n args: {\n data: {\n // All data we create from trace events should be added to |syntheticData|.\n syntheticData: {\n dnsLookup,\n download,\n downloadStart,\n finishTime,\n initialConnection,\n isDiskCached,\n isHttps,\n isMemoryCached,\n isPushedResource,\n networkDuration,\n processingDuration,\n proxyNegotiation,\n queueing,\n redirectionDuration,\n requestSent,\n sendStartTime,\n ssl,\n stalled,\n totalTime,\n waiting,\n },\n // All fields below are from TraceEventsForNetworkRequest.\n decodedBodyLength,\n encodedDataLength,\n frame,\n fromServiceWorker: request.receiveResponse.args.data.fromServiceWorker,\n isLinkPreload: finalSendRequest.args.data.isLinkPreload || false,\n mimeType: request.receiveResponse.args.data.mimeType,\n priority: finalPriority,\n initialPriority,\n protocol: request.receiveResponse.args.data.protocol ?? 'unknown',\n redirects,\n // In the event the property isn't set, assume non-blocking.\n renderBlocking: renderBlocking ?? 'non_blocking',\n requestId,\n requestingFrameUrl,\n requestMethod: finalSendRequest.args.data.requestMethod,\n resourceType: finalSendRequest.args.data.resourceType ?? Protocol.Network.ResourceType.Other,\n statusCode: request.receiveResponse.args.data.statusCode,\n responseHeaders: request.receiveResponse.args.data.headers || [],\n fetchPriorityHint: finalSendRequest.args.data.fetchPriorityHint ?? 'auto',\n initiator: finalSendRequest.args.data.initiator,\n stackTrace: finalSendRequest.args.data.stackTrace,\n timing,\n url,\n failed: request.resourceFinish?.args.data.didFail ?? false,\n finished: Boolean(request.resourceFinish),\n connectionId: request.receiveResponse.args.data.connectionId,\n connectionReused: request.receiveResponse.args.data.connectionReused,\n },\n },\n cat: 'loading',\n name: Types.Events.Name.SYNTHETIC_NETWORK_REQUEST,\n ph: Types.Events.Phase.COMPLETE,\n dur: Types.Timing.Micro(endTime - startTime),\n tdur: Types.Timing.Micro(endTime - startTime),\n ts: Types.Timing.Micro(startTime),\n tts: Types.Timing.Micro(startTime),\n pid: finalSendRequest.pid,\n tid: finalSendRequest.tid,\n });\n\n const requests = Platform.MapUtilities.getWithDefault(requestsByOrigin, parsedUrl.host, () => {\n return {\n renderBlocking: [],\n nonRenderBlocking: [],\n all: [],\n };\n });\n\n // For ease of rendering we sometimes want to differentiate between\n // render-blocking and non-render-blocking, so we divide the data here.\n if (!Helpers.Network.isSyntheticNetworkRequestEventRenderBlocking(networkEvent)) {\n requests.nonRenderBlocking.push(networkEvent);\n } else {\n requests.renderBlocking.push(networkEvent);\n }\n\n // However, there are also times where we just want to loop through all\n // the captured requests, so here we store all of them together.\n requests.all.push(networkEvent);\n requestsByTime.push(networkEvent);\n requestsById.set(networkEvent.args.data.requestId, networkEvent);\n\n // Update entity relationships for network events\n HandlerHelpers.addNetworkRequestToEntityMapping(networkEvent, entityMappings, request);\n\n // Establish initiator relationships\n const initiatorUrl = networkEvent.args.data.initiator?.url ||\n Helpers.Trace.getZeroIndexedStackTraceForEvent(networkEvent)?.at(0)?.url;\n if (initiatorUrl) {\n const events = networkRequestEventByInitiatorUrl.get(initiatorUrl) ?? [];\n events.push(networkEvent);\n networkRequestEventByInitiatorUrl.set(initiatorUrl, events);\n }\n }\n\n for (const request of requestsByTime) {\n const initiatedEvents = networkRequestEventByInitiatorUrl.get(request.args.data.url);\n\n if (initiatedEvents) {\n for (const initiatedEvent of initiatedEvents) {\n eventToInitiatorMap.set(initiatedEvent, request);\n }\n }\n }\n finalizeWebSocketData();\n}\n\nexport function data(): NetworkRequestData {\n return {\n byId: requestsById,\n byOrigin: requestsByOrigin,\n byTime: requestsByTime,\n eventToInitiator: eventToInitiatorMap,\n webSocket: [...webSocketData.values()],\n entityMappings: {\n entityByEvent: new Map(entityMappings.entityByEvent),\n eventsByEntity: new Map(entityMappings.eventsByEntity),\n createdEntityCache: new Map(entityMappings.createdEntityCache),\n },\n };\n}\n\nexport function deps(): HandlerName[] {\n return ['Meta'];\n}\n\nfunction finalizeWebSocketData(): void {\n // for each WebSocketTraceData in webSocketData map, we create a synthetic event\n // to represent the entire WebSocket connection. This is done by finding the start and end event\n // if they exist, and if they don't, we use the first event in the list for start, and the traceBounds.max\n // for the end. So each WebSocketTraceData will have\n // {\n // events: the list of WebSocket events\n // syntheticConnection: the synthetic event representing the entire WebSocket connection\n // }\n webSocketData.forEach(data => {\n let startEvent: Types.Events.WebSocketEvent|null = null;\n let endEvent: Types.Events.WebSocketDestroy|null = null;\n for (const event of data.events) {\n if (Types.Events.isWebSocketCreate(event)) {\n startEvent = event;\n }\n if (Types.Events.isWebSocketDestroy(event)) {\n endEvent = event;\n }\n }\n data.syntheticConnection = createSyntheticWebSocketConnection(startEvent, endEvent, data.events[0]);\n });\n}\n\nfunction createSyntheticWebSocketConnection(\n startEvent: Types.Events.WebSocketCreate|null, endEvent: Types.Events.WebSocketDestroy|null,\n firstRecordedEvent: Types.Events.WebSocketEvent): Types.Events.SyntheticWebSocketConnection {\n const {traceBounds} = metaHandlerData();\n const startTs = startEvent ? startEvent.ts : traceBounds.min;\n const endTs = endEvent ? endEvent.ts : traceBounds.max;\n const duration = endTs - startTs;\n const mainEvent = startEvent || endEvent || firstRecordedEvent;\n return {\n name: 'SyntheticWebSocketConnection',\n cat: mainEvent.cat,\n ph: Types.Events.Phase.COMPLETE,\n ts: startTs,\n dur: duration as Types.Timing.Micro,\n pid: mainEvent.pid,\n tid: mainEvent.tid,\n s: mainEvent.s,\n rawSourceEvent: mainEvent,\n _tag: 'SyntheticEntryTag',\n args: {\n data: {\n identifier: mainEvent.args.data.identifier,\n priority: Protocol.Network.ResourcePriority.Low,\n url: mainEvent.args.data.url || '',\n },\n },\n };\n}\n"]}
1
+ {"version":3,"file":"NetworkRequestsHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/NetworkRequestsHandler.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAE/D,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,KAAK,cAAc,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAC,IAAI,IAAI,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAGzD,MAAM,4BAA4B,GAAG,IAAI,CAAC;AAC1C,MAAM,uB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AE,8BAA8B;QACpC,GAAG,EAAE,SAAS,CAAC,GAAG;QAClB,EAAE,uCAA6B;QAC/B,EAAE,EAAE,OAAO;QACX,GAAG,EAAE,QAA8B;QACnC,GAAG,EAAE,SAAS,CAAC,GAAG;QAClB,GAAG,EAAE,SAAS,CAAC,GAAG;QAClB,CAAC,EAAE,SAAS,CAAC,CAAC;QACd,cAAc,EAAE,SAAS;QACzB,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE;YACJ,IAAI,EAAE;gBACJ,UAAU,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU;gBAC1C,QAAQ,mDAAuC;gBAC/C,GAAG,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE;aACnC;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright 2022 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Platform from '../../../core/platform/platform.js';\nimport * as Protocol from '../../../generated/protocol.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport * as HandlerHelpers from './helpers.js';\nimport {data as metaHandlerData} from './MetaHandler.js';\nimport type {HandlerName} from './types.js';\n\nconst MILLISECONDS_TO_MICROSECONDS = 1000;\nconst SECONDS_TO_MICROSECONDS = 1000000;\n\n// Network requests from traces are actually formed of 5 trace records.\n// This handler tracks all trace records based on the request ID, and\n// then creates a new synthetic trace event for those network requests.\n//\n// This interface, then, defines the shape of the object we intend to\n// keep for each request in the trace. In the finalize we will convert\n// these 5 types of trace records to a synthetic complete event that\n// represents a composite of these trace records.\nexport interface TraceEventsForNetworkRequest {\n changePriority?: Types.Events.ResourceChangePriority;\n willSendRequests?: Types.Events.ResourceWillSendRequest[];\n sendRequests?: Types.Events.ResourceSendRequest[];\n receiveResponse?: Types.Events.ResourceReceiveResponse;\n resourceFinish?: Types.Events.ResourceFinish;\n receivedData?: Types.Events.ResourceReceivedData[];\n resourceMarkAsCached?: Types.Events.ResourceMarkAsCached;\n}\n\nexport interface WebSocketTraceDataForFrame {\n frame: string;\n webSocketIdentifier: number;\n events: Types.Events.WebSocketEvent[];\n syntheticConnection: Types.Events.SyntheticWebSocketConnection|null;\n}\nexport interface WebSocketTraceDataForWorker {\n workerId: string;\n webSocketIdentifier: number;\n events: Types.Events.WebSocketEvent[];\n syntheticConnection: Types.Events.SyntheticWebSocketConnection|null;\n}\nexport type WebSocketTraceData = WebSocketTraceDataForFrame|WebSocketTraceDataForWorker;\n\nconst webSocketData = new Map<number, WebSocketTraceData>();\ninterface NetworkRequestData {\n byId: Map<string, Types.Events.SyntheticNetworkRequest>;\n byOrigin: Map<string, {\n renderBlocking: Types.Events.SyntheticNetworkRequest[],\n nonRenderBlocking: Types.Events.SyntheticNetworkRequest[],\n all: Types.Events.SyntheticNetworkRequest[],\n }>;\n byTime: Types.Events.SyntheticNetworkRequest[];\n eventToInitiator: Map<Types.Events.SyntheticNetworkRequest, Types.Events.SyntheticNetworkRequest>;\n webSocket: WebSocketTraceData[];\n entityMappings: HandlerHelpers.EntityMappings;\n}\n\nconst requestMap = new Map<string, TraceEventsForNetworkRequest>();\nconst requestsById = new Map<string, Types.Events.SyntheticNetworkRequest>();\nconst requestsByOrigin = new Map<string, {\n renderBlocking: Types.Events.SyntheticNetworkRequest[],\n nonRenderBlocking: Types.Events.SyntheticNetworkRequest[],\n all: Types.Events.SyntheticNetworkRequest[],\n}>();\nconst requestsByTime: Types.Events.SyntheticNetworkRequest[] = [];\n\nconst networkRequestEventByInitiatorUrl = new Map<string, Types.Events.SyntheticNetworkRequest[]>();\nconst eventToInitiatorMap = new Map<Types.Events.SyntheticNetworkRequest, Types.Events.SyntheticNetworkRequest>();\n\n/**\n * These are to store ThirdParty data relationships between entities and events. To reduce iterating through data\n * more than we have to, here we start building the caches. After this, the RendererHandler will update\n * the relationships. When handling ThirdParty references, use the one in the RendererHandler instead.\n */\nconst entityMappings: HandlerHelpers.EntityMappings = {\n eventsByEntity: new Map<HandlerHelpers.Entity, Types.Events.Event[]>(),\n entityByEvent: new Map<Types.Events.Event, HandlerHelpers.Entity>(),\n createdEntityCache: new Map<string, HandlerHelpers.Entity>(),\n};\n\nfunction storeTraceEventWithRequestId<K extends keyof TraceEventsForNetworkRequest>(\n requestId: string, key: K, value: TraceEventsForNetworkRequest[K]): void {\n if (!requestMap.has(requestId)) {\n requestMap.set(requestId, {});\n }\n\n const traceEvents = requestMap.get(requestId);\n if (!traceEvents) {\n throw new Error(`Unable to locate trace events for request ID ${requestId}`);\n }\n\n if (Array.isArray(traceEvents[key])) {\n const target = traceEvents[key] as Types.Events.Event[];\n const values = value as Types.Events.Event[];\n target.push(...values);\n } else {\n traceEvents[key] = value;\n }\n}\n\nfunction firstPositiveValueInList(entries: number[]): number {\n for (const entry of entries) {\n if (entry > 0) {\n return entry;\n }\n }\n\n // In the event we don't find a positive value, we return 0 so as to\n // be a mathematical noop. It's typically not correct to return – say –\n // a -1 here because it would affect the calculation of stats below.\n return 0;\n}\n\nexport function reset(): void {\n requestsById.clear();\n requestsByOrigin.clear();\n requestMap.clear();\n requestsByTime.length = 0;\n networkRequestEventByInitiatorUrl.clear();\n eventToInitiatorMap.clear();\n webSocketData.clear();\n entityMappings.eventsByEntity.clear();\n entityMappings.entityByEvent.clear();\n entityMappings.createdEntityCache.clear();\n}\n\nexport function handleEvent(event: Types.Events.Event): void {\n if (Types.Events.isResourceChangePriority(event)) {\n storeTraceEventWithRequestId(event.args.data.requestId, 'changePriority', event);\n return;\n }\n\n if (Types.Events.isResourceWillSendRequest(event)) {\n storeTraceEventWithRequestId(event.args.data.requestId, 'willSendRequests', [event]);\n return;\n }\n\n if (Types.Events.isResourceSendRequest(event)) {\n storeTraceEventWithRequestId(event.args.data.requestId, 'sendRequests', [event]);\n return;\n }\n\n if (Types.Events.isResourceReceiveResponse(event)) {\n storeTraceEventWithRequestId(event.args.data.requestId, 'receiveResponse', event);\n return;\n }\n\n if (Types.Events.isResourceReceivedData(event)) {\n storeTraceEventWithRequestId(event.args.data.requestId, 'receivedData', [event]);\n return;\n }\n\n if (Types.Events.isResourceFinish(event)) {\n storeTraceEventWithRequestId(event.args.data.requestId, 'resourceFinish', event);\n return;\n }\n\n if (Types.Events.isResourceMarkAsCached(event)) {\n storeTraceEventWithRequestId(event.args.data.requestId, 'resourceMarkAsCached', event);\n return;\n }\n\n if (Types.Events.isWebSocketCreate(event) || Types.Events.isWebSocketInfo(event) ||\n Types.Events.isWebSocketTransfer(event)) {\n const identifier = event.args.data.identifier;\n if (!webSocketData.has(identifier)) {\n if (event.args.data.frame) {\n webSocketData.set(identifier, {\n frame: event.args.data.frame,\n webSocketIdentifier: identifier,\n events: [],\n syntheticConnection: null,\n });\n } else if (event.args.data.workerId) {\n webSocketData.set(identifier, {\n workerId: event.args.data.workerId,\n webSocketIdentifier: identifier,\n events: [],\n syntheticConnection: null,\n });\n }\n }\n\n webSocketData.get(identifier)?.events.push(event);\n }\n}\n\nexport async function finalize(): Promise<void> {\n const {rendererProcessesByFrame} = metaHandlerData();\n for (const [requestId, request] of requestMap.entries()) {\n // If we have an incomplete set of events here, we choose to drop the network\n // request rather than attempt to synthesize the missing data.\n if (!request.sendRequests || !request.receiveResponse) {\n continue;\n }\n\n // In the data we may get multiple willSendRequests and sendRequests, which\n // will indicate that there are redirects for a given (sub)resource. In the\n // case of a navigation, e.g., example.com/ we will get willSendRequests,\n // and we should use these to calculate time spent in redirects.\n // In the case of sub-resources, however, e.g., example.com/foo.js we will\n // *only* get sendRequests, and we use these instead of willSendRequests\n // to detect the time in redirects. We always use the sendRequest for the\n // url, priority etc since it contains those values, but we use the\n // willSendRequest (if it exists) to calculate the timestamp and durations\n // of redirects.\n const redirects: Types.Events.SyntheticNetworkRedirect[] = [];\n for (let i = 0; i < request.sendRequests.length - 1; i++) {\n const sendRequest = request.sendRequests[i];\n const nextSendRequest = request.sendRequests[i + 1];\n\n // Use the willSendRequests as the source for redirects if possible.\n // We default to those of the sendRequests, however, since willSendRequest\n // is not guaranteed to be present in the data for every request.\n let ts = sendRequest.ts;\n let dur = Types.Timing.Micro(nextSendRequest.ts - sendRequest.ts);\n if (request.willSendRequests?.[i] && request.willSendRequests[i + 1]) {\n const willSendRequest = request.willSendRequests[i];\n const nextWillSendRequest = request.willSendRequests[i + 1];\n ts = willSendRequest.ts;\n dur = Types.Timing.Micro(nextWillSendRequest.ts - willSendRequest.ts);\n }\n\n redirects.push({\n url: sendRequest.args.data.url,\n priority: sendRequest.args.data.priority,\n requestMethod: sendRequest.args.data.requestMethod,\n ts,\n dur,\n });\n }\n\n // If a ResourceFinish event with an encoded data length is received,\n // then the resource was not cached; it was fetched before it was\n // requested, e.g. because it was pushed in this navigation.\n const isPushedResource = request.resourceFinish?.args.data.encodedDataLength !== 0;\n // This works around crbug.com/998397, which reports pushed resources, and resources served by a service worker as disk cached.\n const isDiskCached = request.receiveResponse.args.data.fromCache &&\n !request.receiveResponse.args.data.fromServiceWorker && !isPushedResource;\n // If the request contains a resourceMarkAsCached event, it was served from memory cache.\n // The timing data returned is from the original (uncached) request, which\n // means that if we leave the above network record data as-is when the\n // request came from either the disk cache or memory cache, our calculations\n // will be incorrect.\n //\n // So we use this flag so when we calculate the timestamps of the various\n // events, we can overwrite them.\n // These timestamps may not be perfect (indeed they don't always match\n // the Network CDP domain exactly, which is likely an artifact of the way\n // the data is routed on the backend), but they're the closest we have.\n const isMemoryCached = request.resourceMarkAsCached !== undefined;\n // If a request has `resourceMarkAsCached` field, the `timing` field is not correct.\n // So let's discard it and override to 0 (which will be handled in later logic if timing field is undefined).\n const timing = isMemoryCached ? undefined : request.receiveResponse.args.data.timing;\n // If a non-cached request has no |timing| indicates data URLs, we ignore it.\n if (!timing && !isMemoryCached) {\n continue;\n }\n\n const firstSendRequest = request.sendRequests[0];\n const finalSendRequest = request.sendRequests[request.sendRequests.length - 1];\n\n const initialPriority = finalSendRequest.args.data.priority;\n let finalPriority = initialPriority;\n if (request.changePriority) {\n finalPriority = request.changePriority.args.data.priority;\n }\n\n // Network timings are complicated.\n // https://raw.githubusercontent.com/GoogleChrome/lighthouse/main/docs/Network-Timings.svg is generally correct, but.. less so for navigations/redirects/etc.\n\n // Start time\n // =======================\n // The time where the request started, which is either the first willSendRequest\n // event if there is one, or, if there is not, the sendRequest.\n const startTime = (request.willSendRequests?.length) ? Types.Timing.Micro(request.willSendRequests[0].ts) :\n Types.Timing.Micro(firstSendRequest.ts);\n\n // End redirect time\n // =======================\n // It's possible that when we start requesting data we will receive redirections.\n // Here we note the time of the *last* willSendRequest / sendRequest event,\n // which is used later on in the calculations for time queueing etc.\n const endRedirectTime = (request.willSendRequests?.length) ?\n Types.Timing.Micro(request.willSendRequests[request.willSendRequests.length - 1].ts) :\n Types.Timing.Micro(finalSendRequest.ts);\n\n // Finish time and end time\n // =======================\n // The finish time and the end time are subtly different.\n // - Finish time: records the point at which the network stack stopped receiving the data\n // - End time: the timestamp of the finish event itself (if one exists)\n //\n // The end time, then, will be slightly after the finish time.\n const endTime = request.resourceFinish ? request.resourceFinish.ts : endRedirectTime;\n const finishTime = request.resourceFinish?.args.data.finishTime ?\n Types.Timing.Micro(request.resourceFinish.args.data.finishTime * SECONDS_TO_MICROSECONDS) :\n Types.Timing.Micro(endTime);\n\n // Network duration\n // =======================\n // Time spent on the network.\n const networkDuration = Types.Timing.Micro(timing ? (finishTime || endRedirectTime) - endRedirectTime : 0);\n\n // Processing duration\n // =======================\n // Time spent from start to end.\n const processingDuration = Types.Timing.Micro(endTime - (finishTime || endTime));\n\n // Redirection duration\n // =======================\n // Time between the first willSendRequest / sendRequest and last. This we place in *front* of the\n // queueing, since the queueing time that we know about from the trace data is only the last request,\n // i.e., the one that occurs after all the redirects.\n const redirectionDuration = Types.Timing.Micro(endRedirectTime - startTime);\n\n // Queueing\n // =======================\n // The amount of time queueing is the time between the request's start time to the requestTime\n // arg recorded in the receiveResponse event. In the cases where the recorded start time is larger\n // that the requestTime we set queueing time to zero.\n const queueingFromTraceData = timing ? timing.requestTime * SECONDS_TO_MICROSECONDS - endRedirectTime : 0;\n const queueing = Types.Timing.Micro(Platform.NumberUtilities.clamp(queueingFromTraceData, 0, Number.MAX_VALUE));\n\n // Stalled\n // =======================\n // If the request is cached, the amount of time stalled is the time between the start time and\n // receiving a response.\n // Otherwise it is whichever positive number comes first from the following timing info:\n // DNS start, Connection start, Send Start, or the time duration between our start time and\n // receiving a response.\n const stalled = timing ? Types.Timing.Micro(firstPositiveValueInList([\n timing.dnsStart * MILLISECONDS_TO_MICROSECONDS,\n timing.connectStart * MILLISECONDS_TO_MICROSECONDS,\n timing.sendStart * MILLISECONDS_TO_MICROSECONDS,\n (request.receiveResponse.ts - endRedirectTime),\n ])) :\n Types.Timing.Micro(request.receiveResponse.ts - startTime);\n\n // Sending HTTP request\n // =======================\n // Time when the HTTP request is sent.\n const sendStartTime = timing ?\n Types.Timing.Micro(\n timing.requestTime * SECONDS_TO_MICROSECONDS + timing.sendStart * MILLISECONDS_TO_MICROSECONDS) :\n startTime;\n\n // Waiting\n // =======================\n // Time from when the send finished going to when the headers were received.\n const waiting = timing ?\n Types.Timing.Micro((timing.receiveHeadersEnd - timing.sendEnd) * MILLISECONDS_TO_MICROSECONDS) :\n Types.Timing.Micro(0);\n\n // Download\n // =======================\n // Time from receipt of headers to the finish time.\n const downloadStart = timing ?\n Types.Timing.Micro(\n timing.requestTime * SECONDS_TO_MICROSECONDS + timing.receiveHeadersEnd * MILLISECONDS_TO_MICROSECONDS) :\n startTime;\n const download = timing ? Types.Timing.Micro(((finishTime || downloadStart) - downloadStart)) :\n Types.Timing.Micro(endTime - request.receiveResponse.ts);\n\n const totalTime = Types.Timing.Micro(networkDuration + processingDuration);\n\n // Collect a few values from the timing info.\n // If the Network request is cached, these fields will be zero, so the minus will zero out them.\n const dnsLookup = timing ? Types.Timing.Micro((timing.dnsEnd - timing.dnsStart) * MILLISECONDS_TO_MICROSECONDS) :\n Types.Timing.Micro(0);\n const ssl = timing ? Types.Timing.Micro((timing.sslEnd - timing.sslStart) * MILLISECONDS_TO_MICROSECONDS) :\n Types.Timing.Micro(0);\n const proxyNegotiation = timing ?\n Types.Timing.Micro((timing.proxyEnd - timing.proxyStart) * MILLISECONDS_TO_MICROSECONDS) :\n Types.Timing.Micro(0);\n const requestSent = timing ?\n Types.Timing.Micro((timing.sendEnd - timing.sendStart) * MILLISECONDS_TO_MICROSECONDS) :\n Types.Timing.Micro(0);\n const initialConnection = timing ?\n Types.Timing.Micro((timing.connectEnd - timing.connectStart) * MILLISECONDS_TO_MICROSECONDS) :\n Types.Timing.Micro(0);\n\n // Finally get some of the general data from the trace events.\n const {frame, url, renderBlocking} = finalSendRequest.args.data;\n const {encodedDataLength, decodedBodyLength} =\n request.resourceFinish ? request.resourceFinish.args.data : {encodedDataLength: 0, decodedBodyLength: 0};\n const parsedUrl = new URL(url);\n const isHttps = parsedUrl.protocol === 'https:';\n const requestingFrameUrl =\n Helpers.Trace.activeURLForFrameAtTime(frame, finalSendRequest.ts, rendererProcessesByFrame) || '';\n // Construct a synthetic trace event for this network request.\n const networkEvent =\n Helpers.SyntheticEvents.SyntheticEventsManager.registerSyntheticEvent<Types.Events.SyntheticNetworkRequest>({\n rawSourceEvent: finalSendRequest,\n args: {\n data: {\n // All data we create from trace events should be added to |syntheticData|.\n syntheticData: {\n dnsLookup,\n download,\n downloadStart,\n finishTime,\n initialConnection,\n isDiskCached,\n isHttps,\n isMemoryCached,\n isPushedResource,\n networkDuration,\n processingDuration,\n proxyNegotiation,\n queueing,\n redirectionDuration,\n requestSent,\n sendStartTime,\n ssl,\n stalled,\n totalTime,\n waiting,\n },\n // All fields below are from TraceEventsForNetworkRequest.\n decodedBodyLength,\n encodedDataLength,\n frame,\n fromServiceWorker: request.receiveResponse.args.data.fromServiceWorker,\n isLinkPreload: finalSendRequest.args.data.isLinkPreload || false,\n mimeType: request.receiveResponse.args.data.mimeType,\n priority: finalPriority,\n initialPriority,\n protocol: request.receiveResponse.args.data.protocol ?? 'unknown',\n redirects,\n // In the event the property isn't set, assume non-blocking.\n renderBlocking: renderBlocking ?? 'non_blocking',\n requestId,\n requestingFrameUrl,\n requestMethod: finalSendRequest.args.data.requestMethod,\n resourceType: finalSendRequest.args.data.resourceType ?? Protocol.Network.ResourceType.Other,\n statusCode: request.receiveResponse.args.data.statusCode,\n responseHeaders: request.receiveResponse.args.data.headers || [],\n fetchPriorityHint: finalSendRequest.args.data.fetchPriorityHint ?? 'auto',\n initiator: finalSendRequest.args.data.initiator,\n stackTrace: finalSendRequest.args.data.stackTrace,\n timing,\n url,\n failed: request.resourceFinish?.args.data.didFail ?? false,\n finished: Boolean(request.resourceFinish),\n connectionId: request.receiveResponse.args.data.connectionId,\n connectionReused: request.receiveResponse.args.data.connectionReused,\n },\n },\n cat: 'loading',\n name: Types.Events.Name.SYNTHETIC_NETWORK_REQUEST,\n ph: Types.Events.Phase.COMPLETE,\n dur: Types.Timing.Micro(endTime - startTime),\n tdur: Types.Timing.Micro(endTime - startTime),\n ts: Types.Timing.Micro(startTime),\n tts: Types.Timing.Micro(startTime),\n pid: finalSendRequest.pid,\n tid: finalSendRequest.tid,\n });\n\n const requests = Platform.MapUtilities.getWithDefault(requestsByOrigin, parsedUrl.host, () => {\n return {\n renderBlocking: [],\n nonRenderBlocking: [],\n all: [],\n };\n });\n\n // For ease of rendering we sometimes want to differentiate between\n // render-blocking and non-render-blocking, so we divide the data here.\n if (!Helpers.Network.isSyntheticNetworkRequestEventRenderBlocking(networkEvent)) {\n requests.nonRenderBlocking.push(networkEvent);\n } else {\n requests.renderBlocking.push(networkEvent);\n }\n\n // However, there are also times where we just want to loop through all\n // the captured requests, so here we store all of them together.\n requests.all.push(networkEvent);\n requestsByTime.push(networkEvent);\n requestsById.set(networkEvent.args.data.requestId, networkEvent);\n\n // Update entity relationships for network events\n HandlerHelpers.addNetworkRequestToEntityMapping(networkEvent, entityMappings, request);\n\n // Establish initiator relationships\n const initiatorUrl = networkEvent.args.data.initiator?.url ||\n Helpers.Trace.getZeroIndexedStackTraceInEventPayload(networkEvent)?.at(0)?.url;\n if (initiatorUrl) {\n const events = networkRequestEventByInitiatorUrl.get(initiatorUrl) ?? [];\n events.push(networkEvent);\n networkRequestEventByInitiatorUrl.set(initiatorUrl, events);\n }\n }\n\n for (const request of requestsByTime) {\n const initiatedEvents = networkRequestEventByInitiatorUrl.get(request.args.data.url);\n\n if (initiatedEvents) {\n for (const initiatedEvent of initiatedEvents) {\n eventToInitiatorMap.set(initiatedEvent, request);\n }\n }\n }\n finalizeWebSocketData();\n}\n\nexport function data(): NetworkRequestData {\n return {\n byId: requestsById,\n byOrigin: requestsByOrigin,\n byTime: requestsByTime,\n eventToInitiator: eventToInitiatorMap,\n webSocket: [...webSocketData.values()],\n entityMappings: {\n entityByEvent: new Map(entityMappings.entityByEvent),\n eventsByEntity: new Map(entityMappings.eventsByEntity),\n createdEntityCache: new Map(entityMappings.createdEntityCache),\n },\n };\n}\n\nexport function deps(): HandlerName[] {\n return ['Meta'];\n}\n\nfunction finalizeWebSocketData(): void {\n // for each WebSocketTraceData in webSocketData map, we create a synthetic event\n // to represent the entire WebSocket connection. This is done by finding the start and end event\n // if they exist, and if they don't, we use the first event in the list for start, and the traceBounds.max\n // for the end. So each WebSocketTraceData will have\n // {\n // events: the list of WebSocket events\n // syntheticConnection: the synthetic event representing the entire WebSocket connection\n // }\n webSocketData.forEach(data => {\n let startEvent: Types.Events.WebSocketEvent|null = null;\n let endEvent: Types.Events.WebSocketDestroy|null = null;\n for (const event of data.events) {\n if (Types.Events.isWebSocketCreate(event)) {\n startEvent = event;\n }\n if (Types.Events.isWebSocketDestroy(event)) {\n endEvent = event;\n }\n }\n data.syntheticConnection = createSyntheticWebSocketConnection(startEvent, endEvent, data.events[0]);\n });\n}\n\nfunction createSyntheticWebSocketConnection(\n startEvent: Types.Events.WebSocketCreate|null, endEvent: Types.Events.WebSocketDestroy|null,\n firstRecordedEvent: Types.Events.WebSocketEvent): Types.Events.SyntheticWebSocketConnection {\n const {traceBounds} = metaHandlerData();\n const startTs = startEvent ? startEvent.ts : traceBounds.min;\n const endTs = endEvent ? endEvent.ts : traceBounds.max;\n const duration = endTs - startTs;\n const mainEvent = startEvent || endEvent || firstRecordedEvent;\n return {\n name: 'SyntheticWebSocketConnection',\n cat: mainEvent.cat,\n ph: Types.Events.Phase.COMPLETE,\n ts: startTs,\n dur: duration as Types.Timing.Micro,\n pid: mainEvent.pid,\n tid: mainEvent.tid,\n s: mainEvent.s,\n rawSourceEvent: mainEvent,\n _tag: 'SyntheticEntryTag',\n args: {\n data: {\n identifier: mainEvent.args.data.identifier,\n priority: Protocol.Network.ResourcePriority.Low,\n url: mainEvent.args.data.url || '',\n },\n },\n };\n}\n"]}
@@ -29,7 +29,7 @@ export declare function assignIsMainFrame(processes: Map<Types.Events.ProcessID,
29
29
  * Assigns the thread name to all threads in all processes.
30
30
  * @see assignMeta
31
31
  */
32
- export declare function assignThreadName(processes: Map<Types.Events.ProcessID, RendererProcess>, rendererProcessesByFrame: FrameProcessData, threadsInProcess: Map<Types.Events.ProcessID, Map<Types.Events.ThreadID, Types.Events.ThreadName>>): void;
32
+ export declare function assignThreadName(processes: Map<Types.Events.ProcessID, RendererProcess>, threadsInProcess: Map<Types.Events.ProcessID, Map<Types.Events.ThreadID, Types.Events.ThreadName>>): void;
33
33
  /**
34
34
  * Removes unneeded trace data opportunistically stored while handling events.
35
35
  * This currently does the following:
@@ -140,7 +140,7 @@ function gatherCompositorThreads() {
140
140
  export function assignMeta(processes, mainFrameId, rendererProcessesByFrame, threadsInProcess) {
141
141
  assignOrigin(processes, rendererProcessesByFrame);
142
142
  assignIsMainFrame(processes, mainFrameId, rendererProcessesByFrame);
143
- assignThreadName(processes, rendererProcessesByFrame, threadsInProcess);
143
+ assignThreadName(processes, threadsInProcess);
144
144
  }
145
145
  /**
146
146
  * Assigns origins to all threads in all processes.
@@ -195,7 +195,7 @@ export function assignIsMainFrame(processes, mainFrameId, rendererProcessesByFra
195
195
  * Assigns the thread name to all threads in all processes.
196
196
  * @see assignMeta
197
197
  */
198
- export function assignThreadName(processes, rendererProcessesByFrame, threadsInProcess) {
198
+ export function assignThreadName(processes, threadsInProcess) {
199
199
  for (const [pid, process] of processes) {
200
200
  for (const [tid, threadInfo] of threadsInProcess.get(pid) ?? []) {
201
201
  const thread = getOrCreateRendererThread(process, tid);