lighthouse 11.5.0 → 11.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/core/audits/layout-shifts.js +5 -2
  2. package/core/computed/metrics/cumulative-layout-shift.js +7 -1
  3. package/core/computed/trace-engine-result.d.ts +2 -16
  4. package/core/computed/trace-engine-result.js +12 -3
  5. package/core/gather/driver/wait-for-condition.js +15 -0
  6. package/core/gather/gatherers/root-causes.js +22 -9
  7. package/core/gather/gatherers/trace-elements.js +6 -2
  8. package/core/gather/gatherers/trace.js +2 -1
  9. package/core/gather/runner-helpers.js +4 -1
  10. package/core/lib/trace-engine.d.ts +10 -6
  11. package/core/lib/trace-engine.js +3 -4
  12. package/dist/report/bundle.esm.js +1 -1
  13. package/dist/report/flow.js +1 -1
  14. package/dist/report/standalone.js +1 -1
  15. package/package.json +8 -8
  16. package/report/renderer/report-utils.js +1 -1
  17. package/shared/localization/locales/ar-XB.json +45 -3
  18. package/shared/localization/locales/ar.json +45 -3
  19. package/shared/localization/locales/bg.json +45 -3
  20. package/shared/localization/locales/ca.json +45 -3
  21. package/shared/localization/locales/cs.json +45 -3
  22. package/shared/localization/locales/da.json +52 -10
  23. package/shared/localization/locales/de.json +45 -3
  24. package/shared/localization/locales/el.json +45 -3
  25. package/shared/localization/locales/en-GB.json +45 -3
  26. package/shared/localization/locales/en-US.json +1 -1
  27. package/shared/localization/locales/en-XA.json +45 -3
  28. package/shared/localization/locales/en-XL.json +1 -1
  29. package/shared/localization/locales/es-419.json +45 -3
  30. package/shared/localization/locales/es.json +45 -3
  31. package/shared/localization/locales/fi.json +45 -3
  32. package/shared/localization/locales/fil.json +45 -3
  33. package/shared/localization/locales/fr.json +48 -6
  34. package/shared/localization/locales/he.json +45 -3
  35. package/shared/localization/locales/hi.json +45 -3
  36. package/shared/localization/locales/hr.json +45 -3
  37. package/shared/localization/locales/hu.json +45 -3
  38. package/shared/localization/locales/id.json +45 -3
  39. package/shared/localization/locales/it.json +45 -3
  40. package/shared/localization/locales/ja.json +45 -3
  41. package/shared/localization/locales/ko.json +45 -3
  42. package/shared/localization/locales/lt.json +45 -3
  43. package/shared/localization/locales/lv.json +45 -3
  44. package/shared/localization/locales/nl.json +45 -3
  45. package/shared/localization/locales/no.json +45 -3
  46. package/shared/localization/locales/pl.json +45 -3
  47. package/shared/localization/locales/pt-PT.json +45 -3
  48. package/shared/localization/locales/pt.json +50 -8
  49. package/shared/localization/locales/ro.json +45 -3
  50. package/shared/localization/locales/ru.json +45 -3
  51. package/shared/localization/locales/sk.json +45 -3
  52. package/shared/localization/locales/sl.json +45 -3
  53. package/shared/localization/locales/sr-Latn.json +45 -3
  54. package/shared/localization/locales/sr.json +45 -3
  55. package/shared/localization/locales/sv.json +45 -3
  56. package/shared/localization/locales/ta.json +45 -3
  57. package/shared/localization/locales/te.json +45 -3
  58. package/shared/localization/locales/th.json +46 -4
  59. package/shared/localization/locales/tr.json +46 -4
  60. package/shared/localization/locales/uk.json +45 -3
  61. package/shared/localization/locales/vi.json +45 -3
  62. package/shared/localization/locales/zh-HK.json +45 -3
  63. package/shared/localization/locales/zh-TW.json +45 -3
  64. package/shared/localization/locales/zh.json +49 -7
  65. package/types/artifacts.d.ts +4 -3
  66. package/types/internal/rxjs.d.ts +4 -0
  67. package/types/trace-engine.d.ts +0 -1516
@@ -1,1516 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2023 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- import {Protocol} from 'devtools-protocol';
8
- import {TraceEvent} from './artifacts.js';
9
-
10
- // This part is just the subset of types we need for the main API.
11
-
12
- type LayoutShiftTraceEvent = TraceEvent & {
13
- args: {data: {
14
- impacted_nodes: TraceImpactedNode[],
15
- weighted_score_delta: number;
16
- }},
17
- }
18
-
19
- export class TraceProcessor {
20
- constructor(handlers: any);
21
- createWithAllHandlers(): TraceProcessor;
22
- parse(traceEvents: any[]): Promise<void>;
23
- data: {
24
- LayoutShifts: {
25
- clusters: Array<{
26
- events: LayoutShiftTraceEvent[];
27
- }>;
28
- sessionMaxScore: number;
29
- };
30
- };
31
- }
32
-
33
- export const TraceHandlers: Record<string, any>;
34
-
35
- interface CSSDimensions {
36
- width?: string;
37
- height?: string;
38
- aspectRatio?: string;
39
- }
40
-
41
- type RootCauseRequest = {
42
- request: TraceEventSyntheticNetworkRequest;
43
- initiator?: Protocol.Network.Initiator;
44
- }
45
-
46
- export type LayoutShiftRootCauses = {
47
- fontChanges: Array<RootCauseRequest & {fontFace: Protocol.CSS.FontFace}>;
48
- iframes: Array<{
49
- iframe: Protocol.DOM.Node;
50
- }>;
51
- renderBlockingRequests: Array<RootCauseRequest>;
52
- unsizedMedia: Array<{
53
- node: Protocol.DOM.Node;
54
- authoredDimensions?: CSSDimensions;
55
- computedDimensions: CSSDimensions;
56
- }>;
57
- };
58
-
59
- export class RootCauses {
60
- constructor(protocolInterface: any);
61
-
62
- layoutShifts: {rootCausesForEvent(data: any, event: any): Promise<LayoutShiftRootCauses>};
63
- }
64
-
65
- // The rest of this file is pulled from CDT frontend
66
- // https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/models/trace/types/TraceEvents.ts;l=297?q=TraceEventSyntheticNetworkRequest&ss=chromium
67
-
68
- // Copyright 2022 The Chromium Authors. All rights reserved.
69
- // Use of this source code is governed by a BSD-style license that can be
70
- // found in the LICENSE file.
71
-
72
- export type MicroSeconds = number&{_tag: 'MicroSeconds'};
73
-
74
- export type MilliSeconds = number&{_tag: 'MilliSeconds'};
75
- export type Seconds = number&{_tag: 'Seconds'};
76
-
77
- export const enum TimeUnit {
78
- MICROSECONDS = 0,
79
- MILLISECONDS = 1,
80
- SECONDS = 2,
81
- MINUTES = 3,
82
- }
83
-
84
- // Other types.
85
-
86
- export interface TraceWindow<TimeFormat extends MicroSeconds|MilliSeconds> {
87
- min: TimeFormat;
88
- max: TimeFormat;
89
- range: TimeFormat;
90
- }
91
-
92
- export type TraceWindowMicroSeconds = TraceWindow<MicroSeconds>;
93
- export type TraceWindowMilliSeconds = TraceWindow<MilliSeconds>;
94
-
95
- // Trace Events.
96
- export const enum Phase {
97
- // Standard
98
- BEGIN = 'B',
99
- END = 'E',
100
- COMPLETE = 'X',
101
- INSTANT = 'I',
102
- COUNTER = 'C',
103
-
104
- // Async
105
- ASYNC_NESTABLE_START = 'b',
106
- ASYNC_NESTABLE_INSTANT = 'n',
107
- ASYNC_NESTABLE_END = 'e',
108
- ASYNC_STEP_INTO = 'T',
109
- ASYNC_BEGIN = 'S',
110
- ASYNC_END = 'F',
111
- ASYNC_STEP_PAST = 'p',
112
-
113
- // Flow
114
- FLOW_START = 's',
115
- FLOW_STEP = 't',
116
- FLOW_END = 'f',
117
-
118
- // Sample
119
- SAMPLE = 'P',
120
-
121
- // Object
122
- OBJECT_CREATED = 'N',
123
- OBJECT_SNAPSHOT = 'O',
124
- OBJECT_DESTROYED = 'D',
125
-
126
- // Metadata
127
- METADATA = 'M',
128
-
129
- // Memory Dump
130
- MEMORY_DUMP_GLOBAL = 'V',
131
- MEMORY_DUMP_PROCESS = 'v',
132
-
133
- // Mark
134
- MARK = 'R',
135
-
136
- // Clock sync
137
- CLOCK_SYNC = 'c',
138
- }
139
-
140
- export const enum TraceEventScope {
141
- THREAD = 't',
142
- PROCESS = 'p',
143
- GLOBAL = 'g',
144
- }
145
-
146
- export interface TraceEventData {
147
- args?: TraceEventArgs;
148
- cat: string;
149
- name: string;
150
- ph: Phase;
151
- pid: ProcessID;
152
- tid: ThreadID;
153
- tts?: MicroSeconds;
154
- ts: MicroSeconds;
155
- tdur?: MicroSeconds;
156
- dur?: MicroSeconds;
157
- }
158
-
159
- export interface TraceEventArgs {
160
- data?: TraceEventArgsData;
161
- }
162
-
163
- export interface TraceEventArgsData {
164
- stackTrace?: TraceEventCallFrame[];
165
- navigationId?: string;
166
- frame?: string;
167
- }
168
-
169
- export interface TraceEventCallFrame {
170
- codeType?: string;
171
- functionName: string;
172
- scriptId: number;
173
- columnNumber: number;
174
- lineNumber: number;
175
- url: string;
176
- }
177
-
178
- export interface TraceFrame {
179
- frame: string;
180
- name: string;
181
- processId: ProcessID;
182
- url: string;
183
- parent?: string;
184
- }
185
-
186
- // Sample events.
187
-
188
- export interface TraceEventSample extends TraceEventData {
189
- ph: Phase.SAMPLE;
190
- }
191
-
192
- /**
193
- * A fake trace event created to support CDP.Profiler.Profiles in the
194
- * trace engine.
195
- */
196
- export interface SyntheticTraceEventCpuProfile extends TraceEventInstant {
197
- name: 'CpuProfile';
198
- args: TraceEventArgs&{
199
- data: TraceEventArgsData & {
200
- cpuProfile: Protocol.Profiler.Profile,
201
- },
202
- };
203
- }
204
-
205
- export interface TraceEventProfile extends TraceEventSample {
206
- name: 'Profile';
207
- id: ProfileID;
208
- args: TraceEventArgs&{
209
- data: TraceEventArgsData & {
210
- startTime: MicroSeconds,
211
- },
212
- };
213
- }
214
-
215
- export interface TraceEventProfileChunk extends TraceEventSample {
216
- name: 'ProfileChunk';
217
- id: ProfileID;
218
- args: TraceEventArgs&{
219
- // `data` is only missing in "fake" traces
220
- data?: TraceEventArgsData & {
221
- cpuProfile?: TraceEventPartialProfile,
222
- timeDeltas?: MicroSeconds[],
223
- lines?: MicroSeconds[],
224
- },
225
- };
226
- }
227
-
228
- export interface TraceEventPartialProfile {
229
- nodes?: TraceEventPartialNode[];
230
- samples: CallFrameID[];
231
- }
232
-
233
- export interface TraceEventPartialNode {
234
- callFrame: TraceEventCallFrame;
235
- id: CallFrameID;
236
- parent?: CallFrameID;
237
- }
238
-
239
- // Complete events.
240
-
241
- export interface TraceEventComplete extends TraceEventData {
242
- ph: Phase.COMPLETE;
243
- dur: MicroSeconds;
244
- }
245
-
246
- export interface TraceEventFireIdleCallback extends TraceEventComplete {
247
- name: KnownEventName.FireIdleCallback;
248
- args: TraceEventArgs&{
249
- data: TraceEventArgsData & {
250
- allottedMilliseconds: MilliSeconds,
251
- frame: string,
252
- id: number,
253
- timedOut: boolean,
254
- },
255
- };
256
- }
257
-
258
- export interface TraceEventDispatch extends TraceEventComplete {
259
- name: 'EventDispatch';
260
- args: TraceEventArgs&{
261
- data: TraceEventArgsData & {
262
- type: string,
263
- },
264
- };
265
- }
266
-
267
- export interface TraceEventParseHTML extends TraceEventComplete {
268
- name: 'ParseHTML';
269
- args: TraceEventArgs&{
270
- beginData: {
271
- frame: string,
272
- startLine: number,
273
- url: string,
274
- },
275
- endData?: {
276
- endLine: number,
277
- },
278
- };
279
- }
280
-
281
- export interface TraceEventBegin extends TraceEventData {
282
- ph: Phase.BEGIN;
283
- }
284
-
285
- export interface TraceEventEnd extends TraceEventData {
286
- ph: Phase.END;
287
- }
288
-
289
- /**
290
- * This denotes a complete event created from a pair of begin and end
291
- * events. For practicality, instead of always having to look for the
292
- * end event corresponding to a begin event, we create a synthetic
293
- * complete event that comprises the data of both from the beginning in
294
- * the RendererHandler.
295
- */
296
- export type TraceEventSyntheticCompleteEvent = TraceEventComplete;
297
-
298
- export interface TraceEventEventTiming extends TraceEventData {
299
- ph: Phase.ASYNC_NESTABLE_START|Phase.ASYNC_NESTABLE_END;
300
- name: KnownEventName.EventTiming;
301
- id: string;
302
- args: TraceEventArgs&{
303
- frame: string,
304
- data?: TraceEventArgsData&{
305
- cancelable: boolean,
306
- duration: MilliSeconds,
307
- processingEnd: MilliSeconds,
308
- processingStart: MilliSeconds,
309
- timeStamp: MilliSeconds,
310
- interactionId?: number, type: string,
311
- },
312
- };
313
- }
314
-
315
- export interface TraceEventEventTimingBegin extends TraceEventEventTiming {
316
- ph: Phase.ASYNC_NESTABLE_START;
317
- }
318
- export interface TraceEventEventTimingEnd extends TraceEventEventTiming {
319
- ph: Phase.ASYNC_NESTABLE_END;
320
- }
321
-
322
- export interface TraceEventGPUTask extends TraceEventComplete {
323
- name: 'GPUTask';
324
- args: TraceEventArgs&{
325
- data?: TraceEventArgsData & {
326
- /* eslint-disable @typescript-eslint/naming-convention */
327
- renderer_pid: ProcessID,
328
- used_bytes: number,
329
- /* eslint-enable @typescript-eslint/naming-convention */
330
- },
331
- };
332
- }
333
-
334
- export interface TraceEventSyntheticNetworkRedirect {
335
- url: string;
336
- priority: string;
337
- requestMethod?: string;
338
- ts: MicroSeconds;
339
- dur: MicroSeconds;
340
- }
341
-
342
- // TraceEventProcessedArgsData is used to store the processed data of a network
343
- // request. Which is used to distinguish from the date we extract from the
344
- // trace event directly.
345
- interface TraceEventSyntheticArgsData {
346
- dnsLookup: MicroSeconds;
347
- download: MicroSeconds;
348
- downloadStart: MicroSeconds;
349
- finishTime: MicroSeconds;
350
- initialConnection: MicroSeconds;
351
- isDiskCached: boolean;
352
- isHttps: boolean;
353
- isMemoryCached: boolean;
354
- isPushedResource: boolean;
355
- networkDuration: MicroSeconds;
356
- processingDuration: MicroSeconds;
357
- proxyNegotiation: MicroSeconds;
358
- queueing: MicroSeconds;
359
- redirectionDuration: MicroSeconds;
360
- requestSent: MicroSeconds;
361
- sendStartTime: MicroSeconds;
362
- ssl: MicroSeconds;
363
- stalled: MicroSeconds;
364
- totalTime: MicroSeconds;
365
- waiting: MicroSeconds;
366
- }
367
-
368
- export interface TraceEventSyntheticNetworkRequest extends TraceEventComplete {
369
- args: TraceEventArgs&{
370
- data: TraceEventArgsData & {
371
- syntheticData: TraceEventSyntheticArgsData,
372
- // All fields below are from TraceEventsForNetworkRequest,
373
- // Required fields
374
- decodedBodyLength: number,
375
- encodedDataLength: number,
376
- frame: string,
377
- fromServiceWorker: boolean,
378
- host: string,
379
- mimeType: string,
380
- pathname: string,
381
- search: string,
382
- priority: Priority,
383
- initialPriority: Priority,
384
- protocol: string,
385
- redirects: TraceEventSyntheticNetworkRedirect[],
386
- renderBlocking: RenderBlocking,
387
- requestId: string,
388
- requestingFrameUrl: string,
389
- statusCode: number,
390
- url: string,
391
- // Optional fields
392
- requestMethod?: string,
393
- timing?: TraceEventResourceReceiveResponseTimingData,
394
- },
395
- };
396
- cat: 'loading';
397
- name: 'SyntheticNetworkRequest';
398
- ph: Phase.COMPLETE;
399
- dur: MicroSeconds;
400
- tdur: MicroSeconds;
401
- ts: MicroSeconds;
402
- tts: MicroSeconds;
403
- pid: ProcessID;
404
- tid: ThreadID;
405
- }
406
-
407
- export const enum AuctionWorkletType {
408
- BIDDER = 'bidder',
409
- SELLER = 'seller',
410
- // Not expected to be used, but here as a fallback in case new types get
411
- // added and we have yet to update the trace engine.
412
- UNKNOWN = 'unknown',
413
- }
414
-
415
- export interface SyntheticAuctionWorkletEvent extends TraceEventInstant {
416
- name: 'SyntheticAuctionWorkletEvent';
417
- // The PID that the AuctionWorklet is running in.
418
- pid: ProcessID;
419
- // URL
420
- host: string;
421
- // An ID used to pair up runningInProcessEvents with doneWithProcessEvents
422
- target: string;
423
- type: AuctionWorkletType;
424
- args: TraceEventArgs&{
425
- data: TraceEventArgsData & {
426
- // There are two threads for a worklet that we care about, so we gather
427
- // the thread_name events so we can know the PID and TID for them (and
428
- // hence display the right events in the track for each thread)
429
- utilityThread: TraceEventThreadName,
430
- v8HelperThread: TraceEventThreadName,
431
- } &
432
- (
433
- // This type looks odd, but this is because these events could either have:
434
- // 1. Just the DoneWithProcess event
435
- // 2. Just the RunningInProcess event
436
- // 3. Both events
437
- // But crucially it cannot have both events missing, hence listing all the
438
- // allowed cases.
439
- // Clang is disabled as the combination of nested types and optional
440
- // properties cause it to weirdly indent some of the properties and make it
441
- // very unreadable.
442
- // clang-format off
443
- {
444
- runningInProcessEvent: TraceEventAuctionWorkletRunningInProcess,
445
- doneWithProcessEvent: TraceEventAuctionWorkletDoneWithProcess,
446
- } |
447
- {
448
- runningInProcessEvent?: TraceEventAuctionWorkletRunningInProcess,
449
- doneWithProcessEvent: TraceEventAuctionWorkletDoneWithProcess,
450
- } |
451
- {
452
- doneWithProcessEvent?: TraceEventAuctionWorkletDoneWithProcess,
453
- runningInProcessEvent: TraceEventAuctionWorkletRunningInProcess,
454
-
455
- }),
456
- // clang-format on
457
- };
458
- }
459
- export interface TraceEventAuctionWorkletRunningInProcess extends TraceEventData {
460
- name: 'AuctionWorkletRunningInProcess';
461
- ph: Phase.INSTANT;
462
- args: TraceEventArgs&{
463
- data: TraceEventArgsData & {
464
- host: string,
465
- pid: ProcessID,
466
- target: string,
467
- type: AuctionWorkletType,
468
- },
469
- };
470
- }
471
- export interface TraceEventAuctionWorkletDoneWithProcess extends TraceEventData {
472
- name: 'AuctionWorkletDoneWithProcess';
473
- ph: Phase.INSTANT;
474
- args: TraceEventArgs&{
475
- data: TraceEventArgsData & {
476
- host: string,
477
- pid: ProcessID,
478
- target: string,
479
- type: AuctionWorkletType,
480
- },
481
- };
482
- }
483
-
484
- // Snapshot events.
485
-
486
- export interface TraceEventSnapshot extends TraceEventData {
487
- args: TraceEventArgs&{
488
- snapshot: string,
489
- };
490
- name: 'Screenshot';
491
- cat: 'disabled-by-default-devtools.screenshot';
492
- ph: Phase.OBJECT_SNAPSHOT|Phase.INSTANT; // In Oct 2023, the phase was changed to Instant. crbug.com/798755
493
- }
494
-
495
- // Animation events.
496
-
497
- export interface TraceEventAnimation extends TraceEventData {
498
- args: TraceEventArgs&{
499
- id?: string,
500
- name?: string,
501
- nodeId?: number,
502
- nodeName?: string,
503
- state?: string,
504
- compositeFailed?: number,
505
- unsupportedProperties?: string[],
506
- };
507
- name: 'Animation';
508
- id2?: {
509
- local?: string,
510
- };
511
- ph: Phase.ASYNC_NESTABLE_START|Phase.ASYNC_NESTABLE_END;
512
- }
513
-
514
- // Metadata events.
515
-
516
- export interface TraceEventMetadata extends TraceEventData {
517
- ph: Phase.METADATA;
518
- args: TraceEventArgs&{
519
- name?: string,
520
- uptime?: string,
521
- };
522
- }
523
-
524
- export interface TraceEventThreadName extends TraceEventMetadata {
525
- name: KnownEventName.ThreadName;
526
- args: TraceEventArgs&{
527
- name?: string,
528
- };
529
- }
530
-
531
- export interface TraceEventProcessName extends TraceEventMetadata {
532
- name: 'process_name';
533
- }
534
-
535
- // Mark events.
536
-
537
- export interface TraceEventMark extends TraceEventData {
538
- ph: Phase.MARK;
539
- }
540
-
541
- export interface TraceEventNavigationStart extends TraceEventMark {
542
- name: 'navigationStart';
543
- args: TraceEventArgs&{
544
- data?: TraceEventArgsData & {
545
- documentLoaderURL: string,
546
- isLoadingMainFrame: boolean,
547
- // isOutermostMainFrame was introduced in crrev.com/c/3625434 and exists
548
- // because of Fenced Frames
549
- // [github.com/WICG/fenced-frame/tree/master/explainer].
550
- // Fenced frames introduce a situation where isLoadingMainFrame could be
551
- // true for a navigation, but that navigation be within an embedded "main
552
- // frame", and therefore it wouldn't be on the top level main frame.
553
- // In situations where we need to distinguish that, we can rely on
554
- // isOutermostMainFrame, which will only be true for navigations on the
555
- // top level main frame.
556
-
557
- // This flag is optional as it was introduced in May 2022; so users
558
- // reasonably may import traces from before that date that do not have
559
- // this field present.
560
- isOutermostMainFrame?: boolean, navigationId: string,
561
- },
562
- frame: string,
563
- };
564
- }
565
-
566
- export interface TraceEventFirstContentfulPaint extends TraceEventMark {
567
- name: 'firstContentfulPaint';
568
- args: TraceEventArgs&{
569
- frame: string,
570
- data?: TraceEventArgsData&{
571
- navigationId: string,
572
- },
573
- };
574
- }
575
-
576
- export interface TraceEventFirstPaint extends TraceEventMark {
577
- name: 'firstPaint';
578
- args: TraceEventArgs&{
579
- frame: string,
580
- data?: TraceEventArgsData&{
581
- navigationId: string,
582
- },
583
- };
584
- }
585
-
586
- export type PageLoadEvent = TraceEventFirstContentfulPaint|TraceEventMarkDOMContent|TraceEventInteractiveTime|
587
- TraceEventLargestContentfulPaintCandidate|TraceEventLayoutShift|TraceEventFirstPaint|TraceEventMarkLoad|
588
- TraceEventNavigationStart;
589
-
590
- export interface TraceEventLargestContentfulPaintCandidate extends TraceEventMark {
591
- name: 'largestContentfulPaint::Candidate';
592
- args: TraceEventArgs&{
593
- frame: string,
594
- data?: TraceEventArgsData&{
595
- candidateIndex: number,
596
- isOutermostMainFrame: boolean,
597
- isMainFrame: boolean,
598
- navigationId: string,
599
- nodeId: Protocol.DOM.BackendNodeId,
600
- type?: string,
601
- },
602
- };
603
- }
604
- export interface TraceEventLargestImagePaintCandidate extends TraceEventMark {
605
- name: 'LargestImagePaint::Candidate';
606
- args: TraceEventArgs&{
607
- frame: string,
608
- data?: TraceEventArgsData&{
609
- candidateIndex: number,
610
- imageUrl: string,
611
- // eslint-disable-next-line @typescript-eslint/naming-convention
612
- DOMNodeId: Protocol.DOM.BackendNodeId,
613
- },
614
- };
615
- }
616
- export interface TraceEventLargestTextPaintCandidate extends TraceEventMark {
617
- name: 'LargestTextPaint::Candidate';
618
- args: TraceEventArgs&{
619
- frame: string,
620
- data?: TraceEventArgsData&{
621
- candidateIndex: number,
622
- // eslint-disable-next-line @typescript-eslint/naming-convention
623
- DOMNodeId: Protocol.DOM.BackendNodeId,
624
- },
625
- };
626
- }
627
-
628
- export interface TraceEventInteractiveTime extends TraceEventMark {
629
- name: 'InteractiveTime';
630
- args: TraceEventArgs&{
631
- args: {
632
- // eslint-disable-next-line @typescript-eslint/naming-convention
633
- total_blocking_time_ms: number,
634
- },
635
- frame: string,
636
- };
637
- }
638
-
639
- // Instant events.
640
-
641
- export interface TraceEventInstant extends TraceEventData {
642
- ph: Phase.INSTANT;
643
- s: TraceEventScope;
644
- }
645
-
646
- export interface TraceEventUpdateCounters extends TraceEventInstant {
647
- name: 'UpdateCounters';
648
- args: TraceEventArgs&{
649
- data: TraceEventArgsData & {
650
- documents: number,
651
- jsEventListeners: number,
652
- jsHeapSizeUsed: number,
653
- nodes: number,
654
- gpuMemoryLimitKB?: number,
655
- },
656
- };
657
- }
658
-
659
- export type TraceEventRendererEvent = TraceEventInstant|TraceEventComplete;
660
-
661
- export interface TraceEventTracingStartedInBrowser extends TraceEventInstant {
662
- name: KnownEventName.TracingStartedInBrowser;
663
- args: TraceEventArgs&{
664
- data?: TraceEventArgsData & {
665
- frameTreeNodeId: number,
666
- // Frames can only missing in "fake" traces
667
- frames?: TraceFrame[], persistentIds: boolean,
668
- },
669
- };
670
- }
671
-
672
- export interface TraceEventTracingSessionIdForWorker extends TraceEventInstant {
673
- name: 'TracingSessionIdForWorker';
674
- args: TraceEventArgs&{
675
- data?: TraceEventArgsData & {
676
- url: string,
677
- workerId: WorkerId,
678
- workerThreadId: ThreadID,
679
- frame: string,
680
- },
681
- };
682
- }
683
-
684
- export interface TraceEventFrameCommittedInBrowser extends TraceEventInstant {
685
- name: 'FrameCommittedInBrowser';
686
- args: TraceEventArgs&{
687
- data?: TraceEventArgsData & TraceFrame,
688
- };
689
- }
690
-
691
- export interface TraceEventMainFrameViewport extends TraceEventInstant {
692
- name: 'PaintTimingVisualizer::Viewport';
693
- args: {
694
- data: TraceEventArgsData&{
695
- // eslint-disable-next-line @typescript-eslint/naming-convention
696
- viewport_rect: number[],
697
- },
698
- };
699
- }
700
-
701
- export interface TraceEventCommitLoad extends TraceEventInstant {
702
- name: 'CommitLoad';
703
- args: TraceEventArgs&{
704
- data?: TraceEventArgsData & {
705
- frame: string,
706
- isMainFrame: boolean,
707
- name: string,
708
- nodeId: number,
709
- page: string,
710
- parent: string,
711
- url: string,
712
- },
713
- };
714
- }
715
-
716
- export interface TraceEventMarkDOMContent extends TraceEventInstant {
717
- name: 'MarkDOMContent';
718
- args: TraceEventArgs&{
719
- data?: TraceEventArgsData & {
720
- frame: string,
721
- isMainFrame: boolean,
722
- page: string,
723
- },
724
- };
725
- }
726
-
727
- export interface TraceEventMarkLoad extends TraceEventInstant {
728
- name: 'MarkLoad';
729
- args: TraceEventArgs&{
730
- data?: TraceEventArgsData & {
731
- frame: string,
732
- isMainFrame: boolean,
733
- page: string,
734
- },
735
- };
736
- }
737
-
738
- export interface TraceEventAsync extends TraceEventData {
739
- ph: Phase.ASYNC_NESTABLE_START|Phase.ASYNC_NESTABLE_INSTANT|Phase.ASYNC_NESTABLE_END|Phase.ASYNC_STEP_INTO|
740
- Phase.ASYNC_BEGIN|Phase.ASYNC_END|Phase.ASYNC_STEP_PAST;
741
- }
742
-
743
- export type TraceRect = [number, number, number, number];
744
- export type TraceImpactedNode = {
745
- // These keys come from the trace data, so we have to use underscores.
746
- /* eslint-disable @typescript-eslint/naming-convention */
747
- new_rect: TraceRect,
748
- node_id: Protocol.DOM.BackendNodeId,
749
- old_rect: TraceRect,
750
- /* eslint-enable @typescript-eslint/naming-convention */
751
- };
752
-
753
- type LayoutShiftData = TraceEventArgsData&{
754
- // These keys come from the trace data, so we have to use underscores.
755
- /* eslint-disable @typescript-eslint/naming-convention */
756
- cumulative_score: number,
757
- frame_max_distance: number,
758
- had_recent_input: boolean,
759
- impacted_nodes: TraceImpactedNode[] | undefined,
760
- is_main_frame: boolean,
761
- overall_max_distance: number,
762
- region_rects: TraceRect[],
763
- score: number,
764
- weighted_score_delta: number,
765
- /* eslint-enable @typescript-eslint/naming-convention */
766
- };
767
- // These keys come from the trace data, so we have to use underscores.
768
- export interface TraceEventLayoutShift extends TraceEventInstant {
769
- name: 'LayoutShift';
770
- normalized?: boolean;
771
- args: TraceEventArgs&{
772
- frame: string,
773
- data?: LayoutShiftData,
774
- };
775
- }
776
-
777
- interface LayoutShiftSessionWindowData {
778
- // The sum of the weighted score of all the shifts
779
- // that belong to a session window.
780
- cumulativeWindowScore: number;
781
- // A consecutive generated in the frontend to
782
- // to identify a session window.
783
- id: number;
784
- }
785
- export interface LayoutShiftParsedData {
786
- screenshotSource?: string;
787
- timeFromNavigation?: MicroSeconds;
788
- // The sum of the weighted scores of the shifts that
789
- // belong to a session window up until this shift
790
- // (inclusive).
791
- cumulativeWeightedScoreInWindow: number;
792
- sessionWindowData: LayoutShiftSessionWindowData;
793
- }
794
- export interface SyntheticLayoutShift extends TraceEventLayoutShift {
795
- args: TraceEventArgs&{
796
- frame: string,
797
- data?: LayoutShiftData&{
798
- rawEvent: TraceEventLayoutShift,
799
- },
800
- };
801
- parsedData: LayoutShiftParsedData;
802
- }
803
-
804
- export type Priority = 'Low'|'High'|'Medium'|'VeryHigh'|'Highest';
805
- export type RenderBlocking = 'blocking'|'non_blocking'|'in_body_parser_blocking'|'potentially_blocking';
806
- export interface TraceEventResourceSendRequest extends TraceEventInstant {
807
- name: 'ResourceSendRequest';
808
- args: TraceEventArgs&{
809
- data: TraceEventArgsData & {
810
- frame: string,
811
- requestId: string,
812
- url: string,
813
- priority: Priority,
814
- // TODO(crbug.com/1457985): change requestMethod to enum when confirm in the backend code.
815
- requestMethod?: string,
816
- renderBlocking?: RenderBlocking,
817
- },
818
- };
819
- }
820
-
821
- export interface TraceEventResourceChangePriority extends TraceEventInstant {
822
- name: 'ResourceChangePriority';
823
- args: TraceEventArgs&{
824
- data: TraceEventArgsData & {
825
- requestId: string,
826
- priority: Priority,
827
- },
828
- };
829
- }
830
-
831
- export interface TraceEventResourceWillSendRequest extends TraceEventInstant {
832
- name: 'ResourceWillSendRequest';
833
- args: TraceEventArgs&{
834
- data: TraceEventArgsData & {
835
- requestId: string,
836
- },
837
- };
838
- }
839
-
840
- export interface TraceEventResourceFinish extends TraceEventInstant {
841
- name: 'ResourceFinish';
842
- args: TraceEventArgs&{
843
- data: TraceEventArgsData & {
844
- decodedBodyLength: number,
845
- didFail: boolean,
846
- encodedDataLength: number,
847
- finishTime: Seconds,
848
- requestId: string,
849
- },
850
- };
851
- }
852
-
853
- export interface TraceEventResourceReceivedData extends TraceEventInstant {
854
- name: 'ResourceReceivedData';
855
- args: TraceEventArgs&{
856
- data: TraceEventArgsData & {
857
- encodedDataLength: number,
858
- frame: string,
859
- requestId: string,
860
- },
861
- };
862
- }
863
-
864
- interface TraceEventResourceReceiveResponseTimingData {
865
- connectEnd: MilliSeconds;
866
- connectStart: MilliSeconds;
867
- dnsEnd: MilliSeconds;
868
- dnsStart: MilliSeconds;
869
- proxyEnd: MilliSeconds;
870
- proxyStart: MilliSeconds;
871
- pushEnd: MilliSeconds;
872
- pushStart: MilliSeconds;
873
- receiveHeadersEnd: MilliSeconds;
874
- requestTime: Seconds;
875
- sendEnd: MilliSeconds;
876
- sendStart: MilliSeconds;
877
- sslEnd: MilliSeconds;
878
- sslStart: MilliSeconds;
879
- workerReady: MilliSeconds;
880
- workerStart: MilliSeconds;
881
- }
882
-
883
- export interface TraceEventResourceReceiveResponse extends TraceEventInstant {
884
- name: 'ResourceReceiveResponse';
885
- args: TraceEventArgs&{
886
- data: TraceEventArgsData & {
887
- encodedDataLength: number,
888
- frame: string,
889
- fromCache: boolean,
890
- fromServiceWorker: boolean,
891
- mimeType: string,
892
- requestId: string,
893
- responseTime: MilliSeconds,
894
- statusCode: number,
895
- timing: TraceEventResourceReceiveResponseTimingData,
896
- },
897
- };
898
- }
899
-
900
- export interface TraceEventResourceMarkAsCached extends TraceEventInstant {
901
- name: 'ResourceMarkAsCached';
902
- args: TraceEventArgs&{
903
- data: TraceEventArgsData & {
904
- requestId: string,
905
- },
906
- };
907
- }
908
-
909
- export const enum LayoutInvalidationReason {
910
- SIZE_CHANGED = 'Size changed',
911
- ATTRIBUTE = 'Attribute',
912
- ADDED_TO_LAYOUT = 'Added to layout',
913
- SCROLLBAR_CHANGED = 'Scrollbar changed',
914
- REMOVED_FROM_LAYOUT = 'Removed from layout',
915
- STYLE_CHANGED = 'Style changed',
916
- FONTS_CHANGED = 'Fonts changed',
917
- UNKNOWN = 'Unknown',
918
- }
919
-
920
- export interface TraceEventLayoutInvalidationTracking extends TraceEventInstant {
921
- name: KnownEventName.LayoutInvalidationTracking;
922
- args: TraceEventArgs&{
923
- data: TraceEventArgsData & {
924
- frame: string,
925
- nodeId: Protocol.DOM.BackendNodeId,
926
- reason: LayoutInvalidationReason,
927
- nodeName?: string,
928
- },
929
- };
930
- }
931
-
932
- export interface TraceEventScheduleStyleInvalidationTracking extends TraceEventInstant {
933
- name: KnownEventName.ScheduleStyleInvalidationTracking;
934
- args: TraceEventArgs&{
935
- data: TraceEventArgsData & {
936
- frame: string,
937
- nodeId: Protocol.DOM.BackendNodeId,
938
- invalidationSet?: string,
939
- invalidatedSelectorId?: string,
940
- reason?: LayoutInvalidationReason,
941
- changedClass?: string,
942
- nodeName?: string,
943
- stackTrace?: TraceEventCallFrame[],
944
- },
945
- };
946
- }
947
-
948
- export const enum StyleRecalcInvalidationReason {
949
- ANIMATION = 'Animation',
950
- }
951
-
952
- export interface TraceEventStyleRecalcInvalidation extends TraceEventInstant {
953
- name: 'StyleRecalcInvalidationTracking';
954
- args: TraceEventArgs&{
955
- data: TraceEventArgsData & {
956
- frame: string,
957
- nodeId: Protocol.DOM.BackendNodeId,
958
- reason: StyleRecalcInvalidationReason,
959
- subtree: boolean,
960
- nodeName?: string,
961
- extraData?: string,
962
- },
963
- };
964
- }
965
- export interface TraceEventScheduleStyleRecalculation extends TraceEventInstant {
966
- name: KnownEventName.ScheduleStyleRecalculation;
967
- args: TraceEventArgs&{
968
- data: {
969
- frame: string,
970
- },
971
- };
972
- }
973
- export interface TraceEventPrePaint extends TraceEventComplete {
974
- name: 'PrePaint';
975
- }
976
-
977
- export type TraceEventNestableAsync = TraceEventNestableAsyncBegin|TraceEventNestableAsyncEnd;
978
- export interface TraceEventNestableAsyncBegin extends TraceEventData {
979
- ph: Phase.ASYNC_NESTABLE_START;
980
- // The id2 field gives flexibility to explicitly specify if an event
981
- // id is global among processes or process local. However not all
982
- // events use it, so both kind of ids need to be marked as optional.
983
- id2?: {local?: string, global?: string};
984
- id?: string;
985
- }
986
-
987
- export interface TraceEventNestableAsyncEnd extends TraceEventData {
988
- ph: Phase.ASYNC_NESTABLE_END;
989
- id2?: {local?: string, global?: string};
990
- id?: string;
991
- }
992
-
993
- export type TraceEventAsyncPerformanceMeasure = TraceEventPerformanceMeasureBegin|TraceEventPerformanceMeasureEnd;
994
-
995
- export interface TraceEventPerformanceMeasureBegin extends TraceEventNestableAsyncBegin {
996
- cat: 'blink.user_timing';
997
- id: string;
998
- }
999
-
1000
- export interface TraceEventPerformanceMeasureEnd extends TraceEventNestableAsyncEnd {
1001
- cat: 'blink.user_timing';
1002
- id: string;
1003
- }
1004
-
1005
- export interface TraceEventConsoleTimeBegin extends TraceEventNestableAsyncBegin {
1006
- cat: 'blink.console';
1007
- id2: {
1008
- local: string,
1009
- };
1010
- }
1011
-
1012
- export interface TraceEventConsoleTimeEnd extends TraceEventNestableAsyncEnd {
1013
- cat: 'blink.console';
1014
- id2: {
1015
- local: string,
1016
- };
1017
- }
1018
-
1019
- export interface TraceEventTimeStamp extends TraceEventData {
1020
- cat: 'devtools.timeline';
1021
- name: 'TimeStamp';
1022
- ph: Phase.INSTANT;
1023
- id: string;
1024
- args: TraceEventArgs&{
1025
- data: TraceEventArgsData & {
1026
- frame: string,
1027
- message: string,
1028
- },
1029
- };
1030
- }
1031
-
1032
- export interface TraceEventPerformanceMark extends TraceEventData {
1033
- cat: 'blink.user_timing';
1034
- ph: Phase.INSTANT|Phase.MARK;
1035
- id: string;
1036
- }
1037
-
1038
- // Nestable async events with a duration are made up of two distinct
1039
- // events: the begin, and the end. We need both of them to be able to
1040
- // display the right information, so we create these synthetic events.
1041
- export interface TraceEventSyntheticNestableAsyncEvent extends TraceEventData {
1042
- id?: string;
1043
- id2?: {local?: string, global?: string};
1044
- dur: MicroSeconds;
1045
- args: TraceEventArgs&{
1046
- data: TraceEventArgsData & {
1047
- beginEvent: TraceEventNestableAsyncBegin,
1048
- endEvent: TraceEventNestableAsyncEnd,
1049
- },
1050
- };
1051
- }
1052
-
1053
- export interface TraceEventSyntheticUserTiming extends TraceEventSyntheticNestableAsyncEvent {
1054
- id: string;
1055
- dur: MicroSeconds;
1056
- args: TraceEventArgs&{
1057
- data: TraceEventArgsData & {
1058
- beginEvent: TraceEventPerformanceMeasureBegin,
1059
- endEvent: TraceEventPerformanceMeasureEnd,
1060
- },
1061
- };
1062
- }
1063
-
1064
- export interface TraceEventSyntheticConsoleTiming extends TraceEventSyntheticNestableAsyncEvent {
1065
- id2: {local: string};
1066
- dur: MicroSeconds;
1067
- args: TraceEventArgs&{
1068
- data: TraceEventArgsData & {
1069
- beginEvent: TraceEventConsoleTimeBegin,
1070
- endEvent: TraceEventConsoleTimeEnd,
1071
- },
1072
- };
1073
- }
1074
-
1075
- export interface SyntheticInteractionEvent extends TraceEventSyntheticNestableAsyncEvent {
1076
- // InteractionID and type are available within the beginEvent's data, but we
1077
- // put them on the top level for ease of access.
1078
- interactionId: number;
1079
- type: string;
1080
- // This is equivalent to startEvent.ts;
1081
- ts: MicroSeconds;
1082
- // This duration can be calculated via endEvent.ts - startEvent.ts, but we do
1083
- // that and put it here to make it easier. This also makes these events
1084
- // consistent with real events that have a dur field.
1085
- dur: MicroSeconds;
1086
- // These values are provided in the startEvent's args.data field as
1087
- // millisecond values, but during the handler phase we parse these into
1088
- // microseconds and put them on the top level for easy access.
1089
- processingStart: MicroSeconds;
1090
- processingEnd: MicroSeconds;
1091
- // These 3 values represent the breakdown of the parts of an interaction:
1092
- // 1. inputDelay: time from the user clicking to the input being handled
1093
- inputDelay: MicroSeconds;
1094
- // 2. mainThreadHandling: time spent processing the event handler
1095
- mainThreadHandling: MicroSeconds;
1096
- // 3. presentationDelay: delay between the event being processed and the frame being rendered
1097
- presentationDelay: MicroSeconds;
1098
- args: TraceEventArgs&{
1099
- data: TraceEventArgsData & {
1100
- beginEvent: TraceEventEventTimingBegin,
1101
- endEvent: TraceEventEventTimingEnd,
1102
- },
1103
- };
1104
- }
1105
-
1106
- /**
1107
- * An event created synthetically in the frontend that has a self time
1108
- * (the time spent running the task itself).
1109
- */
1110
- export interface SyntheticEventWithSelfTime extends TraceEventData {
1111
- selfTime?: MicroSeconds;
1112
- }
1113
-
1114
- /**
1115
- * A profile call created in the frontend from samples disguised as a
1116
- * trace event.
1117
- */
1118
- export interface TraceEventSyntheticProfileCall extends SyntheticEventWithSelfTime {
1119
- callFrame: Protocol.Runtime.CallFrame;
1120
- nodeId: Protocol.integer;
1121
- }
1122
-
1123
- /**
1124
- * A trace event augmented synthetically in the frontend to contain
1125
- * its self time.
1126
- */
1127
- export type SyntheticRendererEvent = TraceEventRendererEvent&SyntheticEventWithSelfTime;
1128
-
1129
- export type TraceEntry = SyntheticRendererEvent|TraceEventSyntheticProfileCall;
1130
-
1131
- // Events relating to frames.
1132
-
1133
- export interface TraceEventDrawFrame extends TraceEventInstant {
1134
- name: KnownEventName.DrawFrame;
1135
- args: TraceEventArgs&{
1136
- layerTreeId: number,
1137
- frameSeqId: number,
1138
- };
1139
- }
1140
-
1141
- export interface TraceEventLegacyDrawFrameBegin extends TraceEventAsync {
1142
- name: KnownEventName.DrawFrame;
1143
- ph: Phase.ASYNC_NESTABLE_START;
1144
- args: TraceEventArgs&{
1145
- layerTreeId: number,
1146
- frameSeqId: number,
1147
- };
1148
- }
1149
-
1150
- export interface TraceEventBeginFrame extends TraceEventInstant {
1151
- name: KnownEventName.BeginFrame;
1152
- args: TraceEventArgs&{
1153
- layerTreeId: number,
1154
- frameSeqId: number,
1155
- };
1156
- }
1157
-
1158
- export interface TraceEventDroppedFrame extends TraceEventInstant {
1159
- name: KnownEventName.DroppedFrame;
1160
- args: TraceEventArgs&{
1161
- layerTreeId: number,
1162
- frameSeqId: number,
1163
- hasPartialUpdate?: boolean,
1164
- };
1165
- }
1166
-
1167
- export interface TraceEventRequestMainThreadFrame extends TraceEventInstant {
1168
- name: KnownEventName.RequestMainThreadFrame;
1169
- args: TraceEventArgs&{
1170
- layerTreeId: number,
1171
- };
1172
- }
1173
-
1174
- export interface TraceEventBeginMainThreadFrame extends TraceEventInstant {
1175
- name: KnownEventName.BeginMainThreadFrame;
1176
- args: TraceEventArgs&{
1177
- layerTreeId: number,
1178
- data: TraceEventArgsData&{
1179
- frameId?: number,
1180
- },
1181
- };
1182
- }
1183
-
1184
- export interface TraceEventNeedsBeginFrameChanged extends TraceEventInstant {
1185
- name: KnownEventName.NeedsBeginFrameChanged;
1186
- args: TraceEventArgs&{
1187
- layerTreeId: number,
1188
- data: TraceEventArgsData&{
1189
- needsBeginFrame: number,
1190
- },
1191
- };
1192
- }
1193
-
1194
- export interface TraceEventCommit extends TraceEventInstant {
1195
- name: KnownEventName.Commit;
1196
- args: TraceEventArgs&{
1197
- layerTreeId: number,
1198
- frameSeqId: number,
1199
- };
1200
- }
1201
-
1202
- export interface TraceEventRasterTask extends TraceEventComplete {
1203
- name: KnownEventName.RasterTask;
1204
- args: TraceEventArgs&{
1205
- tileData?: {
1206
- layerId: number,
1207
- sourceFrameNumber: number,
1208
- tileId: {
1209
- // eslint-disable-next-line @typescript-eslint/naming-convention
1210
- id_ref: string,
1211
- },
1212
- tileResolution: string,
1213
- },
1214
- };
1215
- }
1216
-
1217
- // CompositeLayers has been replaced by "Commit", but we support both to not break old traces being imported.
1218
- export interface TraceEventCompositeLayers extends TraceEventInstant {
1219
- name: KnownEventName.CompositeLayers;
1220
- args: TraceEventArgs&{
1221
- layerTreeId: number,
1222
- };
1223
- }
1224
-
1225
- export interface TraceEventActivateLayerTree extends TraceEventInstant {
1226
- name: KnownEventName.ActivateLayerTree;
1227
- args: TraceEventArgs&{
1228
- layerTreeId: number,
1229
- frameId: number,
1230
- };
1231
- }
1232
-
1233
-
1234
- export interface TraceEventUpdateLayoutTree extends TraceEventComplete {
1235
- name: KnownEventName.UpdateLayoutTree;
1236
- args: TraceEventArgs&{
1237
- elementCount: number,
1238
- beginData?: {
1239
- frame: string,
1240
- },
1241
- };
1242
- }
1243
-
1244
- export interface TraceEventLayout extends TraceEventComplete {
1245
- name: KnownEventName.Layout;
1246
- args: TraceEventArgs&{
1247
- beginData: {
1248
- frame: string,
1249
- dirtyObjects: number,
1250
- partialLayout: boolean,
1251
- totalObjects: number,
1252
- },
1253
- endData: {
1254
- layoutRoots: Array<{
1255
- depth: number,
1256
- nodeId: Protocol.DOM.BackendNodeId,
1257
- quads: number[][],
1258
- }>,
1259
- },
1260
- };
1261
- }
1262
-
1263
-
1264
- export class ProfileIdTag {
1265
- readonly #profileIdTag: (symbol|undefined);
1266
- }
1267
- export type ProfileID = string&ProfileIdTag;
1268
-
1269
- export class CallFrameIdTag {
1270
- readonly #callFrameIdTag: (symbol|undefined);
1271
- }
1272
- export type CallFrameID = number&CallFrameIdTag;
1273
-
1274
-
1275
- export class ProcessIdTag {
1276
- readonly #processIdTag: (symbol|undefined);
1277
- }
1278
- export type ProcessID = number&ProcessIdTag;
1279
-
1280
-
1281
- export class ThreadIdTag {
1282
- readonly #threadIdTag: (symbol|undefined);
1283
- }
1284
- export type ThreadID = number&ThreadIdTag;
1285
-
1286
- export class WorkerIdTag {
1287
- readonly #workerIdTag: (symbol|undefined);
1288
- }
1289
- export type WorkerId = string&WorkerIdTag;
1290
-
1291
- /**
1292
- * This is an exhaustive list of events we track in the Performance
1293
- * panel. Note not all of them are necessarliry shown in the flame
1294
- * chart, some of them we only use for parsing.
1295
- * TODO(crbug.com/1428024): Complete this enum.
1296
- */
1297
- export const enum KnownEventName {
1298
- /* Metadata */
1299
- ThreadName = 'thread_name',
1300
-
1301
- /* Task */
1302
- Program = 'Program',
1303
- RunTask = 'RunTask',
1304
- AsyncTask = 'AsyncTask',
1305
- RunMicrotasks = 'RunMicrotasks',
1306
-
1307
- /* Load */
1308
- XHRLoad = 'XHRLoad',
1309
- XHRReadyStateChange = 'XHRReadyStateChange',
1310
- /* Parse */
1311
- ParseHTML = 'ParseHTML',
1312
- ParseCSS = 'ParseAuthorStyleSheet',
1313
- /* V8 */
1314
- CompileCode = 'V8.CompileCode',
1315
- CompileModule = 'V8.CompileModule',
1316
- // Although V8 emits the V8.CompileScript event, the event that actually
1317
- // contains the useful information about the script (URL, etc), is contained
1318
- // in the v8.compile event.
1319
- // Yes, it is all lowercase compared to all the rest of the V8... events,
1320
- // that is not a typo :)
1321
- Compile = 'v8.compile',
1322
- CompileScript = 'V8.CompileScript',
1323
- Optimize = 'V8.OptimizeCode',
1324
- WasmStreamFromResponseCallback = 'v8.wasm.streamFromResponseCallback',
1325
- WasmCompiledModule = 'v8.wasm.compiledModule',
1326
- WasmCachedModule = 'v8.wasm.cachedModule',
1327
- WasmModuleCacheHit = 'v8.wasm.moduleCacheHit',
1328
- WasmModuleCacheInvalid = 'v8.wasm.moduleCacheInvalid',
1329
- /* Js */
1330
- ProfileCall = 'ProfileCall',
1331
- EvaluateScript = 'EvaluateScript',
1332
- FunctionCall = 'FunctionCall',
1333
- EventDispatch = 'EventDispatch',
1334
- EvaluateModule = 'v8.evaluateModule',
1335
- RequestMainThreadFrame = 'RequestMainThreadFrame',
1336
- RequestAnimationFrame = 'RequestAnimationFrame',
1337
- CancelAnimationFrame = 'CancelAnimationFrame',
1338
- FireAnimationFrame = 'FireAnimationFrame',
1339
- RequestIdleCallback = 'RequestIdleCallback',
1340
- CancelIdleCallback = 'CancelIdleCallback',
1341
- FireIdleCallback = 'FireIdleCallback',
1342
- TimerInstall = 'TimerInstall',
1343
- TimerRemove = 'TimerRemove',
1344
- TimerFire = 'TimerFire',
1345
- WebSocketCreate = 'WebSocketCreate',
1346
- WebSocketSendHandshake = 'WebSocketSendHandshakeRequest',
1347
- WebSocketReceiveHandshake = 'WebSocketReceiveHandshakeResponse',
1348
- WebSocketDestroy = 'WebSocketDestroy',
1349
- CryptoDoEncrypt = 'DoEncrypt',
1350
- CryptoDoEncryptReply = 'DoEncryptReply',
1351
- CryptoDoDecrypt = 'DoDecrypt',
1352
- CryptoDoDecryptReply = 'DoDecryptReply',
1353
- CryptoDoDigest = 'DoDigest',
1354
- CryptoDoDigestReply = 'DoDigestReply',
1355
- CryptoDoSign = 'DoSign',
1356
- CryptoDoSignReply = 'DoSignReply',
1357
- CryptoDoVerify = 'DoVerify',
1358
- CryptoDoVerifyReply = 'DoVerifyReply',
1359
- V8Execute = 'V8.Execute',
1360
-
1361
- /* Gc */
1362
- GC = 'GCEvent',
1363
- DOMGC = 'BlinkGC.AtomicPhase',
1364
- IncrementalGCMarking = 'V8.GCIncrementalMarking',
1365
- MajorGC = 'MajorGC',
1366
- MinorGC = 'MinorGC',
1367
- GCCollectGarbage = 'BlinkGC.AtomicPhase',
1368
-
1369
- /* Layout */
1370
- ScheduleStyleRecalculation = 'ScheduleStyleRecalculation',
1371
- RecalculateStyles = 'RecalculateStyles',
1372
- Layout = 'Layout',
1373
- UpdateLayoutTree = 'UpdateLayoutTree',
1374
- InvalidateLayout = 'InvalidateLayout',
1375
- LayoutInvalidationTracking = 'LayoutInvalidationTracking',
1376
- ComputeIntersections = 'ComputeIntersections',
1377
- HitTest = 'HitTest',
1378
- PrePaint = 'PrePaint',
1379
- Layerize = 'Layerize',
1380
- LayoutShift = 'LayoutShift',
1381
- UpdateLayerTree = 'UpdateLayerTree',
1382
- ScheduleStyleInvalidationTracking = 'ScheduleStyleInvalidationTracking',
1383
- StyleRecalcInvalidationTracking = 'StyleRecalcInvalidationTracking',
1384
- StyleInvalidatorInvalidationTracking = 'StyleInvalidatorInvalidationTracking',
1385
-
1386
- /* Paint */
1387
- ScrollLayer = 'ScrollLayer',
1388
- UpdateLayer = 'UpdateLayer',
1389
- PaintSetup = 'PaintSetup',
1390
- Paint = 'Paint',
1391
- PaintImage = 'PaintImage',
1392
- Commit = 'Commit',
1393
- CompositeLayers = 'CompositeLayers',
1394
- RasterTask = 'RasterTask',
1395
- ImageDecodeTask = 'ImageDecodeTask',
1396
- ImageUploadTask = 'ImageUploadTask',
1397
- DecodeImage = 'Decode Image',
1398
- ResizeImage = 'Resize Image',
1399
- DrawLazyPixelRef = 'Draw LazyPixelRef',
1400
- DecodeLazyPixelRef = 'Decode LazyPixelRef',
1401
- GPUTask = 'GPUTask',
1402
- Rasterize = 'Rasterize',
1403
- EventTiming = 'EventTiming',
1404
-
1405
- /* Compile */
1406
- OptimizeCode = 'V8.OptimizeCode',
1407
- CacheScript = 'v8.produceCache',
1408
- CacheModule = 'v8.produceModuleCache',
1409
- // V8Sample events are coming from tracing and contain raw stacks with function addresses.
1410
- // After being processed with help of JitCodeAdded and JitCodeMoved events they
1411
- // get translated into function infos and stored as stacks in JSSample events.
1412
- V8Sample = 'V8Sample',
1413
- JitCodeAdded = 'JitCodeAdded',
1414
- JitCodeMoved = 'JitCodeMoved',
1415
- StreamingCompileScript = 'v8.parseOnBackground',
1416
- StreamingCompileScriptWaiting = 'v8.parseOnBackgroundWaiting',
1417
- StreamingCompileScriptParsing = 'v8.parseOnBackgroundParsing',
1418
- BackgroundDeserialize = 'v8.deserializeOnBackground',
1419
- FinalizeDeserialization = 'V8.FinalizeDeserialization',
1420
-
1421
- /* Markers */
1422
- CommitLoad = 'CommitLoad',
1423
- MarkLoad = 'MarkLoad',
1424
- MarkDOMContent = 'MarkDOMContent',
1425
- MarkFirstPaint = 'firstPaint',
1426
- MarkFCP = 'firstContentfulPaint',
1427
- MarkLCPCandidate = 'largestContentfulPaint::Candidate',
1428
- MarkLCPInvalidate = 'largestContentfulPaint::Invalidate',
1429
- NavigationStart = 'navigationStart',
1430
- TimeStamp = 'TimeStamp',
1431
- ConsoleTime = 'ConsoleTime',
1432
- UserTiming = 'UserTiming',
1433
- InteractiveTime = 'InteractiveTime',
1434
-
1435
- /* Frames */
1436
- BeginFrame = 'BeginFrame',
1437
- NeedsBeginFrameChanged = 'NeedsBeginFrameChanged',
1438
- BeginMainThreadFrame = 'BeginMainThreadFrame',
1439
- ActivateLayerTree = 'ActivateLayerTree',
1440
- DrawFrame = 'DrawFrame',
1441
- DroppedFrame = 'DroppedFrame',
1442
- FrameStartedLoading = 'FrameStartedLoading',
1443
-
1444
- /* Network request events */
1445
- ResourceWillSendRequest = 'ResourceWillSendRequest',
1446
- ResourceSendRequest = 'ResourceSendRequest',
1447
- ResourceReceiveResponse = 'ResourceReceiveResponse',
1448
- ResourceReceivedData = 'ResourceReceivedData',
1449
- ResourceFinish = 'ResourceFinish',
1450
- ResourceMarkAsCached = 'ResourceMarkAsCached',
1451
-
1452
- /* Web sockets */
1453
- WebSocketSendHandshakeRequest = 'WebSocketSendHandshakeRequest',
1454
- WebSocketReceiveHandshakeResponse = 'WebSocketReceiveHandshakeResponse',
1455
-
1456
- /* CPU Profiling */
1457
- Profile = 'Profile',
1458
- StartProfiling = 'CpuProfiler::StartProfiling',
1459
- ProfileChunk = 'ProfileChunk',
1460
- UpdateCounters = 'UpdateCounters',
1461
-
1462
- /* Other */
1463
- Animation = 'Animation',
1464
- ParseAuthorStyleSheet = 'ParseAuthorStyleSheet',
1465
- EmbedderCallback = 'EmbedderCallback',
1466
- SetLayerTreeId = 'SetLayerTreeId',
1467
- TracingStartedInPage = 'TracingStartedInPage',
1468
- TracingStartedInBrowser = 'TracingStartedInBrowser',
1469
- TracingSessionIdForWorker = 'TracingSessionIdForWorker',
1470
- LazyPixelRef = 'LazyPixelRef',
1471
- LayerTreeHostImplSnapshot = 'cc::LayerTreeHostImpl',
1472
- PictureSnapshot = 'cc::Picture',
1473
- DisplayItemListSnapshot = 'cc::DisplayItemList',
1474
- InputLatencyMouseMove = 'InputLatency::MouseMove',
1475
- InputLatencyMouseWheel = 'InputLatency::MouseWheel',
1476
- ImplSideFling = 'InputHandlerProxy::HandleGestureFling::started',
1477
- }
1478
-
1479
- export interface TraceEventSyntheticNetworkRequest extends TraceEventComplete {
1480
- args: TraceEventArgs&{
1481
- data: TraceEventArgsData & {
1482
- syntheticData: TraceEventSyntheticArgsData,
1483
- // All fields below are from TraceEventsForNetworkRequest,
1484
- // Required fields
1485
- decodedBodyLength: number,
1486
- encodedDataLength: number,
1487
- frame: string,
1488
- fromServiceWorker: boolean,
1489
- host: string,
1490
- mimeType: string,
1491
- pathname: string,
1492
- search: string,
1493
- priority: Priority,
1494
- initialPriority: Priority,
1495
- protocol: string,
1496
- redirects: TraceEventSyntheticNetworkRedirect[],
1497
- renderBlocking: RenderBlocking,
1498
- requestId: string,
1499
- requestingFrameUrl: string,
1500
- statusCode: number,
1501
- url: string,
1502
- // Optional fields
1503
- requestMethod?: string,
1504
- timing?: TraceEventResourceReceiveResponseTimingData,
1505
- },
1506
- };
1507
- cat: 'loading';
1508
- name: 'SyntheticNetworkRequest';
1509
- ph: Phase.COMPLETE;
1510
- dur: MicroSeconds;
1511
- tdur: MicroSeconds;
1512
- ts: MicroSeconds;
1513
- tts: MicroSeconds;
1514
- pid: ProcessID;
1515
- tid: ThreadID;
1516
- }