@paulirish/trace_engine 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/trace.mjs CHANGED
@@ -17,6 +17,7 @@ var handlers_exports = {};
17
17
  __export(handlers_exports, {
18
18
  Migration: () => Migration_exports,
19
19
  ModelHandlers: () => ModelHandlers_exports,
20
+ Threads: () => Threads_exports,
20
21
  Types: () => types_exports2
21
22
  });
22
23
 
@@ -208,17 +209,6 @@ function arrayDoesNotContainNullOrUndefined(arr) {
208
209
  return !arr.includes(null) && !arr.includes(void 0);
209
210
  }
210
211
 
211
- // front_end/core/platform/DevToolsPath.ts
212
- var DevToolsPath_exports = {};
213
- __export(DevToolsPath_exports, {
214
- EmptyEncodedPathString: () => EmptyEncodedPathString,
215
- EmptyRawPathString: () => EmptyRawPathString,
216
- EmptyUrlString: () => EmptyUrlString
217
- });
218
- var EmptyUrlString = "";
219
- var EmptyRawPathString = "";
220
- var EmptyEncodedPathString = "";
221
-
222
212
  // front_end/core/platform/map-utilities.ts
223
213
  var map_utilities_exports = {};
224
214
  __export(map_utilities_exports, {
@@ -384,13 +374,6 @@ function assertNever(type, message) {
384
374
  throw new Error(message);
385
375
  }
386
376
 
387
- // front_end/core/platform/platform.ts
388
- function DCHECK(condition, message = "DCHECK") {
389
- if (!condition()) {
390
- throw new Error(message + ":" + new Error().stack);
391
- }
392
- }
393
-
394
377
  // front_end/models/trace/types/types.ts
395
378
  var types_exports = {};
396
379
  __export(types_exports, {
@@ -403,13 +386,26 @@ __export(types_exports, {
403
386
  // front_end/models/trace/types/Configuration.ts
404
387
  var Configuration_exports = {};
405
388
  __export(Configuration_exports, {
406
- DEFAULT: () => DEFAULT
389
+ DEFAULT: () => DEFAULT,
390
+ configToCacheKey: () => configToCacheKey
407
391
  });
408
392
  var DEFAULT = {
409
- settings: {
410
- showNativeFunctionsInJSProfile: false
393
+ settings: {},
394
+ experiments: {
395
+ timelineV8RuntimeCallStats: false,
396
+ timelineShowAllEvents: false
397
+ },
398
+ processing: {
399
+ eventsPerChunk: 15e3,
400
+ pauseDuration: 1
411
401
  }
412
402
  };
403
+ function configToCacheKey(config2) {
404
+ return [
405
+ `experiments.timelineShowAllEvents:${config2.experiments.timelineShowAllEvents}`,
406
+ `experiments.timelineV8RuntimeCallStats:${config2.experiments.timelineV8RuntimeCallStats}`
407
+ ].join("-");
408
+ }
413
409
 
414
410
  // front_end/models/trace/types/File.ts
415
411
  var File_exports = {};
@@ -466,10 +462,12 @@ __export(TraceEvents_exports, {
466
462
  isNestableAsyncPhase: () => isNestableAsyncPhase,
467
463
  isProcessName: () => isProcessName,
468
464
  isProfileCall: () => isProfileCall,
465
+ isRendererEvent: () => isRendererEvent,
469
466
  isSyntheticConsoleTimingTraceEvent: () => isSyntheticConsoleTimingTraceEvent,
470
467
  isSyntheticInteractionEvent: () => isSyntheticInteractionEvent,
471
468
  isSyntheticLayoutShift: () => isSyntheticLayoutShift,
472
469
  isSyntheticNetworkRequestDetailsEvent: () => isSyntheticNetworkRequestDetailsEvent,
470
+ isSyntheticTraceEventCpuProfile: () => isSyntheticTraceEventCpuProfile,
473
471
  isSyntheticUserTimingTraceEvent: () => isSyntheticUserTimingTraceEvent,
474
472
  isThreadName: () => isThreadName,
475
473
  isTraceEventAnimation: () => isTraceEventAnimation,
@@ -597,6 +595,9 @@ var StyleRecalcInvalidationReason = /* @__PURE__ */ ((StyleRecalcInvalidationRea
597
595
  function isSyntheticInteractionEvent(event) {
598
596
  return Boolean("interactionId" in event && event.args?.data && "beginEvent" in event.args.data && "endEvent" in event.args.data);
599
597
  }
598
+ function isRendererEvent(event) {
599
+ return isTraceEventRendererEvent(event) || isProfileCall(event);
600
+ }
600
601
  var ProfileIdTag = class {
601
602
  #profileIdTag;
602
603
  };
@@ -720,6 +721,9 @@ function isTraceEventGPUTask(traceEventData) {
720
721
  function isTraceEventProfile(traceEventData) {
721
722
  return traceEventData.name === "Profile";
722
723
  }
724
+ function isSyntheticTraceEventCpuProfile(traceEventData) {
725
+ return traceEventData.name === "CpuProfile";
726
+ }
723
727
  function isTraceEventProfileChunk(traceEventData) {
724
728
  return traceEventData.name === "ProfileChunk";
725
729
  }
@@ -1059,25 +1063,138 @@ function data() {
1059
1063
  };
1060
1064
  }
1061
1065
 
1066
+ // front_end/models/trace/handlers/AuctionWorkletsHandler.ts
1067
+ var AuctionWorkletsHandler_exports = {};
1068
+ __export(AuctionWorkletsHandler_exports, {
1069
+ data: () => data2,
1070
+ finalize: () => finalize2,
1071
+ handleEvent: () => handleEvent2,
1072
+ reset: () => reset2
1073
+ });
1074
+ var runningInProcessEvents = /* @__PURE__ */ new Map();
1075
+ var doneWithProcessEvents = /* @__PURE__ */ new Map();
1076
+ var createdSyntheticEvents = /* @__PURE__ */ new Map();
1077
+ var utilityThreads = /* @__PURE__ */ new Map();
1078
+ var v8HelperThreads = /* @__PURE__ */ new Map();
1079
+ function reset2() {
1080
+ runningInProcessEvents.clear();
1081
+ doneWithProcessEvents.clear();
1082
+ createdSyntheticEvents.clear();
1083
+ utilityThreads.clear();
1084
+ v8HelperThreads.clear();
1085
+ }
1086
+ function handleEvent2(event) {
1087
+ if (TraceEvents_exports.isTraceEventAuctionWorkletRunningInProcess(event)) {
1088
+ runningInProcessEvents.set(event.args.data.pid, event);
1089
+ return;
1090
+ }
1091
+ if (TraceEvents_exports.isTraceEventAuctionWorkletDoneWithProcess(event)) {
1092
+ doneWithProcessEvents.set(event.args.data.pid, event);
1093
+ return;
1094
+ }
1095
+ if (TraceEvents_exports.isThreadName(event)) {
1096
+ if (event.args.name === "auction_worklet.CrUtilityMain") {
1097
+ utilityThreads.set(event.pid, event);
1098
+ return;
1099
+ }
1100
+ if (event.args.name === "AuctionV8HelperThread") {
1101
+ v8HelperThreads.set(event.pid, event);
1102
+ }
1103
+ }
1104
+ }
1105
+ function workletType(input) {
1106
+ switch (input) {
1107
+ case "seller":
1108
+ return TraceEvents_exports.AuctionWorkletType.SELLER;
1109
+ case "bidder":
1110
+ return TraceEvents_exports.AuctionWorkletType.BIDDER;
1111
+ default:
1112
+ return TraceEvents_exports.AuctionWorkletType.UNKNOWN;
1113
+ }
1114
+ }
1115
+ function makeSyntheticEventBase(event) {
1116
+ return {
1117
+ name: "SyntheticAuctionWorkletEvent",
1118
+ s: TraceEvents_exports.TraceEventScope.THREAD,
1119
+ cat: event.cat,
1120
+ tid: event.tid,
1121
+ ts: event.ts,
1122
+ ph: TraceEvents_exports.Phase.INSTANT,
1123
+ pid: event.args.data.pid,
1124
+ host: event.args.data.host,
1125
+ target: event.args.data.target,
1126
+ type: workletType(event.args.data.type)
1127
+ };
1128
+ }
1129
+ async function finalize2() {
1130
+ for (const [pid, utilityThreadNameEvent] of utilityThreads) {
1131
+ const v8HelperEvent = v8HelperThreads.get(pid);
1132
+ if (!v8HelperEvent) {
1133
+ continue;
1134
+ }
1135
+ const runningEvent = runningInProcessEvents.get(pid);
1136
+ const doneWithEvent = doneWithProcessEvents.get(pid);
1137
+ let syntheticEvent = null;
1138
+ if (runningEvent) {
1139
+ syntheticEvent = {
1140
+ ...makeSyntheticEventBase(runningEvent),
1141
+ args: {
1142
+ data: {
1143
+ runningInProcessEvent: runningEvent,
1144
+ utilityThread: utilityThreadNameEvent,
1145
+ v8HelperThread: v8HelperEvent
1146
+ }
1147
+ }
1148
+ };
1149
+ if (doneWithEvent) {
1150
+ syntheticEvent.args.data.doneWithProcessEvent = doneWithEvent;
1151
+ }
1152
+ } else if (doneWithEvent) {
1153
+ syntheticEvent = {
1154
+ ...makeSyntheticEventBase(doneWithEvent),
1155
+ args: {
1156
+ data: {
1157
+ doneWithProcessEvent: doneWithEvent,
1158
+ utilityThread: utilityThreadNameEvent,
1159
+ v8HelperThread: v8HelperEvent
1160
+ }
1161
+ }
1162
+ };
1163
+ if (runningEvent) {
1164
+ syntheticEvent.args.data.runningInProcessEvent = runningEvent;
1165
+ }
1166
+ }
1167
+ if (syntheticEvent === null) {
1168
+ continue;
1169
+ }
1170
+ createdSyntheticEvents.set(pid, syntheticEvent);
1171
+ }
1172
+ }
1173
+ function data2() {
1174
+ return {
1175
+ worklets: new Map(createdSyntheticEvents)
1176
+ };
1177
+ }
1178
+
1062
1179
  // front_end/models/trace/handlers/GPUHandler.ts
1063
1180
  var GPUHandler_exports = {};
1064
1181
  __export(GPUHandler_exports, {
1065
- data: () => data3,
1182
+ data: () => data4,
1066
1183
  deps: () => deps,
1067
- finalize: () => finalize3,
1068
- handleEvent: () => handleEvent3,
1184
+ finalize: () => finalize4,
1185
+ handleEvent: () => handleEvent4,
1069
1186
  initialize: () => initialize2,
1070
- reset: () => reset3
1187
+ reset: () => reset4
1071
1188
  });
1072
1189
 
1073
1190
  // front_end/models/trace/handlers/MetaHandler.ts
1074
1191
  var MetaHandler_exports = {};
1075
1192
  __export(MetaHandler_exports, {
1076
- data: () => data2,
1077
- finalize: () => finalize2,
1078
- handleEvent: () => handleEvent2,
1193
+ data: () => data3,
1194
+ finalize: () => finalize3,
1195
+ handleEvent: () => handleEvent3,
1079
1196
  initialize: () => initialize,
1080
- reset: () => reset2
1197
+ reset: () => reset3
1081
1198
  });
1082
1199
  var rendererProcessesByFrameId = /* @__PURE__ */ new Map();
1083
1200
  var mainFrameId = "";
@@ -1106,7 +1223,7 @@ var eventPhasesOfInterestForTraceBounds = /* @__PURE__ */ new Set([
1106
1223
  TraceEvents_exports.Phase.INSTANT
1107
1224
  ]);
1108
1225
  var handlerState2 = 1 /* UNINITIALIZED */;
1109
- function reset2() {
1226
+ function reset3() {
1110
1227
  navigationsByFrameId.clear();
1111
1228
  navigationsByNavigationId.clear();
1112
1229
  mainFrameNavigations.length = 0;
@@ -1151,7 +1268,7 @@ function updateRendererProcessByFrame(event, frame) {
1151
1268
  }
1152
1269
  });
1153
1270
  }
1154
- function handleEvent2(event) {
1271
+ function handleEvent3(event) {
1155
1272
  if (handlerState2 !== 2 /* INITIALIZED */) {
1156
1273
  throw new Error("Meta Handler is not initialized");
1157
1274
  }
@@ -1241,7 +1358,7 @@ function handleEvent2(event) {
1241
1358
  return;
1242
1359
  }
1243
1360
  }
1244
- async function finalize2() {
1361
+ async function finalize3() {
1245
1362
  if (handlerState2 !== 2 /* INITIALIZED */) {
1246
1363
  throw new Error("Handler is not initialized");
1247
1364
  }
@@ -1277,7 +1394,7 @@ async function finalize2() {
1277
1394
  }
1278
1395
  handlerState2 = 3 /* FINALIZED */;
1279
1396
  }
1280
- function data2() {
1397
+ function data3() {
1281
1398
  if (handlerState2 !== 3 /* FINALIZED */) {
1282
1399
  throw new Error("Meta Handler is not finalized");
1283
1400
  }
@@ -1305,7 +1422,8 @@ var helpers_exports = {};
1305
1422
  __export(helpers_exports, {
1306
1423
  SamplesIntegrator: () => SamplesIntegrator_exports,
1307
1424
  Timing: () => Timing_exports3,
1308
- Trace: () => Trace_exports
1425
+ Trace: () => Trace_exports,
1426
+ TreeHelpers: () => TreeHelpers_exports
1309
1427
  });
1310
1428
 
1311
1429
  // front_end/models/trace/helpers/SamplesIntegrator.ts
@@ -1314,260 +1432,6 @@ __export(SamplesIntegrator_exports, {
1314
1432
  SamplesIntegrator: () => SamplesIntegrator
1315
1433
  });
1316
1434
 
1317
- // front_end/core/root/Runtime.ts
1318
- var Runtime_exports = {};
1319
- __export(Runtime_exports, {
1320
- ConditionName: () => ConditionName,
1321
- Experiment: () => Experiment,
1322
- ExperimentName: () => ExperimentName,
1323
- ExperimentsSupport: () => ExperimentsSupport,
1324
- Runtime: () => Runtime,
1325
- experiments: () => experiments,
1326
- getRemoteBase: () => getRemoteBase
1327
- });
1328
- var queryParamsObject = new URLSearchParams(location.search);
1329
- var runtimePlatform = "";
1330
- var runtimeInstance;
1331
- function getRemoteBase(location2 = self.location.toString()) {
1332
- const url = new URL(location2);
1333
- const remoteBase = url.searchParams.get("remoteBase");
1334
- if (!remoteBase) {
1335
- return null;
1336
- }
1337
- const version = /\/serve_file\/(@[0-9a-zA-Z]+)\/?$/.exec(remoteBase);
1338
- if (!version) {
1339
- return null;
1340
- }
1341
- return { base: `devtools://devtools/remote/serve_file/${version[1]}/`, version: version[1] };
1342
- }
1343
- var Runtime = class {
1344
- constructor() {
1345
- }
1346
- static instance(opts = { forceNew: null }) {
1347
- const { forceNew } = opts;
1348
- if (!runtimeInstance || forceNew) {
1349
- runtimeInstance = new Runtime();
1350
- }
1351
- return runtimeInstance;
1352
- }
1353
- static removeInstance() {
1354
- runtimeInstance = void 0;
1355
- }
1356
- static queryParam(name) {
1357
- return queryParamsObject.get(name);
1358
- }
1359
- static setQueryParamForTesting(name, value) {
1360
- queryParamsObject.set(name, value);
1361
- }
1362
- static experimentsSetting() {
1363
- try {
1364
- return JSON.parse(self.localStorage && self.localStorage["experiments"] ? self.localStorage["experiments"] : "{}");
1365
- } catch (e) {
1366
- console.error("Failed to parse localStorage['experiments']");
1367
- return {};
1368
- }
1369
- }
1370
- static setPlatform(platform) {
1371
- runtimePlatform = platform;
1372
- }
1373
- static platform() {
1374
- return runtimePlatform;
1375
- }
1376
- static isDescriptorEnabled(descriptor) {
1377
- const activatorExperiment = descriptor["experiment"];
1378
- if (activatorExperiment === "*") {
1379
- return true;
1380
- }
1381
- if (activatorExperiment && activatorExperiment.startsWith("!") && experiments.isEnabled(activatorExperiment.substring(1))) {
1382
- return false;
1383
- }
1384
- if (activatorExperiment && !activatorExperiment.startsWith("!") && !experiments.isEnabled(activatorExperiment)) {
1385
- return false;
1386
- }
1387
- const condition = descriptor["condition"];
1388
- if (condition && !condition.startsWith("!") && !Runtime.queryParam(condition)) {
1389
- return false;
1390
- }
1391
- if (condition && condition.startsWith("!") && Runtime.queryParam(condition.substring(1))) {
1392
- return false;
1393
- }
1394
- return true;
1395
- }
1396
- loadLegacyModule(modulePath) {
1397
- return import(`../../${modulePath}`);
1398
- }
1399
- };
1400
- var ExperimentsSupport = class {
1401
- #experiments;
1402
- #experimentNames;
1403
- #enabledTransiently;
1404
- #enabledByDefault;
1405
- #serverEnabled;
1406
- #nonConfigurable;
1407
- constructor() {
1408
- this.#experiments = [];
1409
- this.#experimentNames = /* @__PURE__ */ new Set();
1410
- this.#enabledTransiently = /* @__PURE__ */ new Set();
1411
- this.#enabledByDefault = /* @__PURE__ */ new Set();
1412
- this.#serverEnabled = /* @__PURE__ */ new Set();
1413
- this.#nonConfigurable = /* @__PURE__ */ new Set();
1414
- }
1415
- allConfigurableExperiments() {
1416
- const result = [];
1417
- for (const experiment of this.#experiments) {
1418
- if (!this.#enabledTransiently.has(experiment.name) && !this.#nonConfigurable.has(experiment.name)) {
1419
- result.push(experiment);
1420
- }
1421
- }
1422
- return result;
1423
- }
1424
- setExperimentsSetting(value) {
1425
- if (!self.localStorage) {
1426
- return;
1427
- }
1428
- self.localStorage["experiments"] = JSON.stringify(value);
1429
- }
1430
- register(experimentName, experimentTitle, unstable, docLink, feedbackLink) {
1431
- DCHECK(() => !this.#experimentNames.has(experimentName), "Duplicate registration of experiment " + experimentName);
1432
- this.#experimentNames.add(experimentName);
1433
- this.#experiments.push(new Experiment(this, experimentName, experimentTitle, Boolean(unstable), docLink ?? DevToolsPath_exports.EmptyUrlString, feedbackLink ?? DevToolsPath_exports.EmptyUrlString));
1434
- }
1435
- isEnabled(experimentName) {
1436
- this.checkExperiment(experimentName);
1437
- if (Runtime.experimentsSetting()[experimentName] === false) {
1438
- return false;
1439
- }
1440
- if (this.#enabledTransiently.has(experimentName) || this.#enabledByDefault.has(experimentName)) {
1441
- return true;
1442
- }
1443
- if (this.#serverEnabled.has(experimentName)) {
1444
- return true;
1445
- }
1446
- return Boolean(Runtime.experimentsSetting()[experimentName]);
1447
- }
1448
- setEnabled(experimentName, enabled) {
1449
- this.checkExperiment(experimentName);
1450
- const experimentsSetting = Runtime.experimentsSetting();
1451
- experimentsSetting[experimentName] = enabled;
1452
- this.setExperimentsSetting(experimentsSetting);
1453
- }
1454
- enableExperimentsTransiently(experimentNames) {
1455
- for (const experimentName of experimentNames) {
1456
- this.checkExperiment(experimentName);
1457
- this.#enabledTransiently.add(experimentName);
1458
- }
1459
- }
1460
- enableExperimentsByDefault(experimentNames) {
1461
- for (const experimentName of experimentNames) {
1462
- this.checkExperiment(experimentName);
1463
- this.#enabledByDefault.add(experimentName);
1464
- }
1465
- }
1466
- setServerEnabledExperiments(experimentNames) {
1467
- for (const experiment of experimentNames) {
1468
- this.checkExperiment(experiment);
1469
- this.#serverEnabled.add(experiment);
1470
- }
1471
- }
1472
- setNonConfigurableExperiments(experimentNames) {
1473
- for (const experiment of experimentNames) {
1474
- this.checkExperiment(experiment);
1475
- this.#nonConfigurable.add(experiment);
1476
- }
1477
- }
1478
- enableForTest(experimentName) {
1479
- this.checkExperiment(experimentName);
1480
- this.#enabledTransiently.add(experimentName);
1481
- }
1482
- disableForTest(experimentName) {
1483
- this.checkExperiment(experimentName);
1484
- this.#enabledTransiently.delete(experimentName);
1485
- }
1486
- clearForTest() {
1487
- this.#experiments = [];
1488
- this.#experimentNames.clear();
1489
- this.#enabledTransiently.clear();
1490
- this.#enabledByDefault.clear();
1491
- this.#serverEnabled.clear();
1492
- }
1493
- cleanUpStaleExperiments() {
1494
- const experimentsSetting = Runtime.experimentsSetting();
1495
- const cleanedUpExperimentSetting = {};
1496
- for (const { name: experimentName } of this.#experiments) {
1497
- if (experimentsSetting.hasOwnProperty(experimentName)) {
1498
- const isEnabled = experimentsSetting[experimentName];
1499
- if (isEnabled || this.#enabledByDefault.has(experimentName)) {
1500
- cleanedUpExperimentSetting[experimentName] = isEnabled;
1501
- }
1502
- }
1503
- }
1504
- this.setExperimentsSetting(cleanedUpExperimentSetting);
1505
- }
1506
- checkExperiment(experimentName) {
1507
- DCHECK(() => this.#experimentNames.has(experimentName), "Unknown experiment " + experimentName);
1508
- }
1509
- };
1510
- var Experiment = class {
1511
- name;
1512
- title;
1513
- unstable;
1514
- docLink;
1515
- feedbackLink;
1516
- #experiments;
1517
- constructor(experiments2, name, title, unstable, docLink, feedbackLink) {
1518
- this.name = name;
1519
- this.title = title;
1520
- this.unstable = unstable;
1521
- this.docLink = docLink;
1522
- this.feedbackLink = feedbackLink;
1523
- this.#experiments = experiments2;
1524
- }
1525
- isEnabled() {
1526
- return this.#experiments.isEnabled(this.name);
1527
- }
1528
- setEnabled(enabled) {
1529
- this.#experiments.setEnabled(this.name, enabled);
1530
- }
1531
- };
1532
- var experiments = new ExperimentsSupport();
1533
- var ExperimentName = /* @__PURE__ */ ((ExperimentName2) => {
1534
- ExperimentName2["CAPTURE_NODE_CREATION_STACKS"] = "captureNodeCreationStacks";
1535
- ExperimentName2["CSS_OVERVIEW"] = "cssOverview";
1536
- ExperimentName2["LIVE_HEAP_PROFILE"] = "liveHeapProfile";
1537
- ExperimentName2["DEVELOPER_RESOURCES_VIEW"] = "developerResourcesView";
1538
- ExperimentName2["CSP_VIOLATIONS_VIEW"] = "cspViolationsView";
1539
- ExperimentName2["WASM_DWARF_DEBUGGING"] = "wasmDWARFDebugging";
1540
- ExperimentName2["ALL"] = "*";
1541
- ExperimentName2["PROTOCOL_MONITOR"] = "protocolMonitor";
1542
- ExperimentName2["WEBAUTHN_PANE"] = "webauthnPane";
1543
- ExperimentName2["FULL_ACCESSIBILITY_TREE"] = "fullAccessibilityTree";
1544
- ExperimentName2["PRECISE_CHANGES"] = "preciseChanges";
1545
- ExperimentName2["STYLES_PANE_CSS_CHANGES"] = "stylesPaneCSSChanges";
1546
- ExperimentName2["HEADER_OVERRIDES"] = "headerOverrides";
1547
- ExperimentName2["EYEDROPPER_COLOR_PICKER"] = "eyedropperColorPicker";
1548
- ExperimentName2["INSTRUMENTATION_BREAKPOINTS"] = "instrumentationBreakpoints";
1549
- ExperimentName2["AUTHORED_DEPLOYED_GROUPING"] = "authoredDeployedGrouping";
1550
- ExperimentName2["IMPORTANT_DOM_PROPERTIES"] = "importantDOMProperties";
1551
- ExperimentName2["JUST_MY_CODE"] = "justMyCode";
1552
- ExperimentName2["PRELOADING_STATUS_PANEL"] = "preloadingStatusPanel";
1553
- ExperimentName2["DISABLE_COLOR_FORMAT_SETTING"] = "disableColorFormatSetting";
1554
- ExperimentName2["TIMELINE_AS_CONSOLE_PROFILE_RESULT_PANEL"] = "timelineAsConsoleProfileResultPanel";
1555
- ExperimentName2["OUTERMOST_TARGET_SELECTOR"] = "outermostTargetSelector";
1556
- ExperimentName2["JS_PROFILER_TEMP_ENABLE"] = "jsProfilerTemporarilyEnable";
1557
- ExperimentName2["HIGHLIGHT_ERRORS_ELEMENTS_PANEL"] = "highlightErrorsElementsPanel";
1558
- ExperimentName2["SET_ALL_BREAKPOINTS_EAGERLY"] = "setAllBreakpointsEagerly";
1559
- ExperimentName2["SELF_XSS_WARNING"] = "selfXssWarning";
1560
- ExperimentName2["USE_SOURCE_MAP_SCOPES"] = "useSourceMapScopes";
1561
- ExperimentName2["STORAGE_BUCKETS_TREE"] = "storageBucketsTree";
1562
- ExperimentName2["DELETE_OVERRIDES_TEMP_ENABLE"] = "deleteOverridesTemporarilyEnable";
1563
- return ExperimentName2;
1564
- })(ExperimentName || {});
1565
- var ConditionName = /* @__PURE__ */ ((ConditionName2) => {
1566
- ConditionName2["CAN_DOCK"] = "can_dock";
1567
- ConditionName2["NOT_SOURCES_HIDE_ADD_FOLDER"] = "!sources.hide_add_folder";
1568
- return ConditionName2;
1569
- })(ConditionName || {});
1570
-
1571
1435
  // front_end/models/trace/helpers/Timing.ts
1572
1436
  var Timing_exports3 = {};
1573
1437
  __export(Timing_exports3, {
@@ -1582,7 +1446,9 @@ __export(Timing_exports3, {
1582
1446
  secondsToMicroseconds: () => secondsToMicroseconds,
1583
1447
  secondsToMilliseconds: () => secondsToMilliseconds,
1584
1448
  timeStampForEventAdjustedByClosestNavigation: () => timeStampForEventAdjustedByClosestNavigation,
1585
- traceBoundsMilliseconds: () => traceBoundsMilliseconds
1449
+ traceWindowFromMilliSeconds: () => traceWindowFromMilliSeconds,
1450
+ traceWindowMilliSeconds: () => traceWindowMilliSeconds,
1451
+ traceWindowMillisecondsToMicroSeconds: () => traceWindowMillisecondsToMicroSeconds
1586
1452
  });
1587
1453
 
1588
1454
  // front_end/models/trace/helpers/Trace.ts
@@ -1593,6 +1459,7 @@ __export(Trace_exports, {
1593
1459
  extractId: () => extractId,
1594
1460
  extractOriginFromTrace: () => extractOriginFromTrace,
1595
1461
  getNavigationForTraceEvent: () => getNavigationForTraceEvent,
1462
+ makeProfileCall: () => makeProfileCall,
1596
1463
  mergeEventsInOrder: () => mergeEventsInOrder,
1597
1464
  sortTraceEventsInPlace: () => sortTraceEventsInPlace
1598
1465
  });
@@ -1698,6 +1565,21 @@ function activeURLForFrameAtTime(frameId, time, rendererProcessesByFrame) {
1698
1565
  }
1699
1566
  return null;
1700
1567
  }
1568
+ function makeProfileCall(node, ts, pid, tid) {
1569
+ return {
1570
+ cat: "",
1571
+ name: "ProfileCall",
1572
+ nodeId: node.id,
1573
+ args: {},
1574
+ ph: TraceEvents_exports.Phase.COMPLETE,
1575
+ pid,
1576
+ tid,
1577
+ ts,
1578
+ dur: Timing_exports2.MicroSeconds(0),
1579
+ selfTime: Timing_exports2.MicroSeconds(0),
1580
+ callFrame: node.callFrame
1581
+ };
1582
+ }
1701
1583
 
1702
1584
  // front_end/models/trace/helpers/Timing.ts
1703
1585
  var millisecondsToMicroseconds = (value) => Timing_exports2.MicroSeconds(value * 1e3);
@@ -1726,7 +1608,7 @@ var defaultFormatOptions = {
1726
1608
  };
1727
1609
  var serialize = (value) => JSON.stringify(value);
1728
1610
  var formatterFactory = (key) => {
1729
- return new Intl.NumberFormat(navigator.language, key ? JSON.parse(key) : {});
1611
+ return new Intl.NumberFormat(void 0, key ? JSON.parse(key) : {});
1730
1612
  };
1731
1613
  var formatters = /* @__PURE__ */ new Map();
1732
1614
  map_utilities_exports.getWithDefault(formatters, serialize({ style: "decimal" }), formatterFactory);
@@ -1786,7 +1668,7 @@ function eventTimingsMicroSeconds(event) {
1786
1668
  startTime: event.ts,
1787
1669
  endTime: Timing_exports2.MicroSeconds(event.ts + (event.dur || Timing_exports2.MicroSeconds(0))),
1788
1670
  duration: Timing_exports2.MicroSeconds(event.dur || 0),
1789
- selfTime: Timing_exports2.MicroSeconds(event.dur || 0)
1671
+ selfTime: TraceEvents_exports.isRendererEvent(event) ? Timing_exports2.MicroSeconds(event.selfTime || 0) : Timing_exports2.MicroSeconds(event.dur || 0)
1790
1672
  };
1791
1673
  }
1792
1674
  function eventTimingsMilliSeconds(event) {
@@ -1807,13 +1689,28 @@ function eventTimingsSeconds(event) {
1807
1689
  selfTime: microSecondsToSeconds(microTimes.selfTime)
1808
1690
  };
1809
1691
  }
1810
- function traceBoundsMilliseconds(bounds) {
1692
+ function traceWindowMilliSeconds(bounds) {
1811
1693
  return {
1812
1694
  min: microSecondsToMilliseconds(bounds.min),
1813
1695
  max: microSecondsToMilliseconds(bounds.max),
1814
1696
  range: microSecondsToMilliseconds(bounds.range)
1815
1697
  };
1816
1698
  }
1699
+ function traceWindowMillisecondsToMicroSeconds(bounds) {
1700
+ return {
1701
+ min: millisecondsToMicroseconds(bounds.min),
1702
+ max: millisecondsToMicroseconds(bounds.max),
1703
+ range: millisecondsToMicroseconds(bounds.range)
1704
+ };
1705
+ }
1706
+ function traceWindowFromMilliSeconds(min, max) {
1707
+ const traceWindow = {
1708
+ min: millisecondsToMicroseconds(min),
1709
+ max: millisecondsToMicroseconds(max),
1710
+ range: millisecondsToMicroseconds(Timing_exports2.MilliSeconds(max - min))
1711
+ };
1712
+ return traceWindow;
1713
+ }
1817
1714
 
1818
1715
  // front_end/models/trace/helpers/SamplesIntegrator.ts
1819
1716
  var SamplesIntegrator = class {
@@ -1825,20 +1722,21 @@ var SamplesIntegrator = class {
1825
1722
  #fakeJSInvocation = false;
1826
1723
  #profileModel;
1827
1724
  #nodeForGC = /* @__PURE__ */ new Map();
1828
- #showNativeFunctionsInJSProfile;
1829
- constructor(profileModel, pid, tid, settings = {
1830
- showNativeFunctionsInJSProfile: Configuration_exports.DEFAULT.settings.showNativeFunctionsInJSProfile
1831
- }) {
1725
+ #engineConfig;
1726
+ constructor(profileModel, pid, tid, configuration) {
1832
1727
  this.#profileModel = profileModel;
1833
1728
  this.#threadId = tid;
1834
1729
  this.#processId = pid;
1835
- this.#showNativeFunctionsInJSProfile = settings.showNativeFunctionsInJSProfile;
1730
+ this.#engineConfig = configuration || Configuration_exports.DEFAULT;
1836
1731
  }
1837
1732
  buildProfileCalls(traceEvents) {
1838
1733
  const mergedEvents = mergeEventsInOrder(traceEvents, this.callsFromProfileSamples());
1839
1734
  const stack = [];
1840
1735
  for (let i = 0; i < mergedEvents.length; i++) {
1841
1736
  const event = mergedEvents[i];
1737
+ if (event.ph === TraceEvents_exports.Phase.INSTANT) {
1738
+ continue;
1739
+ }
1842
1740
  if (stack.length === 0) {
1843
1741
  if (TraceEvents_exports.isProfileCall(event)) {
1844
1742
  this.#onProfileCall(event);
@@ -1879,9 +1777,6 @@ var SamplesIntegrator = class {
1879
1777
  return this.#constructedProfileCalls;
1880
1778
  }
1881
1779
  #onTraceEventStart(event) {
1882
- if (event.ph === TraceEvents_exports.Phase.INSTANT) {
1883
- return;
1884
- }
1885
1780
  if (event.name === TraceEvents_exports.KnownEventName.RunMicrotasks || event.name === TraceEvents_exports.KnownEventName.RunTask) {
1886
1781
  this.#lockedJsStackDepth = [];
1887
1782
  this.#truncateJSStack(0, event.ts);
@@ -1922,7 +1817,7 @@ var SamplesIntegrator = class {
1922
1817
  if (!node) {
1923
1818
  continue;
1924
1819
  }
1925
- const call = SamplesIntegrator.makeProfileCall(node, timestamp, this.#processId, this.#threadId);
1820
+ const call = makeProfileCall(node, timestamp, this.#processId, this.#threadId);
1926
1821
  calls.push(call);
1927
1822
  if (node.id === this.#profileModel.gcNode?.id && prevNode) {
1928
1823
  this.#nodeForGC.set(call, prevNode);
@@ -1947,16 +1842,14 @@ var SamplesIntegrator = class {
1947
1842
  callFrames[i--] = profileCall;
1948
1843
  }
1949
1844
  while (node) {
1950
- callFrames[i--] = SamplesIntegrator.makeProfileCall(node, profileCall.ts, this.#processId, this.#threadId);
1845
+ callFrames[i--] = makeProfileCall(node, profileCall.ts, this.#processId, this.#threadId);
1951
1846
  node = node.parent;
1952
1847
  }
1953
1848
  return callFrames;
1954
1849
  }
1955
1850
  #extractStackTrace(event) {
1956
1851
  const stackTrace = TraceEvents_exports.isProfileCall(event) ? this.#getStackTraceFromProfileCall(event) : this.#currentJSStack;
1957
- SamplesIntegrator.filterStackFrames(stackTrace, {
1958
- showNativeFunctionsInJSProfile: this.#showNativeFunctionsInJSProfile
1959
- });
1852
+ SamplesIntegrator.filterStackFrames(stackTrace, this.#engineConfig);
1960
1853
  const endTime = event.ts + (event.dur || 0);
1961
1854
  const minFrames = Math.min(stackTrace.length, this.#currentJSStack.length);
1962
1855
  let i;
@@ -1971,10 +1864,10 @@ var SamplesIntegrator = class {
1971
1864
  this.#truncateJSStack(i, event.ts);
1972
1865
  for (; i < stackTrace.length; ++i) {
1973
1866
  const call = stackTrace[i];
1974
- this.#currentJSStack.push(call);
1975
- if (call.nodeId === this.#profileModel.programNode?.id || call.nodeId === this.#profileModel.root?.id || call.nodeId === this.#profileModel.idleNode?.id) {
1867
+ if (call.nodeId === this.#profileModel.programNode?.id || call.nodeId === this.#profileModel.root?.id || call.nodeId === this.#profileModel.idleNode?.id || call.nodeId === this.#profileModel.gcNode?.id) {
1976
1868
  continue;
1977
1869
  }
1870
+ this.#currentJSStack.push(call);
1978
1871
  this.#constructedProfileCalls.push(call);
1979
1872
  }
1980
1873
  }
@@ -2013,14 +1906,8 @@ var SamplesIntegrator = class {
2013
1906
  static framesAreEqual(frame1, frame2) {
2014
1907
  return frame1.scriptId === frame2.scriptId && frame1.functionName === frame2.functionName && frame1.lineNumber === frame2.lineNumber;
2015
1908
  }
2016
- static showNativeName(name) {
2017
- return false;
2018
- try {
2019
- const showRuntimeCallStats = Runtime_exports.experiments.isEnabled("timelineV8RuntimeCallStats");
2020
- return showRuntimeCallStats && Boolean(SamplesIntegrator.nativeGroup(name));
2021
- } catch (error) {
2022
- return false;
2023
- }
1909
+ static showNativeName(name, runtimeCallStatsEnabled) {
1910
+ return runtimeCallStatsEnabled && Boolean(SamplesIntegrator.nativeGroup(name));
2024
1911
  }
2025
1912
  static nativeGroup(nativeName) {
2026
1913
  if (nativeName.startsWith("Parse")) {
@@ -2034,8 +1921,8 @@ var SamplesIntegrator = class {
2034
1921
  static isNativeRuntimeFrame(frame) {
2035
1922
  return frame.url === "native V8Runtime";
2036
1923
  }
2037
- static filterStackFrames(stack, settings) {
2038
- let showAllEvents = false;
1924
+ static filterStackFrames(stack, engineConfig) {
1925
+ const showAllEvents = engineConfig.experiments.timelineShowAllEvents;
2039
1926
  if (showAllEvents) {
2040
1927
  return;
2041
1928
  }
@@ -2043,13 +1930,8 @@ var SamplesIntegrator = class {
2043
1930
  let j = 0;
2044
1931
  for (let i = 0; i < stack.length; ++i) {
2045
1932
  const frame = stack[i].callFrame;
2046
- const url = frame.url;
2047
- const isNativeFrame = url && url.startsWith("native ");
2048
- if (!settings.showNativeFunctionsInJSProfile && isNativeFrame) {
2049
- continue;
2050
- }
2051
1933
  const nativeRuntimeFrame = SamplesIntegrator.isNativeRuntimeFrame(frame);
2052
- if (nativeRuntimeFrame && !SamplesIntegrator.showNativeName(frame.functionName)) {
1934
+ if (nativeRuntimeFrame && !SamplesIntegrator.showNativeName(frame.functionName, engineConfig.experiments.timelineV8RuntimeCallStats)) {
2053
1935
  continue;
2054
1936
  }
2055
1937
  const nativeFrameName = nativeRuntimeFrame ? SamplesIntegrator.nativeGroup(frame.functionName) : null;
@@ -2061,27 +1943,121 @@ var SamplesIntegrator = class {
2061
1943
  }
2062
1944
  stack.length = j;
2063
1945
  }
2064
- static makeProfileCall(node, ts, pid, tid) {
2065
- return {
2066
- cat: "",
2067
- name: "ProfileCall",
2068
- nodeId: node.id,
2069
- ph: TraceEvents_exports.Phase.COMPLETE,
2070
- pid,
2071
- tid,
2072
- ts,
2073
- dur: Timing_exports2.MicroSeconds(0),
2074
- selfTime: Timing_exports2.MicroSeconds(0),
2075
- callFrame: node.callFrame
2076
- };
2077
- }
2078
1946
  };
2079
1947
 
1948
+ // front_end/models/trace/helpers/TreeHelpers.ts
1949
+ var TreeHelpers_exports = {};
1950
+ __export(TreeHelpers_exports, {
1951
+ makeEmptyTraceEntryNode: () => makeEmptyTraceEntryNode,
1952
+ makeEmptyTraceEntryTree: () => makeEmptyTraceEntryTree,
1953
+ makeTraceEntryNodeId: () => makeTraceEntryNodeId,
1954
+ treify: () => treify,
1955
+ walkEntireTree: () => walkEntireTree,
1956
+ walkTreeFromEntry: () => walkTreeFromEntry
1957
+ });
1958
+ var nodeIdCount = 0;
1959
+ var makeTraceEntryNodeId = () => ++nodeIdCount;
1960
+ var makeEmptyTraceEntryTree = () => ({
1961
+ nodes: /* @__PURE__ */ new Map(),
1962
+ roots: /* @__PURE__ */ new Set(),
1963
+ maxDepth: 0
1964
+ });
1965
+ var makeEmptyTraceEntryNode = (entry, id) => ({
1966
+ entry,
1967
+ id,
1968
+ parentId: null,
1969
+ children: /* @__PURE__ */ new Set(),
1970
+ depth: 0
1971
+ });
1972
+ var TraceEntryNodeIdTag = class {
1973
+ #tag;
1974
+ };
1975
+ function treify(entries, options) {
1976
+ const entryToNode3 = /* @__PURE__ */ new Map();
1977
+ const stack = [];
1978
+ nodeIdCount = -1;
1979
+ const tree = makeEmptyTraceEntryTree();
1980
+ for (let i = 0; i < entries.length; i++) {
1981
+ const event = entries[i];
1982
+ if (options && !options.filter.has(event.name)) {
1983
+ continue;
1984
+ }
1985
+ const duration = event.dur || 0;
1986
+ const nodeId = makeTraceEntryNodeId();
1987
+ const node = makeEmptyTraceEntryNode(event, nodeId);
1988
+ if (stack.length === 0) {
1989
+ tree.nodes.set(nodeId, node);
1990
+ tree.roots.add(node);
1991
+ event.selfTime = Timing_exports2.MicroSeconds(duration);
1992
+ stack.push(node);
1993
+ tree.maxDepth = Math.max(tree.maxDepth, stack.length);
1994
+ entryToNode3.set(event, node);
1995
+ continue;
1996
+ }
1997
+ const parentNode = stack.at(-1);
1998
+ if (parentNode === void 0) {
1999
+ throw new Error("Impossible: no parent node found in the stack");
2000
+ }
2001
+ const parentEvent = parentNode.entry;
2002
+ const begin = event.ts;
2003
+ const parentBegin = parentEvent.ts;
2004
+ const parentDuration = parentEvent.dur || 0;
2005
+ const end = begin + duration;
2006
+ const parentEnd = parentBegin + parentDuration;
2007
+ const startsBeforeParent = begin < parentBegin;
2008
+ if (startsBeforeParent) {
2009
+ throw new Error("Impossible: current event starts before the parent event");
2010
+ }
2011
+ const startsAfterParent = begin >= parentEnd;
2012
+ if (startsAfterParent) {
2013
+ stack.pop();
2014
+ i--;
2015
+ nodeIdCount--;
2016
+ continue;
2017
+ }
2018
+ const endsAfterParent = end > parentEnd;
2019
+ if (endsAfterParent) {
2020
+ continue;
2021
+ }
2022
+ tree.nodes.set(nodeId, node);
2023
+ node.depth = stack.length;
2024
+ node.parentId = parentNode.id;
2025
+ parentNode.children.add(node);
2026
+ event.selfTime = Timing_exports2.MicroSeconds(duration);
2027
+ if (parentEvent.selfTime !== void 0) {
2028
+ parentEvent.selfTime = Timing_exports2.MicroSeconds(parentEvent.selfTime - (event.dur || 0));
2029
+ }
2030
+ stack.push(node);
2031
+ tree.maxDepth = Math.max(tree.maxDepth, stack.length);
2032
+ entryToNode3.set(event, node);
2033
+ }
2034
+ return { tree, entryToNode: entryToNode3 };
2035
+ }
2036
+ function walkTreeFromEntry(entryToNode3, rootEntry, onEntryStart, onEntryEnd) {
2037
+ const startNode = entryToNode3.get(rootEntry);
2038
+ if (!startNode) {
2039
+ return;
2040
+ }
2041
+ walkTreeByNode(entryToNode3, startNode, onEntryStart, onEntryEnd);
2042
+ }
2043
+ function walkEntireTree(entryToNode3, tree, onEntryStart, onEntryEnd) {
2044
+ for (const rootNode of tree.roots) {
2045
+ walkTreeByNode(entryToNode3, rootNode, onEntryStart, onEntryEnd);
2046
+ }
2047
+ }
2048
+ function walkTreeByNode(entryToNode3, rootNode, onEntryStart, onEntryEnd) {
2049
+ onEntryStart(rootNode.entry);
2050
+ for (const child of rootNode.children) {
2051
+ walkTreeByNode(entryToNode3, child, onEntryStart, onEntryEnd);
2052
+ }
2053
+ onEntryEnd(rootNode.entry);
2054
+ }
2055
+
2080
2056
  // front_end/models/trace/handlers/GPUHandler.ts
2081
2057
  var handlerState3 = 1 /* UNINITIALIZED */;
2082
2058
  var eventsInProcessThread = /* @__PURE__ */ new Map();
2083
2059
  var mainGPUThreadTasks = [];
2084
- function reset3() {
2060
+ function reset4() {
2085
2061
  eventsInProcessThread.clear();
2086
2062
  mainGPUThreadTasks = [];
2087
2063
  handlerState3 = 1 /* UNINITIALIZED */;
@@ -2092,7 +2068,7 @@ function initialize2() {
2092
2068
  }
2093
2069
  handlerState3 = 2 /* INITIALIZED */;
2094
2070
  }
2095
- function handleEvent3(event) {
2071
+ function handleEvent4(event) {
2096
2072
  if (handlerState3 !== 2 /* INITIALIZED */) {
2097
2073
  throw new Error("GPU Handler is not initialized");
2098
2074
  }
@@ -2101,18 +2077,18 @@ function handleEvent3(event) {
2101
2077
  }
2102
2078
  Trace_exports.addEventToProcessThread(event, eventsInProcessThread);
2103
2079
  }
2104
- async function finalize3() {
2080
+ async function finalize4() {
2105
2081
  if (handlerState3 !== 2 /* INITIALIZED */) {
2106
2082
  throw new Error("GPU Handler is not initialized");
2107
2083
  }
2108
- const { gpuProcessId: gpuProcessId2, gpuThreadId: gpuThreadId2 } = data2();
2084
+ const { gpuProcessId: gpuProcessId2, gpuThreadId: gpuThreadId2 } = data3();
2109
2085
  const gpuThreadsForProcess = eventsInProcessThread.get(gpuProcessId2);
2110
2086
  if (gpuThreadsForProcess && gpuThreadId2) {
2111
2087
  mainGPUThreadTasks = gpuThreadsForProcess.get(gpuThreadId2) || [];
2112
2088
  }
2113
2089
  handlerState3 = 3 /* FINALIZED */;
2114
2090
  }
2115
- function data3() {
2091
+ function data4() {
2116
2092
  if (handlerState3 !== 3 /* FINALIZED */) {
2117
2093
  throw new Error("GPU Handler is not finalized");
2118
2094
  }
@@ -2130,13 +2106,13 @@ __export(LayoutShiftsHandler_exports, {
2130
2106
  LayoutShiftsThreshold: () => LayoutShiftsThreshold,
2131
2107
  MAX_CLUSTER_DURATION: () => MAX_CLUSTER_DURATION,
2132
2108
  MAX_SHIFT_TIME_DELTA: () => MAX_SHIFT_TIME_DELTA,
2133
- data: () => data6,
2109
+ data: () => data7,
2134
2110
  deps: () => deps4,
2135
- finalize: () => finalize6,
2111
+ finalize: () => finalize7,
2136
2112
  findNextScreenshotEventIndex: () => findNextScreenshotEventIndex,
2137
- handleEvent: () => handleEvent6,
2113
+ handleEvent: () => handleEvent7,
2138
2114
  initialize: () => initialize3,
2139
- reset: () => reset6,
2115
+ reset: () => reset7,
2140
2116
  stateForLayoutShiftScore: () => stateForLayoutShiftScore
2141
2117
  });
2142
2118
 
@@ -2146,14 +2122,14 @@ __export(PageLoadMetricsHandler_exports, {
2146
2122
  MarkerName: () => MarkerName,
2147
2123
  MetricName: () => MetricName,
2148
2124
  ScoreClassification: () => ScoreClassification,
2149
- data: () => data4,
2125
+ data: () => data5,
2150
2126
  deps: () => deps2,
2151
2127
  eventIsPageLoadEvent: () => eventIsPageLoadEvent,
2152
- finalize: () => finalize4,
2128
+ finalize: () => finalize5,
2153
2129
  getFrameIdForPageLoadEvent: () => getFrameIdForPageLoadEvent,
2154
- handleEvent: () => handleEvent4,
2130
+ handleEvent: () => handleEvent5,
2155
2131
  isTraceEventMarkerEvent: () => isTraceEventMarkerEvent,
2156
- reset: () => reset4,
2132
+ reset: () => reset5,
2157
2133
  scoreClassificationForDOMContentLoaded: () => scoreClassificationForDOMContentLoaded,
2158
2134
  scoreClassificationForFirstContentfulPaint: () => scoreClassificationForFirstContentfulPaint,
2159
2135
  scoreClassificationForLargestContentfulPaint: () => scoreClassificationForLargestContentfulPaint,
@@ -2162,7 +2138,7 @@ __export(PageLoadMetricsHandler_exports, {
2162
2138
  });
2163
2139
  var metricScoresByFrameId = /* @__PURE__ */ new Map();
2164
2140
  var allMarkerEvents = [];
2165
- function reset4() {
2141
+ function reset5() {
2166
2142
  metricScoresByFrameId.clear();
2167
2143
  pageLoadEventsArray = [];
2168
2144
  allMarkerEvents = [];
@@ -2189,7 +2165,7 @@ var pageLoadEventTypeGuards = [
2189
2165
  function eventIsPageLoadEvent(event) {
2190
2166
  return pageLoadEventTypeGuards.some((fn) => fn(event));
2191
2167
  }
2192
- function handleEvent4(event) {
2168
+ function handleEvent5(event) {
2193
2169
  if (!eventIsPageLoadEvent(event)) {
2194
2170
  return;
2195
2171
  }
@@ -2201,7 +2177,7 @@ function storePageLoadMetricAgainstNavigationId(navigation, event) {
2201
2177
  throw new Error("Navigation event unexpectedly had no navigation ID.");
2202
2178
  }
2203
2179
  const frameId = getFrameIdForPageLoadEvent(event);
2204
- const { rendererProcessesByFrame } = data2();
2180
+ const { rendererProcessesByFrame } = data3();
2205
2181
  const rendererProcessesInFrame = rendererProcessesByFrame.get(frameId);
2206
2182
  if (!rendererProcessesInFrame) {
2207
2183
  return;
@@ -2213,12 +2189,6 @@ function storePageLoadMetricAgainstNavigationId(navigation, event) {
2213
2189
  if (TraceEvents_exports.isTraceEventNavigationStart(event)) {
2214
2190
  return;
2215
2191
  }
2216
- const minTime = processData[0].window.min;
2217
- const maxTime = processData.at(-1)?.window.max || 0;
2218
- const eventBelongsToProcess = event.ts >= minTime && event.ts <= maxTime;
2219
- if (!eventBelongsToProcess) {
2220
- return;
2221
- }
2222
2192
  if (TraceEvents_exports.isTraceEventFirstContentfulPaint(event)) {
2223
2193
  const fcpTime = Timing_exports2.MicroSeconds(event.ts - navigation.ts);
2224
2194
  const score = Timing_exports3.formatMicrosecondsTime(fcpTime, {
@@ -2372,7 +2342,7 @@ function getNavigationForPageLoadEvent(event) {
2372
2342
  if (!navigationId) {
2373
2343
  throw new Error("Trace event unexpectedly had no navigation ID.");
2374
2344
  }
2375
- const { navigationsByNavigationId: navigationsByNavigationId2 } = data2();
2345
+ const { navigationsByNavigationId: navigationsByNavigationId2 } = data3();
2376
2346
  const navigation = navigationsByNavigationId2.get(navigationId);
2377
2347
  if (!navigation) {
2378
2348
  return null;
@@ -2381,7 +2351,7 @@ function getNavigationForPageLoadEvent(event) {
2381
2351
  }
2382
2352
  if (TraceEvents_exports.isTraceEventMarkDOMContent(event) || TraceEvents_exports.isTraceEventInteractiveTime(event) || TraceEvents_exports.isTraceEventLayoutShift(event) || TraceEvents_exports.isTraceEventMarkLoad(event)) {
2383
2353
  const frameId = getFrameIdForPageLoadEvent(event);
2384
- const { navigationsByFrameId: navigationsByFrameId2 } = data2();
2354
+ const { navigationsByFrameId: navigationsByFrameId2 } = data3();
2385
2355
  return Trace_exports.getNavigationForTraceEvent(event, frameId, navigationsByFrameId2);
2386
2356
  }
2387
2357
  if (TraceEvents_exports.isTraceEventNavigationStart(event)) {
@@ -2454,7 +2424,7 @@ function gatherFinalLCPEvents() {
2454
2424
  }
2455
2425
  return allFinalLCPEvents;
2456
2426
  }
2457
- async function finalize4() {
2427
+ async function finalize5() {
2458
2428
  pageLoadEventsArray.sort((a, b) => a.ts - b.ts);
2459
2429
  for (const pageLoadEvent of pageLoadEventsArray) {
2460
2430
  const navigation = getNavigationForPageLoadEvent(pageLoadEvent);
@@ -2463,12 +2433,12 @@ async function finalize4() {
2463
2433
  }
2464
2434
  }
2465
2435
  const allFinalLCPEvents = gatherFinalLCPEvents();
2466
- const mainFrame = data2().mainFrameId;
2436
+ const mainFrame = data3().mainFrameId;
2467
2437
  const allEventsButLCP = pageLoadEventsArray.filter((event) => !TraceEvents_exports.isTraceEventLargestContentfulPaintCandidate(event));
2468
2438
  const markerEvents = [...allFinalLCPEvents, ...allEventsButLCP].filter(isTraceEventMarkerEvent);
2469
2439
  allMarkerEvents = markerEvents.filter((event) => getFrameIdForPageLoadEvent(event) === mainFrame).sort((a, b) => a.ts - b.ts);
2470
2440
  }
2471
- function data4() {
2441
+ function data5() {
2472
2442
  return {
2473
2443
  metricScoresByFrameId: new Map(metricScoresByFrameId),
2474
2444
  allMarkerEvents: [...allMarkerEvents]
@@ -2499,32 +2469,32 @@ var MetricName = /* @__PURE__ */ ((MetricName2) => {
2499
2469
  // front_end/models/trace/handlers/ScreenshotsHandler.ts
2500
2470
  var ScreenshotsHandler_exports = {};
2501
2471
  __export(ScreenshotsHandler_exports, {
2502
- data: () => data5,
2472
+ data: () => data6,
2503
2473
  deps: () => deps3,
2504
- finalize: () => finalize5,
2505
- handleEvent: () => handleEvent5,
2506
- reset: () => reset5
2474
+ finalize: () => finalize6,
2475
+ handleEvent: () => handleEvent6,
2476
+ reset: () => reset6
2507
2477
  });
2508
2478
  var eventsInProcessThread2 = /* @__PURE__ */ new Map();
2509
2479
  var snapshots = [];
2510
- function reset5() {
2480
+ function reset6() {
2511
2481
  eventsInProcessThread2.clear();
2512
2482
  snapshots.length = 0;
2513
2483
  }
2514
- function handleEvent5(event) {
2515
- if (event.ph !== TraceEvents_exports.Phase.OBJECT_SNAPSHOT || event.name !== "Screenshot") {
2484
+ function handleEvent6(event) {
2485
+ if (event.name !== "Screenshot") {
2516
2486
  return;
2517
2487
  }
2518
2488
  Trace_exports.addEventToProcessThread(event, eventsInProcessThread2);
2519
2489
  }
2520
- async function finalize5() {
2521
- const { browserProcessId: browserProcessId2, browserThreadId: browserThreadId2 } = data2();
2490
+ async function finalize6() {
2491
+ const { browserProcessId: browserProcessId2, browserThreadId: browserThreadId2 } = data3();
2522
2492
  const browserThreads = eventsInProcessThread2.get(browserProcessId2);
2523
2493
  if (browserThreads) {
2524
2494
  snapshots = browserThreads.get(browserThreadId2) || [];
2525
2495
  }
2526
2496
  }
2527
- function data5() {
2497
+ function data6() {
2528
2498
  return [...snapshots];
2529
2499
  }
2530
2500
  function deps3() {
@@ -2549,7 +2519,7 @@ function initialize3() {
2549
2519
  }
2550
2520
  handlerState4 = 2 /* INITIALIZED */;
2551
2521
  }
2552
- function reset6() {
2522
+ function reset7() {
2553
2523
  handlerState4 = 1 /* UNINITIALIZED */;
2554
2524
  layoutShiftEvents.length = 0;
2555
2525
  layoutInvalidationEvents.length = 0;
@@ -2559,7 +2529,7 @@ function reset6() {
2559
2529
  scoreRecords.length = 0;
2560
2530
  clsWindowID = -1;
2561
2531
  }
2562
- function handleEvent6(event) {
2532
+ function handleEvent7(event) {
2563
2533
  if (handlerState4 !== 2 /* INITIALIZED */) {
2564
2534
  throw new Error("Handler is not initialized");
2565
2535
  }
@@ -2591,7 +2561,7 @@ function updateTraceWindowMax(traceWindow, newMax) {
2591
2561
  traceWindow.range = Timing_exports2.MicroSeconds(traceWindow.max - traceWindow.min);
2592
2562
  }
2593
2563
  function findNextScreenshotSource(timestamp) {
2594
- const screenshots = data5();
2564
+ const screenshots = data6();
2595
2565
  const screenshotIndex = findNextScreenshotEventIndex(screenshots, timestamp);
2596
2566
  if (!screenshotIndex) {
2597
2567
  return void 0;
@@ -2602,7 +2572,7 @@ function findNextScreenshotEventIndex(screenshots, timestamp) {
2602
2572
  return array_utilities_exports.nearestIndexFromBeginning(screenshots, (frame) => frame.ts > timestamp);
2603
2573
  }
2604
2574
  function buildScoreRecords() {
2605
- const { traceBounds: traceBounds2 } = data2();
2575
+ const { traceBounds: traceBounds2 } = data3();
2606
2576
  scoreRecords.push({ ts: traceBounds2.min, score: 0 });
2607
2577
  for (const cluster of clusters) {
2608
2578
  let clusterScore = 0;
@@ -2620,7 +2590,7 @@ function buildScoreRecords() {
2620
2590
  scoreRecords.push({ ts: cluster.clusterWindow.max, score: 0 });
2621
2591
  }
2622
2592
  }
2623
- async function finalize6() {
2593
+ async function finalize7() {
2624
2594
  layoutShiftEvents.sort((a, b) => a.ts - b.ts);
2625
2595
  prePaintEvents.sort((a, b) => a.ts - b.ts);
2626
2596
  layoutInvalidationEvents.sort((a, b) => a.ts - b.ts);
@@ -2629,7 +2599,7 @@ async function finalize6() {
2629
2599
  handlerState4 = 3 /* FINALIZED */;
2630
2600
  }
2631
2601
  async function buildLayoutShiftsClusters() {
2632
- const { navigationsByFrameId: navigationsByFrameId2, mainFrameId: mainFrameId2, traceBounds: traceBounds2 } = data2();
2602
+ const { navigationsByFrameId: navigationsByFrameId2, mainFrameId: mainFrameId2, traceBounds: traceBounds2 } = data3();
2633
2603
  const navigations = navigationsByFrameId2.get(mainFrameId2) || [];
2634
2604
  if (layoutShiftEvents.length === 0) {
2635
2605
  return;
@@ -2740,7 +2710,7 @@ async function buildLayoutShiftsClusters() {
2740
2710
  }
2741
2711
  }
2742
2712
  }
2743
- function data6() {
2713
+ function data7() {
2744
2714
  if (handlerState4 !== 3 /* FINALIZED */) {
2745
2715
  throw new Error("Layout Shifts Handler is not finalized");
2746
2716
  }
@@ -2777,34 +2747,34 @@ var LayoutShiftsThreshold = /* @__PURE__ */ ((LayoutShiftsThreshold2) => {
2777
2747
  // front_end/models/trace/handlers/MemoryHandler.ts
2778
2748
  var MemoryHandler_exports = {};
2779
2749
  __export(MemoryHandler_exports, {
2780
- data: () => data7,
2781
- handleEvent: () => handleEvent7,
2782
- reset: () => reset7
2750
+ data: () => data8,
2751
+ handleEvent: () => handleEvent8,
2752
+ reset: () => reset8
2783
2753
  });
2784
2754
  var updateCountersByProcess = /* @__PURE__ */ new Map();
2785
- function reset7() {
2755
+ function reset8() {
2786
2756
  updateCountersByProcess.clear();
2787
2757
  }
2788
- function handleEvent7(event) {
2758
+ function handleEvent8(event) {
2789
2759
  if (TraceEvents_exports.isTraceEventUpdateCounters(event)) {
2790
2760
  const countersForProcess = map_utilities_exports.getWithDefault(updateCountersByProcess, event.pid, () => []);
2791
2761
  countersForProcess.push(event);
2792
2762
  updateCountersByProcess.set(event.pid, countersForProcess);
2793
2763
  }
2794
2764
  }
2795
- function data7() {
2765
+ function data8() {
2796
2766
  return { updateCountersByProcess: new Map(updateCountersByProcess) };
2797
2767
  }
2798
2768
 
2799
2769
  // front_end/models/trace/handlers/NetworkRequestsHandler.ts
2800
2770
  var NetworkRequestsHandler_exports = {};
2801
2771
  __export(NetworkRequestsHandler_exports, {
2802
- data: () => data8,
2772
+ data: () => data9,
2803
2773
  deps: () => deps5,
2804
- finalize: () => finalize7,
2805
- handleEvent: () => handleEvent8,
2774
+ finalize: () => finalize8,
2775
+ handleEvent: () => handleEvent9,
2806
2776
  initialize: () => initialize4,
2807
- reset: () => reset8
2777
+ reset: () => reset9
2808
2778
  });
2809
2779
  var MILLISECONDS_TO_MICROSECONDS = 1e3;
2810
2780
  var SECONDS_TO_MICROSECONDS = 1e6;
@@ -2836,7 +2806,7 @@ function firstPositiveValueInList(entries) {
2836
2806
  return 0;
2837
2807
  }
2838
2808
  var handlerState5 = 1 /* UNINITIALIZED */;
2839
- function reset8() {
2809
+ function reset9() {
2840
2810
  requestsByOrigin.clear();
2841
2811
  requestMap.clear();
2842
2812
  requestsByTime.length = 0;
@@ -2845,7 +2815,7 @@ function reset8() {
2845
2815
  function initialize4() {
2846
2816
  handlerState5 = 2 /* INITIALIZED */;
2847
2817
  }
2848
- function handleEvent8(event) {
2818
+ function handleEvent9(event) {
2849
2819
  if (handlerState5 !== 2 /* INITIALIZED */) {
2850
2820
  throw new Error("Network Request handler is not initialized");
2851
2821
  }
@@ -2878,11 +2848,11 @@ function handleEvent8(event) {
2878
2848
  return;
2879
2849
  }
2880
2850
  }
2881
- async function finalize7() {
2851
+ async function finalize8() {
2882
2852
  if (handlerState5 !== 2 /* INITIALIZED */) {
2883
2853
  throw new Error("Network Request handler is not initialized");
2884
2854
  }
2885
- const { rendererProcessesByFrame } = data2();
2855
+ const { rendererProcessesByFrame } = data3();
2886
2856
  for (const [requestId, request] of requestMap.entries()) {
2887
2857
  if (!request.sendRequests || !request.receiveResponse) {
2888
2858
  continue;
@@ -3025,7 +2995,7 @@ async function finalize7() {
3025
2995
  }
3026
2996
  handlerState5 = 3 /* FINALIZED */;
3027
2997
  }
3028
- function data8() {
2998
+ function data9() {
3029
2999
  if (handlerState5 !== 3 /* FINALIZED */) {
3030
3000
  throw new Error("Network Request handler is not finalized");
3031
3001
  }
@@ -3043,11 +3013,11 @@ var UserInteractionsHandler_exports = {};
3043
3013
  __export(UserInteractionsHandler_exports, {
3044
3014
  LONG_INTERACTION_THRESHOLD: () => LONG_INTERACTION_THRESHOLD,
3045
3015
  categoryOfInteraction: () => categoryOfInteraction,
3046
- data: () => data9,
3047
- finalize: () => finalize8,
3048
- handleEvent: () => handleEvent9,
3016
+ data: () => data10,
3017
+ finalize: () => finalize9,
3018
+ handleEvent: () => handleEvent10,
3049
3019
  removeNestedInteractions: () => removeNestedInteractions,
3050
- reset: () => reset9
3020
+ reset: () => reset10
3051
3021
  });
3052
3022
  var allEvents = [];
3053
3023
  var LONG_INTERACTION_THRESHOLD = Timing_exports3.millisecondsToMicroseconds(Timing_exports2.MilliSeconds(200));
@@ -3057,7 +3027,7 @@ var interactionEventsWithNoNesting = [];
3057
3027
  var eventTimingEndEventsById = /* @__PURE__ */ new Map();
3058
3028
  var eventTimingStartEventsForInteractions = [];
3059
3029
  var handlerState6 = 1 /* UNINITIALIZED */;
3060
- function reset9() {
3030
+ function reset10() {
3061
3031
  allEvents.length = 0;
3062
3032
  interactionEvents.length = 0;
3063
3033
  eventTimingStartEventsForInteractions.length = 0;
@@ -3066,7 +3036,7 @@ function reset9() {
3066
3036
  longestInteractionEvent = null;
3067
3037
  handlerState6 = 2 /* INITIALIZED */;
3068
3038
  }
3069
- function handleEvent9(event) {
3039
+ function handleEvent10(event) {
3070
3040
  if (handlerState6 !== 2 /* INITIALIZED */) {
3071
3041
  throw new Error("Handler is not initialized");
3072
3042
  }
@@ -3137,7 +3107,7 @@ function removeNestedInteractions(interactions) {
3137
3107
  });
3138
3108
  return keptEvents;
3139
3109
  }
3140
- async function finalize8() {
3110
+ async function finalize9() {
3141
3111
  for (const interactionStartEvent of eventTimingStartEventsForInteractions) {
3142
3112
  const endEvent = eventTimingEndEventsById.get(interactionStartEvent.id);
3143
3113
  if (!endEvent) {
@@ -3171,7 +3141,7 @@ async function finalize8() {
3171
3141
  handlerState6 = 3 /* FINALIZED */;
3172
3142
  interactionEventsWithNoNesting.push(...removeNestedInteractions(interactionEvents));
3173
3143
  }
3174
- function data9() {
3144
+ function data10() {
3175
3145
  return {
3176
3146
  allEvents: [...allEvents],
3177
3147
  interactionEvents: [...interactionEvents],
@@ -3186,10 +3156,10 @@ function data9() {
3186
3156
  // front_end/models/trace/handlers/UserTimingsHandler.ts
3187
3157
  var UserTimingsHandler_exports = {};
3188
3158
  __export(UserTimingsHandler_exports, {
3189
- data: () => data10,
3190
- finalize: () => finalize9,
3191
- handleEvent: () => handleEvent10,
3192
- reset: () => reset10
3159
+ data: () => data11,
3160
+ finalize: () => finalize10,
3161
+ handleEvent: () => handleEvent11,
3162
+ reset: () => reset11
3193
3163
  });
3194
3164
  var syntheticEvents = [];
3195
3165
  var performanceMeasureEvents = [];
@@ -3197,7 +3167,7 @@ var performanceMarkEvents = [];
3197
3167
  var consoleTimings = [];
3198
3168
  var timestampEvents = [];
3199
3169
  var handlerState7 = 1 /* UNINITIALIZED */;
3200
- function reset10() {
3170
+ function reset11() {
3201
3171
  syntheticEvents.length = 0;
3202
3172
  performanceMeasureEvents.length = 0;
3203
3173
  performanceMarkEvents.length = 0;
@@ -3243,7 +3213,7 @@ var navTimingNames = [
3243
3213
  "loadEventStart",
3244
3214
  "loadEventEnd"
3245
3215
  ];
3246
- function handleEvent10(event) {
3216
+ function handleEvent11(event) {
3247
3217
  if (handlerState7 !== 2 /* INITIALIZED */) {
3248
3218
  throw new Error("UserTimings handler is not initialized");
3249
3219
  }
@@ -3265,7 +3235,7 @@ function handleEvent10(event) {
3265
3235
  timestampEvents.push(event);
3266
3236
  }
3267
3237
  }
3268
- async function finalize9() {
3238
+ async function finalize10() {
3269
3239
  if (handlerState7 !== 2 /* INITIALIZED */) {
3270
3240
  throw new Error("UserTimings handler is not initialized");
3271
3241
  }
@@ -3315,7 +3285,7 @@ async function finalize9() {
3315
3285
  syntheticEvents.sort((a, b) => a.ts - b.ts);
3316
3286
  handlerState7 = 3 /* FINALIZED */;
3317
3287
  }
3318
- function data10() {
3288
+ function data11() {
3319
3289
  if (handlerState7 !== 3 /* FINALIZED */) {
3320
3290
  throw new Error("UserTimings handler is not finalized");
3321
3291
  }
@@ -3332,15 +3302,15 @@ var WarningsHandler_exports = {};
3332
3302
  __export(WarningsHandler_exports, {
3333
3303
  FORCED_LAYOUT_AND_STYLES_THRESHOLD: () => FORCED_LAYOUT_AND_STYLES_THRESHOLD,
3334
3304
  LONG_MAIN_THREAD_TASK_THRESHOLD: () => LONG_MAIN_THREAD_TASK_THRESHOLD,
3335
- data: () => data11,
3336
- handleEvent: () => handleEvent11,
3337
- reset: () => reset11
3305
+ data: () => data12,
3306
+ handleEvent: () => handleEvent12,
3307
+ reset: () => reset12
3338
3308
  });
3339
3309
  var warningsPerEvent = /* @__PURE__ */ new Map();
3340
3310
  var eventsPerWarning = /* @__PURE__ */ new Map();
3341
3311
  var FORCED_LAYOUT_AND_STYLES_THRESHOLD = Timing_exports3.millisecondsToMicroseconds(Timing_exports2.MilliSeconds(10));
3342
3312
  var LONG_MAIN_THREAD_TASK_THRESHOLD = Timing_exports3.millisecondsToMicroseconds(Timing_exports2.MilliSeconds(50));
3343
- function reset11() {
3313
+ function reset12() {
3344
3314
  warningsPerEvent.clear();
3345
3315
  eventsPerWarning.clear();
3346
3316
  }
@@ -3352,7 +3322,7 @@ function storeWarning(event, warning) {
3352
3322
  existingEvents.push(event);
3353
3323
  eventsPerWarning.set(warning, existingEvents);
3354
3324
  }
3355
- function handleEvent11(event) {
3325
+ function handleEvent12(event) {
3356
3326
  if (event.name === TraceEvents_exports.KnownEventName.RunTask) {
3357
3327
  const { duration } = Timing_exports3.eventTimingsMicroSeconds(event);
3358
3328
  if (duration > LONG_MAIN_THREAD_TASK_THRESHOLD) {
@@ -3380,7 +3350,7 @@ function handleEvent11(event) {
3380
3350
  return;
3381
3351
  }
3382
3352
  }
3383
- function data11() {
3353
+ function data12() {
3384
3354
  return {
3385
3355
  perEvent: new Map(warningsPerEvent),
3386
3356
  perWarning: new Map(eventsPerWarning)
@@ -3390,11 +3360,11 @@ function data11() {
3390
3360
  // front_end/models/trace/handlers/WorkersHandler.ts
3391
3361
  var WorkersHandler_exports = {};
3392
3362
  __export(WorkersHandler_exports, {
3393
- data: () => data12,
3394
- finalize: () => finalize10,
3395
- handleEvent: () => handleEvent12,
3363
+ data: () => data13,
3364
+ finalize: () => finalize11,
3365
+ handleEvent: () => handleEvent13,
3396
3366
  initialize: () => initialize5,
3397
- reset: () => reset12
3367
+ reset: () => reset13
3398
3368
  });
3399
3369
  var handlerState8 = 1 /* UNINITIALIZED */;
3400
3370
  var sessionIdEvents = [];
@@ -3406,12 +3376,12 @@ function initialize5() {
3406
3376
  }
3407
3377
  handlerState8 = 2 /* INITIALIZED */;
3408
3378
  }
3409
- function reset12() {
3379
+ function reset13() {
3410
3380
  sessionIdEvents.length = 0;
3411
3381
  workerIdByThread.clear();
3412
3382
  handlerState8 = 1 /* UNINITIALIZED */;
3413
3383
  }
3414
- function handleEvent12(event) {
3384
+ function handleEvent13(event) {
3415
3385
  if (handlerState8 !== 2 /* INITIALIZED */) {
3416
3386
  throw new Error("Workers Handler is not initialized");
3417
3387
  }
@@ -3419,7 +3389,7 @@ function handleEvent12(event) {
3419
3389
  sessionIdEvents.push(event);
3420
3390
  }
3421
3391
  }
3422
- async function finalize10() {
3392
+ async function finalize11() {
3423
3393
  if (handlerState8 !== 2 /* INITIALIZED */) {
3424
3394
  throw new Error("Handler is not initialized");
3425
3395
  }
@@ -3432,7 +3402,7 @@ async function finalize10() {
3432
3402
  }
3433
3403
  handlerState8 = 3 /* FINALIZED */;
3434
3404
  }
3435
- function data12() {
3405
+ function data13() {
3436
3406
  if (handlerState8 !== 3 /* FINALIZED */) {
3437
3407
  throw new Error("Workers Handler is not finalized");
3438
3408
  }
@@ -3446,6 +3416,7 @@ function data12() {
3446
3416
  // front_end/models/trace/handlers/Migration.ts
3447
3417
  var ENABLED_TRACE_HANDLERS = {
3448
3418
  Animations: AnimationHandler_exports,
3419
+ AuctionWorklets: AuctionWorkletsHandler_exports,
3449
3420
  UserTimings: UserTimingsHandler_exports,
3450
3421
  PageLoadMetrics: PageLoadMetricsHandler_exports,
3451
3422
  UserInteractions: UserInteractionsHandler_exports,
@@ -3480,119 +3451,6 @@ __export(ModelHandlers_exports, {
3480
3451
  Workers: () => WorkersHandler_exports
3481
3452
  });
3482
3453
 
3483
- // front_end/models/trace/handlers/AuctionWorkletsHandler.ts
3484
- var AuctionWorkletsHandler_exports = {};
3485
- __export(AuctionWorkletsHandler_exports, {
3486
- data: () => data13,
3487
- finalize: () => finalize11,
3488
- handleEvent: () => handleEvent13,
3489
- reset: () => reset13
3490
- });
3491
- var runningInProcessEvents = /* @__PURE__ */ new Map();
3492
- var doneWithProcessEvents = /* @__PURE__ */ new Map();
3493
- var createdSyntheticEvents = /* @__PURE__ */ new Map();
3494
- var utilityThreads = /* @__PURE__ */ new Map();
3495
- var v8HelperThreads = /* @__PURE__ */ new Map();
3496
- function reset13() {
3497
- runningInProcessEvents.clear();
3498
- doneWithProcessEvents.clear();
3499
- createdSyntheticEvents.clear();
3500
- utilityThreads.clear();
3501
- v8HelperThreads.clear();
3502
- }
3503
- function handleEvent13(event) {
3504
- if (TraceEvents_exports.isTraceEventAuctionWorkletRunningInProcess(event)) {
3505
- runningInProcessEvents.set(event.args.data.pid, event);
3506
- return;
3507
- }
3508
- if (TraceEvents_exports.isTraceEventAuctionWorkletDoneWithProcess(event)) {
3509
- doneWithProcessEvents.set(event.args.data.pid, event);
3510
- return;
3511
- }
3512
- if (TraceEvents_exports.isThreadName(event)) {
3513
- if (event.args.name === "auction_worklet.CrUtilityMain") {
3514
- utilityThreads.set(event.pid, event);
3515
- return;
3516
- }
3517
- if (event.args.name === "AuctionV8HelperThread") {
3518
- v8HelperThreads.set(event.pid, event);
3519
- }
3520
- }
3521
- }
3522
- function workletType(input) {
3523
- switch (input) {
3524
- case "seller":
3525
- return TraceEvents_exports.AuctionWorkletType.SELLER;
3526
- case "bidder":
3527
- return TraceEvents_exports.AuctionWorkletType.BIDDER;
3528
- default:
3529
- return TraceEvents_exports.AuctionWorkletType.UNKNOWN;
3530
- }
3531
- }
3532
- function makeSyntheticEventBase(event) {
3533
- return {
3534
- name: "SyntheticAuctionWorkletEvent",
3535
- s: TraceEvents_exports.TraceEventScope.THREAD,
3536
- cat: event.cat,
3537
- tid: event.tid,
3538
- ts: event.ts,
3539
- ph: TraceEvents_exports.Phase.INSTANT,
3540
- pid: event.args.data.pid,
3541
- host: event.args.data.host,
3542
- target: event.args.data.target,
3543
- type: workletType(event.args.data.type)
3544
- };
3545
- }
3546
- async function finalize11() {
3547
- for (const [pid, utilityThreadNameEvent] of utilityThreads) {
3548
- const v8HelperEvent = v8HelperThreads.get(pid);
3549
- if (!v8HelperEvent) {
3550
- continue;
3551
- }
3552
- const runningEvent = runningInProcessEvents.get(pid);
3553
- const doneWithEvent = doneWithProcessEvents.get(pid);
3554
- let syntheticEvent = null;
3555
- if (runningEvent) {
3556
- syntheticEvent = {
3557
- ...makeSyntheticEventBase(runningEvent),
3558
- args: {
3559
- data: {
3560
- runningInProcessEvent: runningEvent,
3561
- utilityThread: utilityThreadNameEvent,
3562
- v8HelperThread: v8HelperEvent
3563
- }
3564
- }
3565
- };
3566
- if (doneWithEvent) {
3567
- syntheticEvent.args.data.doneWithProcessEvent = doneWithEvent;
3568
- }
3569
- } else if (doneWithEvent) {
3570
- syntheticEvent = {
3571
- ...makeSyntheticEventBase(doneWithEvent),
3572
- args: {
3573
- data: {
3574
- doneWithProcessEvent: doneWithEvent,
3575
- utilityThread: utilityThreadNameEvent,
3576
- v8HelperThread: v8HelperEvent
3577
- }
3578
- }
3579
- };
3580
- if (runningEvent) {
3581
- syntheticEvent.args.data.runningInProcessEvent = runningEvent;
3582
- }
3583
- }
3584
- if (syntheticEvent === null) {
3585
- continue;
3586
- }
3587
- createdSyntheticEvents.set(pid, syntheticEvent);
3588
- }
3589
- }
3590
- function data13() {
3591
- return {
3592
- worklets: new Map(createdSyntheticEvents)
3593
- };
3594
- }
3595
-
3596
3454
  // front_end/models/trace/handlers/LargestImagePaintHandler.ts
3597
3455
  var LargestImagePaintHandler_exports = {};
3598
3456
  __export(LargestImagePaintHandler_exports, {
@@ -3658,16 +3516,15 @@ __export(RendererHandler_exports, {
3658
3516
  makeCompleteEvent: () => makeCompleteEvent,
3659
3517
  reset: () => reset17,
3660
3518
  sanitizeProcesses: () => sanitizeProcesses,
3661
- sanitizeThreads: () => sanitizeThreads,
3662
- treify: () => treify
3519
+ sanitizeThreads: () => sanitizeThreads
3663
3520
  });
3664
3521
 
3665
3522
  // front_end/models/trace/handlers/SamplesHandler.ts
3666
3523
  var SamplesHandler_exports = {};
3667
3524
  __export(SamplesHandler_exports, {
3668
- buildProfileCalls: () => buildProfileCalls,
3669
3525
  data: () => data16,
3670
3526
  finalize: () => finalize12,
3527
+ getProfileCallFunctionName: () => getProfileCallFunctionName,
3671
3528
  handleEvent: () => handleEvent16,
3672
3529
  initialize: () => initialize6,
3673
3530
  reset: () => reset16
@@ -3858,12 +3715,6 @@ var CPUProfileDataModel = class extends ProfileTreeModel {
3858
3715
  return timestamps;
3859
3716
  }
3860
3717
  translateProfileTree(nodes) {
3861
- function isNativeNode(node) {
3862
- if (node.callFrame) {
3863
- return Boolean(node.callFrame.url) && node.callFrame.url.startsWith("native ");
3864
- }
3865
- return Boolean(node["url"]) && node["url"].startsWith("native ");
3866
- }
3867
3718
  function buildChildrenFromParents(nodes2) {
3868
3719
  if (nodes2[0].children) {
3869
3720
  return;
@@ -3906,7 +3757,6 @@ var CPUProfileDataModel = class extends ProfileTreeModel {
3906
3757
  buildChildrenFromParents(nodes);
3907
3758
  this.totalHitCount = nodes.reduce((acc, node) => acc + (node.hitCount || 0), 0);
3908
3759
  const sampleTime = (this.profileEndTime - this.profileStartTime) / this.totalHitCount;
3909
- const keepNatives = true;
3910
3760
  const root = nodes[0];
3911
3761
  const idToUseForRemovedNode = /* @__PURE__ */ new Map([[root.id, root.id]]);
3912
3762
  this.#idToParsedNode = /* @__PURE__ */ new Map();
@@ -3927,12 +3777,8 @@ var CPUProfileDataModel = class extends ProfileTreeModel {
3927
3777
  sourceNode.children = [];
3928
3778
  }
3929
3779
  const targetNode = new CPUProfileNode(sourceNode, sampleTime);
3930
- if (keepNatives || !isNativeNode(sourceNode)) {
3931
- parentNode.children.push(targetNode);
3932
- parentNode = targetNode;
3933
- } else {
3934
- parentNode.self += targetNode.self;
3935
- }
3780
+ parentNode.children.push(targetNode);
3781
+ parentNode = targetNode;
3936
3782
  idToUseForRemovedNode.set(sourceNode.id, parentNode.id);
3937
3783
  parentNodeStack.push.apply(parentNodeStack, sourceNode.children.map(() => parentNode));
3938
3784
  sourceNodeStack.push.apply(sourceNodeStack, sourceNode.children.map((id) => protocolNodeById.get(id)));
@@ -4159,60 +4005,63 @@ var CPUProfileDataModel = class extends ProfileTreeModel {
4159
4005
  // front_end/models/trace/handlers/SamplesHandler.ts
4160
4006
  var events = /* @__PURE__ */ new Map();
4161
4007
  var profilesInProcess = /* @__PURE__ */ new Map();
4008
+ var entryToNode = /* @__PURE__ */ new Map();
4162
4009
  var preprocessedData = /* @__PURE__ */ new Map();
4163
4010
  var handlerState9 = 1 /* UNINITIALIZED */;
4164
4011
  function buildProfileCalls() {
4165
4012
  for (const [processId, profiles] of preprocessedData) {
4166
4013
  for (const [profileId, preProcessedData] of profiles) {
4167
- let openFrameCallback = function(_depth, node, timeStampMs) {
4014
+ let openFrameCallback = function(depth, node, timeStampMs) {
4015
+ if (threadId === void 0) {
4016
+ return;
4017
+ }
4168
4018
  const ts = Timing_exports3.millisecondsToMicroseconds(Timing_exports2.MilliSeconds(timeStampMs));
4169
- trackingStack.push({ callFrame: node.callFrame, ts, pid: processId, children: [], tid: threadId });
4170
- }, closeFrameCallback = function(depth, node, _timeStamp, durMs, selfTimeMs) {
4171
- const partialProfileCall = trackingStack.pop();
4172
- if (!partialProfileCall) {
4019
+ const nodeId = node.id;
4020
+ const profileCall = Trace_exports.makeProfileCall(node, ts, processId, threadId);
4021
+ finalizedData.profileCalls.push(profileCall);
4022
+ indexStack.push(finalizedData.profileCalls.length - 1);
4023
+ const traceEntryNode = TreeHelpers_exports.makeEmptyTraceEntryNode(profileCall, nodeId);
4024
+ finalizedData.profileTree?.nodes.set(nodeId, traceEntryNode);
4025
+ entryToNode.set(profileCall, traceEntryNode);
4026
+ traceEntryNode.depth = depth;
4027
+ if (indexStack.length === 1) {
4028
+ finalizedData.profileTree?.roots.add(traceEntryNode);
4029
+ }
4030
+ }, closeFrameCallback = function(_depth, node, _timeStamp, durMs, selfTimeMs) {
4031
+ const profileCallIndex = indexStack.pop();
4032
+ const profileCall = profileCallIndex !== void 0 && finalizedData.profileCalls[profileCallIndex];
4033
+ if (!profileCall) {
4173
4034
  return;
4174
4035
  }
4175
- const { callFrame, ts, pid, children, tid } = partialProfileCall;
4176
- if (callFrame === void 0 || ts === void 0 || pid === void 0 || profileId === void 0 || children === void 0 || tid === void 0) {
4036
+ const { callFrame, ts, pid, tid } = profileCall;
4037
+ const traceEntryNode = entryToNode.get(profileCall);
4038
+ if (callFrame === void 0 || ts === void 0 || pid === void 0 || profileId === void 0 || tid === void 0 || traceEntryNode === void 0) {
4177
4039
  return;
4178
4040
  }
4179
4041
  const dur = Timing_exports3.millisecondsToMicroseconds(Timing_exports2.MilliSeconds(durMs));
4180
4042
  const selfTime = Timing_exports3.millisecondsToMicroseconds(Timing_exports2.MilliSeconds(selfTimeMs));
4181
- const completeProfileCall = {
4182
- callFrame,
4183
- ts,
4184
- pid,
4185
- dur,
4186
- selfTime,
4187
- children,
4188
- ph: TraceEvents_exports.Phase.COMPLETE,
4189
- cat: "",
4190
- name: "ProfileCall",
4191
- tid,
4192
- nodeId: node.id
4193
- };
4194
- const parent = trackingStack.at(-1);
4195
- const calls = finalizedData.profileCalls;
4196
- calls.push(completeProfileCall);
4197
- if (!parent) {
4043
+ profileCall.dur = dur;
4044
+ profileCall.selfTime = selfTime;
4045
+ const parentIndex = indexStack.at(-1);
4046
+ const parent = parentIndex !== void 0 && finalizedData.profileCalls.at(parentIndex);
4047
+ const parentNode = parent && entryToNode.get(parent);
4048
+ if (!parentNode) {
4198
4049
  return;
4199
4050
  }
4200
- parent.children = parent.children || [];
4201
- parent.children.push(completeProfileCall);
4202
- if (parent.selfTime) {
4203
- parent.selfTime = Timing_exports2.MicroSeconds(parent.selfTime - dur);
4204
- }
4051
+ traceEntryNode.parentId = parentNode.id;
4052
+ parentNode.children.add(traceEntryNode);
4205
4053
  };
4206
4054
  const threadId = preProcessedData.threadId;
4207
- if (!preProcessedData.rawProfile.nodes.length || !threadId) {
4055
+ if (!preProcessedData.rawProfile.nodes.length || threadId === void 0) {
4208
4056
  continue;
4209
4057
  }
4210
- const trackingStack = [];
4058
+ const indexStack = [];
4211
4059
  const profileModel = new CPUProfileDataModel_exports.CPUProfileDataModel(preProcessedData.rawProfile);
4212
- const finalizedData = { rawProfile: preProcessedData.rawProfile, parsedProfile: profileModel, profileCalls: [] };
4213
- profileModel.forEachFrame(openFrameCallback, closeFrameCallback);
4214
- Trace_exports.sortTraceEventsInPlace(finalizedData.profileCalls);
4060
+ const profileTree = TreeHelpers_exports.makeEmptyTraceEntryTree();
4061
+ profileTree.maxDepth = profileModel.maxDepth;
4062
+ const finalizedData = { rawProfile: preProcessedData.rawProfile, parsedProfile: profileModel, profileCalls: [], profileTree };
4215
4063
  const dataByThread = map_utilities_exports.getWithDefault(profilesInProcess, processId, () => /* @__PURE__ */ new Map());
4064
+ profileModel.forEachFrame(openFrameCallback, closeFrameCallback);
4216
4065
  dataByThread.set(threadId, finalizedData);
4217
4066
  }
4218
4067
  }
@@ -4221,6 +4070,7 @@ function reset16() {
4221
4070
  events.clear();
4222
4071
  preprocessedData.clear();
4223
4072
  profilesInProcess.clear();
4073
+ entryToNode.clear();
4224
4074
  handlerState9 = 1 /* UNINITIALIZED */;
4225
4075
  }
4226
4076
  function initialize6() {
@@ -4233,6 +4083,15 @@ function handleEvent16(event) {
4233
4083
  if (handlerState9 !== 2 /* INITIALIZED */) {
4234
4084
  throw new Error("Samples Handler is not initialized");
4235
4085
  }
4086
+ if (TraceEvents_exports.isSyntheticTraceEventCpuProfile(event)) {
4087
+ const pid = event.pid;
4088
+ const tid = event.tid;
4089
+ const profileId = "0x1";
4090
+ const profileData = getOrCreatePreProcessedData(pid, profileId);
4091
+ profileData.rawProfile = event.args.data.cpuProfile;
4092
+ profileData.threadId = tid;
4093
+ return;
4094
+ }
4236
4095
  if (TraceEvents_exports.isTraceEventProfile(event)) {
4237
4096
  const profileData = getOrCreatePreProcessedData(event.pid, event.id);
4238
4097
  profileData.rawProfile.startTime = event.ts;
@@ -4246,8 +4105,8 @@ function handleEvent16(event) {
4246
4105
  const samples = nodesAndSamples?.samples || [];
4247
4106
  const nodes = [];
4248
4107
  for (const n of nodesAndSamples?.nodes || []) {
4249
- const lineNumber = n.callFrame.lineNumber || -1;
4250
- const columnNumber = n.callFrame.columnNumber || -1;
4108
+ const lineNumber = typeof n.callFrame.lineNumber === "undefined" ? -1 : n.callFrame.lineNumber;
4109
+ const columnNumber = typeof n.callFrame.columnNumber === "undefined" ? -1 : n.callFrame.columnNumber;
4251
4110
  const scriptId = String(n.callFrame.scriptId);
4252
4111
  const url = n.callFrame.url || "";
4253
4112
  const node = {
@@ -4291,7 +4150,8 @@ function data16() {
4291
4150
  throw new Error("Samples Handler is not finalized");
4292
4151
  }
4293
4152
  return {
4294
- profilesInProcess: new Map(profilesInProcess)
4153
+ profilesInProcess: new Map(profilesInProcess),
4154
+ entryToNode: new Map(entryToNode)
4295
4155
  };
4296
4156
  }
4297
4157
  function getOrCreatePreProcessedData(processId, profileId) {
@@ -4308,14 +4168,20 @@ function getOrCreatePreProcessedData(processId, profileId) {
4308
4168
  profileId
4309
4169
  }));
4310
4170
  }
4171
+ function getProfileCallFunctionName(data18, entry) {
4172
+ const profile = data18.profilesInProcess.get(entry.pid)?.get(entry.tid);
4173
+ const node = profile?.parsedProfile.nodeById(entry.nodeId);
4174
+ if (node?.functionName) {
4175
+ return node.functionName;
4176
+ }
4177
+ return entry.callFrame.functionName;
4178
+ }
4311
4179
 
4312
4180
  // front_end/models/trace/handlers/RendererHandler.ts
4313
4181
  var processes = /* @__PURE__ */ new Map();
4314
4182
  var compositorTileWorkers = Array();
4315
- var entryToNode = /* @__PURE__ */ new Map();
4183
+ var entryToNode2 = /* @__PURE__ */ new Map();
4316
4184
  var allRendererEvents = [];
4317
- var nodeIdCount = 0;
4318
- var makeRendererEntrytNodeId = () => ++nodeIdCount;
4319
4185
  var completeEventStack = [];
4320
4186
  var handlerState10 = 1 /* UNINITIALIZED */;
4321
4187
  var config = Configuration_exports.DEFAULT;
@@ -4328,18 +4194,6 @@ var makeRendererThread = () => ({
4328
4194
  name: null,
4329
4195
  entries: []
4330
4196
  });
4331
- var makeEmptyRendererTree = () => ({
4332
- nodes: /* @__PURE__ */ new Map(),
4333
- roots: /* @__PURE__ */ new Set(),
4334
- maxDepth: 0
4335
- });
4336
- var makeEmptyRendererEventNode = (entry, id) => ({
4337
- entry,
4338
- id,
4339
- parentId: null,
4340
- childrenIds: /* @__PURE__ */ new Set(),
4341
- depth: 0
4342
- });
4343
4197
  var getOrCreateRendererProcess = (processes2, pid) => {
4344
4198
  return map_utilities_exports.getWithDefault(processes2, pid, makeRendererProcess);
4345
4199
  };
@@ -4351,11 +4205,10 @@ function handleUserConfig(userConfig) {
4351
4205
  }
4352
4206
  function reset17() {
4353
4207
  processes.clear();
4354
- entryToNode.clear();
4208
+ entryToNode2.clear();
4355
4209
  allRendererEvents.length = 0;
4356
4210
  completeEventStack.length = 0;
4357
4211
  compositorTileWorkers.length = 0;
4358
- nodeIdCount = -1;
4359
4212
  handlerState10 = 1 /* UNINITIALIZED */;
4360
4213
  }
4361
4214
  function initialize7() {
@@ -4396,7 +4249,7 @@ async function finalize13() {
4396
4249
  if (handlerState10 !== 2 /* INITIALIZED */) {
4397
4250
  throw new Error("Renderer Handler is not initialized");
4398
4251
  }
4399
- const { mainFrameId: mainFrameId2, rendererProcessesByFrame, threadsInProcess: threadsInProcess2 } = data2();
4252
+ const { mainFrameId: mainFrameId2, rendererProcessesByFrame, threadsInProcess: threadsInProcess2 } = data3();
4400
4253
  assignMeta(processes, mainFrameId2, rendererProcessesByFrame, threadsInProcess2);
4401
4254
  sanitizeProcesses(processes);
4402
4255
  buildHierarchy(processes);
@@ -4410,7 +4263,7 @@ function data17() {
4410
4263
  return {
4411
4264
  processes: new Map(processes),
4412
4265
  compositorTileWorkers: new Map(gatherCompositorThreads()),
4413
- entryToNode: new Map(entryToNode),
4266
+ entryToNode: new Map(entryToNode2),
4414
4267
  allRendererEvents: [...allRendererEvents]
4415
4268
  };
4416
4269
  }
@@ -4467,9 +4320,15 @@ function assignThreadName(processes2, rendererProcessesByFrame, threadsInProcess
4467
4320
  }
4468
4321
  }
4469
4322
  function sanitizeProcesses(processes2) {
4323
+ const auctionWorklets = data2().worklets;
4470
4324
  for (const [pid, process] of processes2) {
4471
4325
  if (process.url === null) {
4472
- processes2.delete(pid);
4326
+ const maybeWorklet = auctionWorklets.get(pid);
4327
+ if (maybeWorklet) {
4328
+ process.url = maybeWorklet.host;
4329
+ } else {
4330
+ processes2.delete(pid);
4331
+ }
4473
4332
  continue;
4474
4333
  }
4475
4334
  const asUrl = new URL(process.url);
@@ -4491,81 +4350,23 @@ function buildHierarchy(processes2, options) {
4491
4350
  for (const [pid, process] of processes2) {
4492
4351
  for (const [tid, thread] of process.threads) {
4493
4352
  if (!thread.entries.length) {
4494
- thread.tree = makeEmptyRendererTree();
4353
+ thread.tree = TreeHelpers_exports.makeEmptyTraceEntryTree();
4495
4354
  continue;
4496
4355
  }
4497
4356
  Trace_exports.sortTraceEventsInPlace(thread.entries);
4498
4357
  const cpuProfile = data16().profilesInProcess.get(pid)?.get(tid)?.parsedProfile;
4499
- const samplesIntegrator = cpuProfile && new SamplesIntegrator_exports.SamplesIntegrator(cpuProfile, pid, tid, {
4500
- showNativeFunctionsInJSProfile: config.settings.showNativeFunctionsInJSProfile
4501
- });
4358
+ const samplesIntegrator = cpuProfile && new SamplesIntegrator_exports.SamplesIntegrator(cpuProfile, pid, tid, config);
4502
4359
  const profileCalls = samplesIntegrator?.buildProfileCalls(thread.entries);
4503
4360
  if (profileCalls) {
4504
4361
  thread.entries = Trace_exports.mergeEventsInOrder(thread.entries, profileCalls);
4505
4362
  }
4506
- thread.tree = treify(thread.entries, options);
4507
- }
4508
- }
4509
- }
4510
- function treify(entries, options) {
4511
- const stack = [];
4512
- nodeIdCount = -1;
4513
- const tree = makeEmptyRendererTree();
4514
- for (let i = 0; i < entries.length; i++) {
4515
- const event = entries[i];
4516
- if (options && !options.filter.has(event.name)) {
4517
- continue;
4518
- }
4519
- const duration = event.dur || 0;
4520
- const nodeId = makeRendererEntrytNodeId();
4521
- const node = makeEmptyRendererEventNode(event, nodeId);
4522
- if (stack.length === 0) {
4523
- tree.nodes.set(nodeId, node);
4524
- tree.roots.add(nodeId);
4525
- event.selfTime = Timing_exports2.MicroSeconds(duration);
4526
- stack.push(node);
4527
- tree.maxDepth = Math.max(tree.maxDepth, stack.length);
4528
- entryToNode.set(event, node);
4529
- continue;
4530
- }
4531
- const parentNode = stack.at(-1);
4532
- if (parentNode === void 0) {
4533
- throw new Error("Impossible: no parent node found in the stack");
4534
- }
4535
- const parentEvent = parentNode.entry;
4536
- const begin = event.ts;
4537
- const parentBegin = parentEvent.ts;
4538
- const parentDuration = parentEvent.dur || 0;
4539
- const end = begin + duration;
4540
- const parentEnd = parentBegin + parentDuration;
4541
- const startsBeforeParent = begin < parentBegin;
4542
- if (startsBeforeParent) {
4543
- throw new Error("Impossible: current event starts before the parent event");
4544
- }
4545
- const startsAfterParent = begin >= parentEnd;
4546
- if (startsAfterParent) {
4547
- stack.pop();
4548
- i--;
4549
- nodeIdCount--;
4550
- continue;
4551
- }
4552
- const endsAfterParent = end > parentEnd;
4553
- if (endsAfterParent) {
4554
- continue;
4555
- }
4556
- tree.nodes.set(nodeId, node);
4557
- node.depth = stack.length;
4558
- node.parentId = parentNode.id;
4559
- parentNode.childrenIds.add(nodeId);
4560
- event.selfTime = Timing_exports2.MicroSeconds(duration);
4561
- if (parentEvent.selfTime !== void 0) {
4562
- parentEvent.selfTime = Timing_exports2.MicroSeconds(parentEvent.selfTime - (event.dur || 0));
4363
+ const treeData = TreeHelpers_exports.treify(thread.entries, options);
4364
+ thread.tree = treeData.tree;
4365
+ for (const [entry, node] of treeData.entryToNode) {
4366
+ entryToNode2.set(entry, node);
4367
+ }
4563
4368
  }
4564
- stack.push(node);
4565
- tree.maxDepth = Math.max(tree.maxDepth, stack.length);
4566
- entryToNode.set(event, node);
4567
4369
  }
4568
- return tree;
4569
4370
  }
4570
4371
  function makeCompleteEvent(event) {
4571
4372
  if (TraceEvents_exports.isTraceEventEnd(event)) {
@@ -4589,11 +4390,77 @@ function makeCompleteEvent(event) {
4589
4390
  return syntheticComplete;
4590
4391
  }
4591
4392
  function deps6() {
4592
- return ["Meta", "Samples"];
4393
+ return ["Meta", "Samples", "AuctionWorklets"];
4394
+ }
4395
+
4396
+ // front_end/models/trace/handlers/Threads.ts
4397
+ var Threads_exports = {};
4398
+ __export(Threads_exports, {
4399
+ ThreadType: () => ThreadType,
4400
+ threadsInTrace: () => threadsInTrace
4401
+ });
4402
+ var ThreadType = /* @__PURE__ */ ((ThreadType2) => {
4403
+ ThreadType2["MAIN_THREAD"] = "MAIN_THREAD";
4404
+ ThreadType2["WORKER"] = "WORKER";
4405
+ ThreadType2["RASTERIZER"] = "RASTERIZER";
4406
+ ThreadType2["AUCTION_WORKLET"] = "AUCTION_WORKLET";
4407
+ ThreadType2["OTHER"] = "OTHER";
4408
+ ThreadType2["CPU_PROFILE"] = "CPU_PROFILE";
4409
+ return ThreadType2;
4410
+ })(ThreadType || {});
4411
+ function getThreadTypeForRendererThread(traceParseData, pid, thread) {
4412
+ let threadType = "OTHER" /* OTHER */;
4413
+ if (thread.name === "CrRendererMain") {
4414
+ threadType = "MAIN_THREAD" /* MAIN_THREAD */;
4415
+ } else if (thread.name === "DedicatedWorker thread") {
4416
+ threadType = "WORKER" /* WORKER */;
4417
+ } else if (thread.name?.startsWith("CompositorTileWorker")) {
4418
+ threadType = "RASTERIZER" /* RASTERIZER */;
4419
+ } else if (traceParseData.AuctionWorklets.worklets.has(pid)) {
4420
+ threadType = "AUCTION_WORKLET" /* AUCTION_WORKLET */;
4421
+ }
4422
+ return threadType;
4423
+ }
4424
+ function threadsInTrace(traceParseData) {
4425
+ const foundThreads = [];
4426
+ if (traceParseData.Renderer && traceParseData.Renderer.processes.size) {
4427
+ for (const [pid, process] of traceParseData.Renderer.processes) {
4428
+ for (const [tid, thread] of process.threads) {
4429
+ const threadType = getThreadTypeForRendererThread(traceParseData, pid, thread);
4430
+ if (!thread.tree) {
4431
+ continue;
4432
+ }
4433
+ foundThreads.push({
4434
+ name: thread.name,
4435
+ pid,
4436
+ tid,
4437
+ entries: thread.entries,
4438
+ tree: thread.tree,
4439
+ type: threadType,
4440
+ entryToNode: traceParseData.Renderer.entryToNode
4441
+ });
4442
+ }
4443
+ }
4444
+ } else if (traceParseData.Samples && traceParseData.Samples.profilesInProcess.size) {
4445
+ for (const [pid, process] of traceParseData.Samples.profilesInProcess) {
4446
+ for (const [tid, thread] of process) {
4447
+ if (!thread.profileTree) {
4448
+ continue;
4449
+ }
4450
+ foundThreads.push({
4451
+ pid,
4452
+ tid,
4453
+ name: null,
4454
+ entries: thread.profileCalls,
4455
+ tree: thread.profileTree,
4456
+ type: "CPU_PROFILE" /* CPU_PROFILE */,
4457
+ entryToNode: traceParseData.Samples.entryToNode
4458
+ });
4459
+ }
4460
+ }
4461
+ }
4462
+ return foundThreads;
4593
4463
  }
4594
- var RendererEventNodeIdTag = class {
4595
- #tag;
4596
- };
4597
4464
 
4598
4465
  // front_end/models/trace/LegacyTracingModel.ts
4599
4466
  var LegacyTracingModel_exports = {};
@@ -5288,22 +5155,18 @@ var TraceParseProgressEvent = _TraceParseProgressEvent;
5288
5155
  __publicField(TraceParseProgressEvent, "eventName", "traceparseprogress");
5289
5156
  var TraceProcessor = class extends EventTarget {
5290
5157
  #traceHandlers;
5291
- #pauseDuration;
5292
- #eventsPerChunk;
5293
5158
  #status = "IDLE" /* IDLE */;
5294
5159
  #modelConfiguration = Configuration_exports.DEFAULT;
5295
5160
  static createWithAllHandlers() {
5296
- return new TraceProcessor(ModelHandlers_exports, {}, Configuration_exports.DEFAULT);
5161
+ return new TraceProcessor(ModelHandlers_exports, Configuration_exports.DEFAULT);
5297
5162
  }
5298
- constructor(traceHandlers, { pauseDuration = 1, eventsPerChunk = 15e3 } = {}, modelConfiguration) {
5163
+ constructor(traceHandlers, modelConfiguration) {
5299
5164
  super();
5300
5165
  this.#verifyHandlers(traceHandlers);
5301
5166
  this.#traceHandlers = {
5302
5167
  Meta: ModelHandlers_exports.Meta,
5303
5168
  ...traceHandlers
5304
5169
  };
5305
- this.#pauseDuration = pauseDuration;
5306
- this.#eventsPerChunk = eventsPerChunk;
5307
5170
  if (modelConfiguration) {
5308
5171
  this.#modelConfiguration = modelConfiguration;
5309
5172
  }
@@ -5363,7 +5226,8 @@ var TraceProcessor = class extends EventTarget {
5363
5226
  }
5364
5227
  }
5365
5228
  async #parse(traceEvents, freshRecording) {
5366
- const traceEventIterator = new TraceEventIterator(traceEvents, this.#pauseDuration, this.#eventsPerChunk);
5229
+ const { pauseDuration, eventsPerChunk } = this.#modelConfiguration.processing;
5230
+ const traceEventIterator = new TraceEventIterator(traceEvents, pauseDuration, eventsPerChunk);
5367
5231
  const sortedHandlers = [...sortHandlers(this.#traceHandlers).values()];
5368
5232
  for (const handler of sortedHandlers) {
5369
5233
  handler.reset();
@@ -5460,8 +5324,8 @@ var Model = class extends EventTarget {
5460
5324
  #lastRecordingIndex = 0;
5461
5325
  #processor;
5462
5326
  #config = Configuration_exports.DEFAULT;
5463
- static createWithAllHandlers() {
5464
- return new Model(ModelHandlers_exports);
5327
+ static createWithAllHandlers(config2) {
5328
+ return new Model(ModelHandlers_exports, config2);
5465
5329
  }
5466
5330
  static createWithRequiredHandlersForMigration(config2) {
5467
5331
  return new Model(Migration_exports.ENABLED_TRACE_HANDLERS, config2);
@@ -5471,7 +5335,7 @@ var Model = class extends EventTarget {
5471
5335
  if (config2) {
5472
5336
  this.#config = config2;
5473
5337
  }
5474
- this.#processor = new TraceProcessor(handlers, {}, this.#config);
5338
+ this.#processor = new TraceProcessor(handlers, this.#config);
5475
5339
  }
5476
5340
  updateConfiguration(config2) {
5477
5341
  this.#config = config2;
@@ -5581,9 +5445,9 @@ var TreeManipulator = class {
5581
5445
  #entryToNode;
5582
5446
  #lastVisibleEntries = null;
5583
5447
  #activeActions = [];
5584
- constructor(thread, entryToNode2) {
5448
+ constructor(thread, entryToNode3) {
5585
5449
  this.#thread = thread;
5586
- this.#entryToNode = entryToNode2;
5450
+ this.#entryToNode = entryToNode3;
5587
5451
  }
5588
5452
  applyAction(action) {
5589
5453
  if (this.#actionIsActive(action)) {
@@ -5636,7 +5500,7 @@ var TreeManipulator = class {
5636
5500
  if (!entryNode) {
5637
5501
  continue;
5638
5502
  }
5639
- const allAncestors = this.#findAllAncestorsOfNode(this.#thread.tree, entryNode);
5503
+ const allAncestors = this.#findAllAncestorsOfNode(entryNode);
5640
5504
  allAncestors.forEach((ancestor) => entriesToHide.add(ancestor));
5641
5505
  break;
5642
5506
  }
@@ -5649,19 +5513,15 @@ var TreeManipulator = class {
5649
5513
  });
5650
5514
  return this.#lastVisibleEntries;
5651
5515
  }
5652
- #findAllAncestorsOfNode(tree, root) {
5516
+ #findAllAncestorsOfNode(root) {
5653
5517
  const ancestors = [];
5654
- const childIds = Array.from(root.childrenIds);
5655
- while (childIds.length > 0) {
5656
- const id = childIds.shift();
5657
- if (!id) {
5658
- break;
5659
- }
5660
- const childNode = tree.nodes.get(id);
5518
+ const children = Array.from(root.children);
5519
+ while (children.length > 0) {
5520
+ const childNode = children.shift();
5661
5521
  if (childNode) {
5662
5522
  ancestors.push(childNode.entry);
5663
- const newChildIds = Array.from(childNode.childrenIds);
5664
- childIds.push(...newChildIds);
5523
+ const newChildIds = Array.from(childNode.children);
5524
+ children.push(...newChildIds);
5665
5525
  }
5666
5526
  }
5667
5527
  return ancestors;