@paulirish/trace_engine 0.0.23 → 0.0.25

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 (60) hide show
  1. package/PAUL.readme.md +5 -0
  2. package/generated/protocol.d.ts +84 -17
  3. package/models/trace/EntriesFilter.d.ts +14 -13
  4. package/models/trace/EntriesFilter.js +40 -38
  5. package/models/trace/EntriesFilter.js.map +1 -1
  6. package/models/trace/ModelImpl.d.ts +6 -4
  7. package/models/trace/ModelImpl.js +13 -4
  8. package/models/trace/ModelImpl.js.map +1 -1
  9. package/models/trace/Processor.js +6 -1
  10. package/models/trace/Processor.js.map +1 -1
  11. package/models/trace/extras/FetchNodes.js +1 -1
  12. package/models/trace/extras/FetchNodes.js.map +1 -1
  13. package/models/trace/extras/URLForEntry.d.ts +4 -0
  14. package/models/trace/extras/URLForEntry.js +35 -0
  15. package/models/trace/extras/URLForEntry.js.map +1 -0
  16. package/models/trace/extras/extras-tsconfig.json +1 -0
  17. package/models/trace/extras/extras.js.map +1 -1
  18. package/models/trace/handlers/AuctionWorkletsHandler.js +4 -2
  19. package/models/trace/handlers/AuctionWorkletsHandler.js.map +1 -1
  20. package/models/trace/handlers/InitiatorsHandler.js +1 -12
  21. package/models/trace/handlers/InitiatorsHandler.js.map +1 -1
  22. package/models/trace/handlers/LayoutShiftsHandler.d.ts +1 -0
  23. package/models/trace/handlers/LayoutShiftsHandler.js +10 -2
  24. package/models/trace/handlers/LayoutShiftsHandler.js.map +1 -1
  25. package/models/trace/handlers/MetaHandler.js +39 -13
  26. package/models/trace/handlers/MetaHandler.js.map +1 -1
  27. package/models/trace/handlers/NetworkRequestsHandler.js +4 -3
  28. package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -1
  29. package/models/trace/handlers/PageLoadMetricsHandler.d.ts +1 -2
  30. package/models/trace/handlers/PageLoadMetricsHandler.js +2 -35
  31. package/models/trace/handlers/PageLoadMetricsHandler.js.map +1 -1
  32. package/models/trace/handlers/RendererHandler.d.ts +1 -0
  33. package/models/trace/handlers/RendererHandler.js +2 -0
  34. package/models/trace/handlers/RendererHandler.js.map +1 -1
  35. package/models/trace/handlers/ScreenshotsHandler.js +2 -2
  36. package/models/trace/handlers/ScreenshotsHandler.js.map +1 -1
  37. package/models/trace/handlers/UserInteractionsHandler.js +3 -2
  38. package/models/trace/handlers/UserInteractionsHandler.js.map +1 -1
  39. package/models/trace/helpers/SyntheticEvents.d.ts +31 -0
  40. package/models/trace/helpers/SyntheticEvents.js +99 -0
  41. package/models/trace/helpers/SyntheticEvents.js.map +1 -0
  42. package/models/trace/helpers/Timing.d.ts +17 -0
  43. package/models/trace/helpers/Timing.js +17 -0
  44. package/models/trace/helpers/Timing.js.map +1 -1
  45. package/models/trace/helpers/Trace.js +3 -2
  46. package/models/trace/helpers/Trace.js.map +1 -1
  47. package/models/trace/helpers/helpers-tsconfig.json +1 -0
  48. package/models/trace/helpers/helpers.d.ts +1 -0
  49. package/models/trace/helpers/helpers.js +1 -0
  50. package/models/trace/helpers/helpers.js.map +1 -1
  51. package/models/trace/insights/CumulativeLayoutShift.d.ts +7 -2
  52. package/models/trace/insights/CumulativeLayoutShift.js +130 -2
  53. package/models/trace/insights/CumulativeLayoutShift.js.map +1 -1
  54. package/models/trace/types/File.d.ts +33 -6
  55. package/models/trace/types/File.js +36 -4
  56. package/models/trace/types/File.js.map +1 -1
  57. package/models/trace/types/TraceEvents.d.ts +86 -12
  58. package/models/trace/types/TraceEvents.js +27 -3
  59. package/models/trace/types/TraceEvents.js.map +1 -1
  60. package/package.json +1 -1
package/PAUL.readme.md ADDED
@@ -0,0 +1,5 @@
1
+ # see readme for cmds
2
+
3
+ # some types thing that might work
4
+
5
+ node out/Typed/../../third_party/typescript/../../node_modules/typescript/bin/tsc -p out/Typed/gen/front_end/models/trace/trace-tsconfig.json # this then has js/map/d.ts. should be able to use for typs
@@ -822,6 +822,8 @@ export declare namespace Audits {
822
822
  CoopSandboxedIFrameCannotNavigateToCoopPage = "CoopSandboxedIFrameCannotNavigateToCoopPage",
823
823
  CorpNotSameOrigin = "CorpNotSameOrigin",
824
824
  CorpNotSameOriginAfterDefaultedToSameOriginByCoep = "CorpNotSameOriginAfterDefaultedToSameOriginByCoep",
825
+ CorpNotSameOriginAfterDefaultedToSameOriginByDip = "CorpNotSameOriginAfterDefaultedToSameOriginByDip",
826
+ CorpNotSameOriginAfterDefaultedToSameOriginByCoepAndDip = "CorpNotSameOriginAfterDefaultedToSameOriginByCoepAndDip",
825
827
  CorpNotSameSite = "CorpNotSameSite"
826
828
  }
827
829
  /**
@@ -1062,6 +1064,7 @@ export declare namespace Audits {
1062
1064
  allowedSites: string[];
1063
1065
  optOutPercentage: number;
1064
1066
  isOptOutTopLevel: boolean;
1067
+ operation: CookieOperation;
1065
1068
  }
1066
1069
  const enum ClientHintIssueReason {
1067
1070
  MetaTagAllowListInvalidOrigin = "MetaTagAllowListInvalidOrigin",
@@ -1116,7 +1119,9 @@ export declare namespace Audits {
1116
1119
  ThirdPartyCookiesBlocked = "ThirdPartyCookiesBlocked",
1117
1120
  NotSignedInWithIdp = "NotSignedInWithIdp",
1118
1121
  MissingTransientUserActivation = "MissingTransientUserActivation",
1119
- ReplacedByButtonMode = "ReplacedByButtonMode"
1122
+ ReplacedByButtonMode = "ReplacedByButtonMode",
1123
+ RelyingPartyOriginIsOpaque = "RelyingPartyOriginIsOpaque",
1124
+ TypeNotMatching = "TypeNotMatching"
1120
1125
  }
1121
1126
  interface FederatedAuthUserInfoRequestIssueDetails {
1122
1127
  federatedAuthUserInfoRequestIssueReason: FederatedAuthUserInfoRequestIssueReason;
@@ -4364,6 +4369,25 @@ export declare namespace DOM {
4364
4369
  */
4365
4370
  nodeIds: NodeId[];
4366
4371
  }
4372
+ interface GetAnchorElementRequest {
4373
+ /**
4374
+ * Id of the positioned element from which to find the anchor.
4375
+ */
4376
+ nodeId: NodeId;
4377
+ /**
4378
+ * An optional anchor specifier, as defined in
4379
+ * https://www.w3.org/TR/css-anchor-position-1/#anchor-specifier.
4380
+ * If not provided, it will return the implicit anchor element for
4381
+ * the given positioned element.
4382
+ */
4383
+ anchorSpecifier?: string;
4384
+ }
4385
+ interface GetAnchorElementResponse extends ProtocolResponseWithError {
4386
+ /**
4387
+ * The anchor element of the given anchor query.
4388
+ */
4389
+ nodeId: NodeId;
4390
+ }
4367
4391
  /**
4368
4392
  * Fired when `Element`'s attribute is modified.
4369
4393
  */
@@ -7416,6 +7440,14 @@ export declare namespace Network {
7416
7440
  * Settled fetch event respondWith promise.
7417
7441
  */
7418
7442
  workerRespondWithSettled: number;
7443
+ /**
7444
+ * Started ServiceWorker static routing source evaluation.
7445
+ */
7446
+ workerRouterEvaluationStart?: number;
7447
+ /**
7448
+ * Started cache lookup when the source was evaluated to `cache`.
7449
+ */
7450
+ workerCacheLookupStart?: number;
7419
7451
  /**
7420
7452
  * Started sending request.
7421
7453
  */
@@ -7655,6 +7687,8 @@ export declare namespace Network {
7655
7687
  CoopSandboxedIframeCannotNavigateToCoopPage = "coop-sandboxed-iframe-cannot-navigate-to-coop-page",
7656
7688
  CorpNotSameOrigin = "corp-not-same-origin",
7657
7689
  CorpNotSameOriginAfterDefaultedToSameOriginByCoep = "corp-not-same-origin-after-defaulted-to-same-origin-by-coep",
7690
+ CorpNotSameOriginAfterDefaultedToSameOriginByDip = "corp-not-same-origin-after-defaulted-to-same-origin-by-dip",
7691
+ CorpNotSameOriginAfterDefaultedToSameOriginByCoepAndDip = "corp-not-same-origin-after-defaulted-to-same-origin-by-coep-and-dip",
7658
7692
  CorpNotSameSite = "corp-not-same-site"
7659
7693
  }
7660
7694
  /**
@@ -7769,6 +7803,10 @@ export declare namespace Network {
7769
7803
  * field will be set, otherwise no value will be set.
7770
7804
  */
7771
7805
  matchedSourceType?: ServiceWorkerRouterSource;
7806
+ /**
7807
+ * The actual router source used.
7808
+ */
7809
+ actualSourceType?: ServiceWorkerRouterSource;
7772
7810
  }
7773
7811
  /**
7774
7812
  * HTTP response data.
@@ -8003,6 +8041,21 @@ export declare namespace Network {
8003
8041
  */
8004
8042
  requestId?: RequestId;
8005
8043
  }
8044
+ /**
8045
+ * cookiePartitionKey object
8046
+ * The representation of the components of the key that are created by the cookiePartitionKey class contained in net/cookies/cookie_partition_key.h.
8047
+ */
8048
+ interface CookiePartitionKey {
8049
+ /**
8050
+ * The site of the top-level URL the browser was visiting at the start
8051
+ * of the request to the endpoint that set the cookie.
8052
+ */
8053
+ topLevelSite: string;
8054
+ /**
8055
+ * Indicates if the cookie has any ancestors that are cross-site to the topLevelSite.
8056
+ */
8057
+ hasCrossSiteAncestor: boolean;
8058
+ }
8006
8059
  /**
8007
8060
  * Cookie object
8008
8061
  */
@@ -8066,10 +8119,9 @@ export declare namespace Network {
8066
8119
  */
8067
8120
  sourcePort: integer;
8068
8121
  /**
8069
- * Cookie partition key. The site of the top-level URL the browser was visiting at the start
8070
- * of the request to the endpoint that set the cookie.
8122
+ * Cookie partition key.
8071
8123
  */
8072
- partitionKey?: string;
8124
+ partitionKey?: CookiePartitionKey;
8073
8125
  /**
8074
8126
  * True if cookie partition key is opaque.
8075
8127
  */
@@ -8255,11 +8307,9 @@ export declare namespace Network {
8255
8307
  */
8256
8308
  sourcePort?: integer;
8257
8309
  /**
8258
- * Cookie partition key. The site of the top-level URL the browser was visiting at the start
8259
- * of the request to the endpoint that set the cookie.
8260
- * If not set, the cookie will be set as not partitioned.
8310
+ * Cookie partition key. If not set, the cookie will be set as not partitioned.
8261
8311
  */
8262
- partitionKey?: string;
8312
+ partitionKey?: CookiePartitionKey;
8263
8313
  }
8264
8314
  const enum AuthChallengeSource {
8265
8315
  Server = "Server",
@@ -8689,10 +8739,10 @@ export declare namespace Network {
8689
8739
  */
8690
8740
  path?: string;
8691
8741
  /**
8692
- * If specified, deletes only cookies with the the given name and partitionKey where domain
8693
- * matches provided URL.
8742
+ * If specified, deletes only cookies with the the given name and partitionKey where
8743
+ * all partition key attributes match the cookie partition key attribute.
8694
8744
  */
8695
- partitionKey?: string;
8745
+ partitionKey?: CookiePartitionKey;
8696
8746
  }
8697
8747
  interface EmulateNetworkConditionsRequest {
8698
8748
  /**
@@ -8926,11 +8976,9 @@ export declare namespace Network {
8926
8976
  */
8927
8977
  sourcePort?: integer;
8928
8978
  /**
8929
- * Cookie partition key. The site of the top-level URL the browser was visiting at the start
8930
- * of the request to the endpoint that set the cookie.
8931
- * If not set, the cookie will be set as not partitioned.
8979
+ * Cookie partition key. If not set, the cookie will be set as not partitioned.
8932
8980
  */
8933
- partitionKey?: string;
8981
+ partitionKey?: CookiePartitionKey;
8934
8982
  }
8935
8983
  interface SetCookieResponse extends ProtocolResponseWithError {
8936
8984
  /**
@@ -9553,7 +9601,7 @@ export declare namespace Network {
9553
9601
  * The cookie partition key that will be used to store partitioned cookies set in this response.
9554
9602
  * Only sent when partitioned cookies are enabled.
9555
9603
  */
9556
- cookiePartitionKey?: string;
9604
+ cookiePartitionKey?: CookiePartitionKey;
9557
9605
  /**
9558
9606
  * True if partitioned cookies are enabled, but the partition key is not serializable to string.
9559
9607
  */
@@ -9586,7 +9634,7 @@ export declare namespace Network {
9586
9634
  FailedPrecondition = "FailedPrecondition",
9587
9635
  ResourceExhausted = "ResourceExhausted",
9588
9636
  AlreadyExists = "AlreadyExists",
9589
- Unavailable = "Unavailable",
9637
+ ResourceLimited = "ResourceLimited",
9590
9638
  Unauthorized = "Unauthorized",
9591
9639
  BadResponse = "BadResponse",
9592
9640
  InternalError = "InternalError",
@@ -10512,6 +10560,7 @@ export declare namespace Page {
10512
10560
  ClipboardWrite = "clipboard-write",
10513
10561
  ComputePressure = "compute-pressure",
10514
10562
  CrossOriginIsolated = "cross-origin-isolated",
10563
+ DeferredFetch = "deferred-fetch",
10515
10564
  DirectSockets = "direct-sockets",
10516
10565
  DisplayCapture = "display-capture",
10517
10566
  DocumentDomain = "document-domain",
@@ -11283,6 +11332,11 @@ export declare namespace Page {
11283
11332
  HTTPAuthRequired = "HTTPAuthRequired",
11284
11333
  CookieFlushed = "CookieFlushed",
11285
11334
  BroadcastChannelOnMessage = "BroadcastChannelOnMessage",
11335
+ WebViewSettingsChanged = "WebViewSettingsChanged",
11336
+ WebViewJavaScriptObjectChanged = "WebViewJavaScriptObjectChanged",
11337
+ WebViewMessageListenerInjected = "WebViewMessageListenerInjected",
11338
+ WebViewSafeBrowsingAllowlistChanged = "WebViewSafeBrowsingAllowlistChanged",
11339
+ WebViewDocumentStartJavascriptChanged = "WebViewDocumentStartJavascriptChanged",
11286
11340
  WebSocket = "WebSocket",
11287
11341
  WebTransport = "WebTransport",
11288
11342
  WebRTC = "WebRTC",
@@ -15966,6 +16020,19 @@ export declare namespace PWA {
15966
16020
  */
15967
16021
  targetId: Target.TargetID;
15968
16022
  }
16023
+ interface LaunchFilesInAppRequest {
16024
+ manifestId: string;
16025
+ files: string[];
16026
+ }
16027
+ interface LaunchFilesInAppResponse extends ProtocolResponseWithError {
16028
+ /**
16029
+ * IDs of the tab targets created as the result.
16030
+ */
16031
+ targetIds: Target.TargetID[];
16032
+ }
16033
+ interface OpenCurrentPageInAppRequest {
16034
+ manifestId: string;
16035
+ }
15969
16036
  }
15970
16037
  /**
15971
16038
  * Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing
@@ -28,44 +28,45 @@ export interface PossibleFilterActions {
28
28
  * Once actions are applied, the invisibleEntries() method will return the
29
29
  * entries that are invisible, and this is the list of entries that should be
30
30
  * removed before rendering the resulting thread on the timeline.
31
- **/
31
+ */
32
32
  export declare class EntriesFilter {
33
33
  #private;
34
34
  constructor(entryToNodeMap: EntryToNodeMap);
35
35
  /**
36
36
  * Checks which actions can be applied on an entry. This allows us to only show possible actions in the Context Menu.
37
37
  * For example, if an entry has no children, COLLAPSE_FUNCTION will not change the FlameChart, therefore there is no need to show this action as an option.
38
- **/
38
+ */
39
39
  findPossibleActions(entry: Types.TraceEvents.SyntheticTraceEntry): PossibleFilterActions;
40
40
  /**
41
41
  * Returns the amount of entry descendants that belong to the hidden entries array.
42
- * **/
42
+ * */
43
43
  findHiddenDescendantsAmount(entry: Types.TraceEvents.SyntheticTraceEntry): number;
44
44
  /**
45
45
  * Returns the set of entries that are invisible given the set of applied actions.
46
- **/
46
+ */
47
47
  invisibleEntries(): Types.TraceEvents.TraceEventData[];
48
48
  /**
49
- * Sets invisible and modified entries. Called when a trace with annotations is loaded and some entries are set as hidden and modified.
49
+ * Sets hidden and expandable. Called when a trace with modifications is loaded and some entries are set as hidden and expandable.
50
50
  * Both arrays are set together because if there is one, the other must be present too.
51
- **/
52
- setInvisibleAndModifiedEntries(invisibleEntries: Types.TraceEvents.TraceEventData[], modifiedEntries: Types.TraceEvents.TraceEventData[]): void;
51
+ */
52
+ setHiddenAndExpandableEntries(invisibleEntries: Types.TraceEvents.TraceEventData[], expandableEntries: Types.TraceEvents.TraceEventData[]): void;
53
53
  inEntryInvisible(entry: Types.TraceEvents.TraceEventData): boolean;
54
54
  /**
55
- * Returns the array of entries that have a sign indicating that entries below are hidden.
56
- **/
57
- modifiedEntries(): Types.TraceEvents.TraceEventData[];
55
+ * Returns the array of entries that have a sign indicating that entries below are hidden,
56
+ * and so that they can be "expanded" to reveal their hidden children.
57
+ */
58
+ expandableEntries(): Types.TraceEvents.TraceEventData[];
58
59
  /**
59
60
  * Applies an action to hide entries or removes entries
60
61
  * from hidden entries array depending on the action.
61
- **/
62
+ */
62
63
  applyFilterAction(action: UserFilterAction): Types.TraceEvents.TraceEventData[];
63
64
  /**
64
65
  * If an entry was selected from a link instead of clicking on it,
65
66
  * it might be in the invisible entries array.
66
- * If it is, reveal it by resetting clidren the closest modified entry,
67
+ * If it is, reveal it by resetting clidren the closest expandable entry,
67
68
  */
68
69
  revealEntry(entry: Types.TraceEvents.SyntheticTraceEntry): void;
69
- isEntryModified(event: Types.TraceEvents.TraceEventData): boolean;
70
+ isEntryExpandable(event: Types.TraceEvents.TraceEventData): boolean;
70
71
  }
71
72
  export {};
@@ -13,7 +13,7 @@ import * as Types from './types/types.js';
13
13
  * Once actions are applied, the invisibleEntries() method will return the
14
14
  * entries that are invisible, and this is the list of entries that should be
15
15
  * removed before rendering the resulting thread on the timeline.
16
- **/
16
+ */
17
17
  export class EntriesFilter {
18
18
  // Maps from an individual TraceEvent entry to its representation as a
19
19
  // RendererEntryNode. We need this so we can then parse the tree structure
@@ -21,9 +21,10 @@ export class EntriesFilter {
21
21
  #entryToNode;
22
22
  // Track the set of invisible entries.
23
23
  #invisibleEntries = [];
24
- // List of entries whose children are modified. This list is used to
25
- // keep track of entries that should be identified in the UI as modified.
26
- #modifiedVisibleEntries = [];
24
+ // List of entries whose children are hidden. This list is used to
25
+ // keep track of entries that should be identified in the UI as "expandable",
26
+ // since they can be clicked to reveal their hidden children.
27
+ #expandableEntries = [];
27
28
  // Cache for descendants of entry that have already been gathered. The descendants
28
29
  // will never change so we can avoid running the potentially expensive search again.
29
30
  #entryToDescendantsMap = new Map();
@@ -33,7 +34,7 @@ export class EntriesFilter {
33
34
  /**
34
35
  * Checks which actions can be applied on an entry. This allows us to only show possible actions in the Context Menu.
35
36
  * For example, if an entry has no children, COLLAPSE_FUNCTION will not change the FlameChart, therefore there is no need to show this action as an option.
36
- **/
37
+ */
37
38
  findPossibleActions(entry) {
38
39
  const entryNode = this.#entryToNode.get(entry);
39
40
  if (!entryNode) {
@@ -62,7 +63,7 @@ export class EntriesFilter {
62
63
  }
63
64
  /**
64
65
  * Returns the amount of entry descendants that belong to the hidden entries array.
65
- * **/
66
+ * */
66
67
  findHiddenDescendantsAmount(entry) {
67
68
  const entryNode = this.#entryToNode.get(entry);
68
69
  if (!entryNode) {
@@ -73,31 +74,32 @@ export class EntriesFilter {
73
74
  }
74
75
  /**
75
76
  * Returns the set of entries that are invisible given the set of applied actions.
76
- **/
77
+ */
77
78
  invisibleEntries() {
78
79
  return this.#invisibleEntries;
79
80
  }
80
81
  /**
81
- * Sets invisible and modified entries. Called when a trace with annotations is loaded and some entries are set as hidden and modified.
82
+ * Sets hidden and expandable. Called when a trace with modifications is loaded and some entries are set as hidden and expandable.
82
83
  * Both arrays are set together because if there is one, the other must be present too.
83
- **/
84
- setInvisibleAndModifiedEntries(invisibleEntries, modifiedEntries) {
84
+ */
85
+ setHiddenAndExpandableEntries(invisibleEntries, expandableEntries) {
85
86
  this.#invisibleEntries.push(...invisibleEntries);
86
- this.#modifiedVisibleEntries.push(...modifiedEntries);
87
+ this.#expandableEntries.push(...expandableEntries);
87
88
  }
88
89
  inEntryInvisible(entry) {
89
90
  return this.#invisibleEntries.includes(entry);
90
91
  }
91
92
  /**
92
- * Returns the array of entries that have a sign indicating that entries below are hidden.
93
- **/
94
- modifiedEntries() {
95
- return this.#modifiedVisibleEntries;
93
+ * Returns the array of entries that have a sign indicating that entries below are hidden,
94
+ * and so that they can be "expanded" to reveal their hidden children.
95
+ */
96
+ expandableEntries() {
97
+ return this.#expandableEntries;
96
98
  }
97
99
  /**
98
100
  * Applies an action to hide entries or removes entries
99
101
  * from hidden entries array depending on the action.
100
- **/
102
+ */
101
103
  applyFilterAction(action) {
102
104
  // We apply new user action to the set of all entries, and mark
103
105
  // any that should be hidden by adding them to this set.
@@ -111,11 +113,11 @@ export class EntriesFilter {
111
113
  // children remain visible, so we just have to hide the entry that was
112
114
  // selected.
113
115
  entriesToHide.add(action.entry);
114
- // If parent node exists, add it to modifiedVisibleEntries, so it would be possible to uncollapse its' children.
116
+ // If parent node exists, add it to expandableEntries, so it would be possible to uncollapse its children.
115
117
  const actionNode = this.#entryToNode.get(action.entry) || null;
116
118
  const parentNode = actionNode && this.#findNextVisibleParent(actionNode);
117
119
  if (parentNode) {
118
- this.#addModifiedEntry(parentNode.entry);
120
+ this.#addExpandableEntry(parentNode.entry);
119
121
  }
120
122
  break;
121
123
  }
@@ -128,7 +130,7 @@ export class EntriesFilter {
128
130
  }
129
131
  const allDescendants = this.#findAllDescendantsOfNode(entryNode);
130
132
  allDescendants.forEach(descendant => entriesToHide.add(descendant));
131
- this.#addModifiedEntry(action.entry);
133
+ this.#addExpandableEntry(action.entry);
132
134
  break;
133
135
  }
134
136
  case "COLLAPSE_REPEATING_DESCENDANTS" /* FilterAction.COLLAPSE_REPEATING_DESCENDANTS */: {
@@ -140,13 +142,13 @@ export class EntriesFilter {
140
142
  const allRepeatingDescendants = this.#findAllRepeatingDescendantsOfNext(entryNode);
141
143
  allRepeatingDescendants.forEach(descendant => entriesToHide.add(descendant));
142
144
  if (entriesToHide.size > 0) {
143
- this.#addModifiedEntry(action.entry);
145
+ this.#addExpandableEntry(action.entry);
144
146
  }
145
147
  break;
146
148
  }
147
149
  case "UNDO_ALL_ACTIONS" /* FilterAction.UNDO_ALL_ACTIONS */: {
148
150
  this.#invisibleEntries = [];
149
- this.#modifiedVisibleEntries = [];
151
+ this.#expandableEntries = [];
150
152
  break;
151
153
  }
152
154
  case "RESET_CHILDREN" /* FilterAction.RESET_CHILDREN */: {
@@ -161,12 +163,12 @@ export class EntriesFilter {
161
163
  }
162
164
  /**
163
165
  * Add an entry to the array of entries that have a sign indicating that entries below are hidden.
164
- * Also, remove all of the child entries of the new modified entry from the modified array. Do that because
166
+ * Also, remove all of the child entries of the new expandable entry from the expandable array. Do that because
165
167
  * to draw the initiator from the closest visible entry, we need to get the closest entry that is
166
- * marked as modified and we do not want to get some that are hidden.
168
+ * marked as expandable and we do not want to get some that are hidden.
167
169
  */
168
- #addModifiedEntry(entry) {
169
- this.#modifiedVisibleEntries.push(entry);
170
+ #addExpandableEntry(entry) {
171
+ this.#expandableEntries.push(entry);
170
172
  const entryNode = this.#entryToNode.get(entry);
171
173
  if (!entryNode) {
172
174
  // Invalid node was given, just ignore and move on.
@@ -174,7 +176,7 @@ export class EntriesFilter {
174
176
  }
175
177
  const allDescendants = this.#findAllDescendantsOfNode(entryNode);
176
178
  if (allDescendants.length > 0) {
177
- this.#modifiedVisibleEntries = this.#modifiedVisibleEntries.filter(entry => {
179
+ this.#expandableEntries = this.#expandableEntries.filter(entry => {
178
180
  return !allDescendants.includes(entry);
179
181
  });
180
182
  }
@@ -241,7 +243,7 @@ export class EntriesFilter {
241
243
  /**
242
244
  * If an entry was selected from a link instead of clicking on it,
243
245
  * it might be in the invisible entries array.
244
- * If it is, reveal it by resetting clidren the closest modified entry,
246
+ * If it is, reveal it by resetting clidren the closest expandable entry,
245
247
  */
246
248
  revealEntry(entry) {
247
249
  const entryNode = this.#entryToNode.get(entry);
@@ -249,16 +251,16 @@ export class EntriesFilter {
249
251
  // Invalid node was given, just ignore and move on.
250
252
  return;
251
253
  }
252
- let closestModifiedParent = entryNode;
253
- while (closestModifiedParent.parent && !this.#modifiedVisibleEntries.includes(closestModifiedParent.entry)) {
254
- closestModifiedParent = closestModifiedParent.parent;
254
+ let closestExpandableParent = entryNode;
255
+ while (closestExpandableParent.parent && !this.#expandableEntries.includes(closestExpandableParent.entry)) {
256
+ closestExpandableParent = closestExpandableParent.parent;
255
257
  }
256
- this.#makeEntryChildrenVisible(closestModifiedParent.entry);
258
+ this.#makeEntryChildrenVisible(closestExpandableParent.entry);
257
259
  }
258
260
  /**
259
261
  * Removes all of the entry children from the
260
262
  * invisible entries array to make them visible.
261
- **/
263
+ */
262
264
  #makeEntryChildrenVisible(entry) {
263
265
  const entryNode = this.#entryToNode.get(entry);
264
266
  if (!entryNode) {
@@ -269,7 +271,7 @@ export class EntriesFilter {
269
271
  /**
270
272
  * Filter out all descendant of the node
271
273
  * from the invisible entries list.
272
- **/
274
+ */
273
275
  this.#invisibleEntries = this.#invisibleEntries.filter(entry => {
274
276
  if (descendants.includes(entry)) {
275
277
  return false;
@@ -277,18 +279,18 @@ export class EntriesFilter {
277
279
  return true;
278
280
  });
279
281
  /**
280
- * Filter out all descentants and entry from modified entries
282
+ * Filter out all descentants and entry from expandable entries
281
283
  * list to not show that some entries below those are hidden.
282
- **/
283
- this.#modifiedVisibleEntries = this.#modifiedVisibleEntries.filter(iterEntry => {
284
+ */
285
+ this.#expandableEntries = this.#expandableEntries.filter(iterEntry => {
284
286
  if (descendants.includes(iterEntry) || iterEntry === entry) {
285
287
  return false;
286
288
  }
287
289
  return true;
288
290
  });
289
291
  }
290
- isEntryModified(event) {
291
- return this.#modifiedVisibleEntries.includes(event);
292
+ isEntryExpandable(event) {
293
+ return this.#expandableEntries.includes(event);
292
294
  }
293
295
  }
294
296
  //# sourceMappingURL=EntriesFilter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EntriesFilter.js","sourceRoot":"","sources":["../../../../../../front_end/models/trace/EntriesFilter.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAC7B,OAAO,KAAK,QAAQ,MAAM,iCAAiC,CAAC;AAE5D,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AA0B1C;;;;;;;;;IASI;AACJ,MAAM,OAAO,aAAa;IACxB,sEAAsE;IACtE,0EAA0E;IAC1E,oCAAoC;IACpC,YAAY,CAAiB;IAE7B,sCAAsC;IACtC,iBAAiB,GAAuC,EAAE,CAAC;IAC3D,oEAAoE;IACpE,yEAAyE;IACzE,uBAAuB,GAAuC,EAAE,CAAC;IACjE,kFAAkF;IAClF,oFAAoF;IACpF,sBAAsB,GAAgF,IAAI,GAAG,EAAE,CAAC;IAEhH,YAAY,cAA8B;QACxC,IAAI,CAAC,YAAY,GAAG,cAAc,CAAC;IACrC,CAAC;IAED;;;QAGI;IACJ,mBAAmB,CAAC,KAA4C;QAC9D,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,sDAAsD;YACtD,OAAO;gBACL,oDAA6B,EAAE,KAAK;gBACpC,0DAAgC,EAAE,KAAK;gBACvC,oFAA6C,EAAE,KAAK;gBACpD,oDAA6B,EAAE,KAAK;gBACpC,wDAA+B,EAAE,KAAK;aACvC,CAAC;QACJ,CAAC;QACD,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC;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C;QACD,IAAI,CAAC,yBAAyB,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAC9D,CAAC;IAED;;;QAGI;IACJ,yBAAyB,CAAC,KAA4C;QACpE,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,mDAAmD;YACnD,OAAO;QACT,CAAC;QACD,MAAM,WAAW,GAAG,IAAI,CAAC,yBAAyB,CAAC,SAAS,CAAC,CAAC;QAE9D;;;YAGI;QACJ,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YAC7D,IAAI,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBAChC,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QAEH;;;YAGI;QACJ,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;YAC7E,IAAI,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;gBAC3D,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;IAED,eAAe,CAAC,KAAuC;QACrD,OAAO,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,CAAC;CACF","sourcesContent":["// Copyright 2023 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\nimport * as Platform from '../../core/platform/platform.js';\n\nimport * as Helpers from './helpers/helpers.js';\nimport * as Types from './types/types.js';\n\ntype EntryToNodeMap = Map<Types.TraceEvents.SyntheticTraceEntry, Helpers.TreeHelpers.TraceEntryNode>;\n\nexport const enum FilterAction {\n MERGE_FUNCTION = 'MERGE_FUNCTION',\n COLLAPSE_FUNCTION = 'COLLAPSE_FUNCTION',\n COLLAPSE_REPEATING_DESCENDANTS = 'COLLAPSE_REPEATING_DESCENDANTS',\n RESET_CHILDREN = 'RESET_CHILDREN',\n UNDO_ALL_ACTIONS = 'UNDO_ALL_ACTIONS',\n}\n\nexport interface UserFilterAction {\n type: FilterAction;\n entry: Types.TraceEvents.SyntheticTraceEntry;\n}\n\n// Object used to indicate to the Context Menu if an action is possible on the selected entry.\nexport interface PossibleFilterActions {\n [FilterAction.MERGE_FUNCTION]: boolean;\n [FilterAction.COLLAPSE_FUNCTION]: boolean;\n [FilterAction.COLLAPSE_REPEATING_DESCENDANTS]: boolean;\n [FilterAction.RESET_CHILDREN]: boolean;\n [FilterAction.UNDO_ALL_ACTIONS]: boolean;\n}\n\n/**\n * This class can take in a thread that has been generated by the\n * RendererHandler and apply certain actions to it in order to modify what is\n * shown to the user. These actions can be automatically applied by DevTools or\n * applied by the user.\n *\n * Once actions are applied, the invisibleEntries() method will return the\n * entries that are invisible, and this is the list of entries that should be\n * removed before rendering the resulting thread on the timeline.\n **/\nexport class EntriesFilter {\n // Maps from an individual TraceEvent entry to its representation as a\n // RendererEntryNode. We need this so we can then parse the tree structure\n // generated by the RendererHandler.\n #entryToNode: EntryToNodeMap;\n\n // Track the set of invisible entries.\n #invisibleEntries: Types.TraceEvents.TraceEventData[] = [];\n // List of entries whose children are modified. This list is used to\n // keep track of entries that should be identified in the UI as modified.\n #modifiedVisibleEntries: Types.TraceEvents.TraceEventData[] = [];\n // Cache for descendants of entry that have already been gathered. The descendants\n // will never change so we can avoid running the potentially expensive search again.\n #entryToDescendantsMap: Map<Helpers.TreeHelpers.TraceEntryNode, Types.TraceEvents.TraceEventData[]> = new Map();\n\n constructor(entryToNodeMap: EntryToNodeMap) {\n this.#entryToNode = entryToNodeMap;\n }\n\n /**\n * Checks which actions can be applied on an entry. This allows us to only show possible actions in the Context Menu.\n * For example, if an entry has no children, COLLAPSE_FUNCTION will not change the FlameChart, therefore there is no need to show this action as an option.\n **/\n findPossibleActions(entry: Types.TraceEvents.SyntheticTraceEntry): PossibleFilterActions {\n const entryNode = this.#entryToNode.get(entry);\n if (!entryNode) {\n // Invalid node was given, return no possible actions.\n return {\n [FilterAction.MERGE_FUNCTION]: false,\n [FilterAction.COLLAPSE_FUNCTION]: false,\n [FilterAction.COLLAPSE_REPEATING_DESCENDANTS]: false,\n [FilterAction.RESET_CHILDREN]: false,\n [FilterAction.UNDO_ALL_ACTIONS]: false,\n };\n }\n const entryParent = entryNode.parent;\n const allVisibleDescendants =\n this.#findAllDescendantsOfNode(entryNode).filter(descendant => !this.#invisibleEntries.includes(descendant));\n const allVisibleRepeatingDescendants = this.#findAllRepeatingDescendantsOfNext(entryNode).filter(\n descendant => !this.#invisibleEntries.includes(descendant));\n const allInVisibleDescendants =\n this.#findAllDescendantsOfNode(entryNode).filter(descendant => this.#invisibleEntries.includes(descendant));\n\n // If there are children to hide, indicate action as possible\n const possibleActions: PossibleFilterActions = {\n [FilterAction.MERGE_FUNCTION]: entryParent !== null,\n [FilterAction.COLLAPSE_FUNCTION]: allVisibleDescendants.length > 0,\n [FilterAction.COLLAPSE_REPEATING_DESCENDANTS]: allVisibleRepeatingDescendants.length > 0,\n [FilterAction.RESET_CHILDREN]: allInVisibleDescendants.length > 0,\n [FilterAction.UNDO_ALL_ACTIONS]: this.#invisibleEntries.length > 0,\n };\n return possibleActions;\n }\n\n /**\n * Returns the amount of entry descendants that belong to the hidden entries array.\n * **/\n findHiddenDescendantsAmount(entry: Types.TraceEvents.SyntheticTraceEntry): number {\n const entryNode = this.#entryToNode.get(entry);\n if (!entryNode) {\n return 0;\n }\n const allDescendants = this.#findAllDescendantsOfNode(entryNode);\n return allDescendants.filter(descendant => this.invisibleEntries().includes(descendant)).length;\n }\n\n /**\n * Returns the set of entries that are invisible given the set of applied actions.\n **/\n invisibleEntries(): Types.TraceEvents.TraceEventData[] {\n return this.#invisibleEntries;\n }\n\n /**\n * Sets invisible and modified entries. Called when a trace with annotations is loaded and some entries are set as hidden and modified.\n * Both arrays are set together because if there is one, the other must be present too.\n **/\n setInvisibleAndModifiedEntries(\n invisibleEntries: Types.TraceEvents.TraceEventData[], modifiedEntries: Types.TraceEvents.TraceEventData[]): void {\n this.#invisibleEntries.push(...invisibleEntries);\n this.#modifiedVisibleEntries.push(...modifiedEntries);\n }\n\n inEntryInvisible(entry: Types.TraceEvents.TraceEventData): boolean {\n return this.#invisibleEntries.includes(entry);\n }\n\n /**\n * Returns the array of entries that have a sign indicating that entries below are hidden.\n **/\n modifiedEntries(): Types.TraceEvents.TraceEventData[] {\n return this.#modifiedVisibleEntries;\n }\n\n /**\n * Applies an action to hide entries or removes entries\n * from hidden entries array depending on the action.\n **/\n applyFilterAction(action: UserFilterAction): Types.TraceEvents.TraceEventData[] {\n // We apply new user action to the set of all entries, and mark\n // any that should be hidden by adding them to this set.\n // Another approach would be to use splice() to remove items from the\n // array, but doing this would be a mutation of the arry for every hidden\n // event. Instead, we add entries to this set and return it as an array at the end.\n const entriesToHide = new Set<Types.TraceEvents.TraceEventData>();\n\n switch (action.type) {\n case FilterAction.MERGE_FUNCTION: {\n // The entry that was clicked on is merged into its parent. All its\n // children remain visible, so we just have to hide the entry that was\n // selected.\n entriesToHide.add(action.entry);\n // If parent node exists, add it to modifiedVisibleEntries, so it would be possible to uncollapse its' children.\n const actionNode = this.#entryToNode.get(action.entry) || null;\n const parentNode = actionNode && this.#findNextVisibleParent(actionNode);\n if (parentNode) {\n this.#addModifiedEntry(parentNode.entry);\n }\n break;\n }\n case FilterAction.COLLAPSE_FUNCTION: {\n // The entry itself remains visible, but all of its descendants are hidden.\n const entryNode = this.#entryToNode.get(action.entry);\n if (!entryNode) {\n // Invalid node was given, just ignore and move on.\n break;\n }\n const allDescendants = this.#findAllDescendantsOfNode(entryNode);\n allDescendants.forEach(descendant => entriesToHide.add(descendant));\n this.#addModifiedEntry(action.entry);\n break;\n }\n case FilterAction.COLLAPSE_REPEATING_DESCENDANTS: {\n const entryNode = this.#entryToNode.get(action.entry);\n if (!entryNode) {\n // Invalid node was given, just ignore and move on.\n break;\n }\n const allRepeatingDescendants = this.#findAllRepeatingDescendantsOfNext(entryNode);\n allRepeatingDescendants.forEach(descendant => entriesToHide.add(descendant));\n if (entriesToHide.size > 0) {\n this.#addModifiedEntry(action.entry);\n }\n break;\n }\n case FilterAction.UNDO_ALL_ACTIONS: {\n this.#invisibleEntries = [];\n this.#modifiedVisibleEntries = [];\n break;\n }\n case FilterAction.RESET_CHILDREN: {\n this.#makeEntryChildrenVisible(action.entry);\n break;\n }\n default:\n Platform.assertNever(action.type, `Unknown EntriesFilter action: ${action.type}`);\n }\n\n this.#invisibleEntries.push(...entriesToHide);\n\n return this.#invisibleEntries;\n }\n\n /**\n * Add an entry to the array of entries that have a sign indicating that entries below are hidden.\n * Also, remove all of the child entries of the new modified entry from the modified array. Do that because\n * to draw the initiator from the closest visible entry, we need to get the closest entry that is\n * marked as modified and we do not want to get some that are hidden.\n */\n #addModifiedEntry(entry: Types.TraceEvents.TraceEventData): void {\n this.#modifiedVisibleEntries.push(entry);\n const entryNode = this.#entryToNode.get(entry);\n if (!entryNode) {\n // Invalid node was given, just ignore and move on.\n return;\n }\n const allDescendants = this.#findAllDescendantsOfNode(entryNode);\n if (allDescendants.length > 0) {\n this.#modifiedVisibleEntries = this.#modifiedVisibleEntries.filter(entry => {\n return !allDescendants.includes(entry);\n });\n }\n }\n\n // The direct parent might be hidden by other actions, therefore we look for the next visible parent.\n #findNextVisibleParent(node: Helpers.TreeHelpers.TraceEntryNode): Helpers.TreeHelpers.TraceEntryNode|null {\n let parent = node.parent;\n while (parent && this.#invisibleEntries.includes(parent.entry)) {\n parent = parent.parent;\n }\n return parent;\n }\n\n #findAllDescendantsOfNode(root: Helpers.TreeHelpers.TraceEntryNode): Types.TraceEvents.TraceEventData[] {\n const cachedDescendants = this.#entryToDescendantsMap.get(root);\n if (cachedDescendants) {\n return cachedDescendants;\n }\n\n const descendants: Types.TraceEvents.TraceEventData[] = [];\n\n // Walk through all the descendants, starting at the root node.\n const children: Helpers.TreeHelpers.TraceEntryNode[] = [...root.children];\n while (children.length > 0) {\n const childNode = children.shift();\n if (childNode) {\n descendants.push(childNode.entry);\n const childNodeCachedDescendants = this.#entryToDescendantsMap.get(childNode);\n // If the descendants of a child are cached, get them from the cache instead of iterating through them again\n if (childNodeCachedDescendants) {\n descendants.push(...childNodeCachedDescendants);\n } else {\n children.push(...childNode.children);\n }\n }\n }\n\n this.#entryToDescendantsMap.set(root, descendants);\n return descendants;\n }\n\n #findAllRepeatingDescendantsOfNext(root: Helpers.TreeHelpers.TraceEntryNode):\n Types.TraceEvents.SyntheticTraceEntry[] {\n // Walk through all the ancestors, starting at the root node.\n const children: Helpers.TreeHelpers.TraceEntryNode[] = [...root.children];\n const repeatingNodes: Types.TraceEvents.SyntheticTraceEntry[] = [];\n const rootIsProfileCall = Types.TraceEvents.isProfileCall(root.entry);\n\n while (children.length > 0) {\n const childNode = children.shift();\n if (childNode) {\n const childIsProfileCall = Types.TraceEvents.isProfileCall(childNode.entry);\n if (/* Handle SyntheticProfileCalls */ rootIsProfileCall && childIsProfileCall) {\n const rootNodeEntry = root.entry as Types.TraceEvents.SyntheticProfileCall;\n const childNodeEntry = childNode.entry as Types.TraceEvents.SyntheticProfileCall;\n\n if (Helpers.SamplesIntegrator.SamplesIntegrator.framesAreEqual(\n rootNodeEntry.callFrame, childNodeEntry.callFrame)) {\n repeatingNodes.push(childNode.entry);\n }\n } /* Handle SyntheticRendererEvents */ else if (!rootIsProfileCall && !childIsProfileCall) {\n if (root.entry.name === childNode.entry.name) {\n repeatingNodes.push(childNode.entry);\n }\n }\n children.push(...childNode.children);\n }\n }\n\n return repeatingNodes;\n }\n\n /**\n * If an entry was selected from a link instead of clicking on it,\n * it might be in the invisible entries array.\n * If it is, reveal it by resetting clidren the closest modified entry,\n */\n revealEntry(entry: Types.TraceEvents.SyntheticTraceEntry): void {\n const entryNode = this.#entryToNode.get(entry);\n if (!entryNode) {\n // Invalid node was given, just ignore and move on.\n return;\n }\n let closestModifiedParent = entryNode;\n while (closestModifiedParent.parent && !this.#modifiedVisibleEntries.includes(closestModifiedParent.entry)) {\n closestModifiedParent = closestModifiedParent.parent;\n }\n this.#makeEntryChildrenVisible(closestModifiedParent.entry);\n }\n\n /**\n * Removes all of the entry children from the\n * invisible entries array to make them visible.\n **/\n #makeEntryChildrenVisible(entry: Types.TraceEvents.SyntheticTraceEntry): void {\n const entryNode = this.#entryToNode.get(entry);\n if (!entryNode) {\n // Invalid node was given, just ignore and move on.\n return;\n }\n const descendants = this.#findAllDescendantsOfNode(entryNode);\n\n /**\n * Filter out all descendant of the node\n * from the invisible entries list.\n **/\n this.#invisibleEntries = this.#invisibleEntries.filter(entry => {\n if (descendants.includes(entry)) {\n return false;\n }\n return true;\n });\n\n /**\n * Filter out all descentants and entry from modified entries\n * list to not show that some entries below those are hidden.\n **/\n this.#modifiedVisibleEntries = this.#modifiedVisibleEntries.filter(iterEntry => {\n if (descendants.includes(iterEntry) || iterEntry === entry) {\n return false;\n }\n return true;\n });\n }\n\n isEntryModified(event: Types.TraceEvents.TraceEventData): boolean {\n return this.#modifiedVisibleEntries.includes(event);\n }\n}\n"]}
1
+ {"version":3,"file":"EntriesFilter.js","sourceRoot":"","sources":["../../../../../../front_end/models/trace/EntriesFilter.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAC7B,OAAO,KAAK,QAAQ,MAAM,iCAAiC,CAAC;AAE5D,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AA0B1C;;;;;;;;;GASG;AACH,MAAM,OAAO,aAAa;IACxB,sEAAsE;IACtE,0EAA0E;IAC1E,oCAAoC;IACpC,YAAY,CAAiB;IAE7B,sCAAsC;IACtC,iBAAiB,GAAuC,EAA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;QACH,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;YACnE,IAAI,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;gBAC3D,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;IAED,iBAAiB,CAAC,KAAuC;QACvD,OAAO,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;CACF","sourcesContent":["// Copyright 2023 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\nimport * as Platform from '../../core/platform/platform.js';\n\nimport * as Helpers from './helpers/helpers.js';\nimport * as Types from './types/types.js';\n\ntype EntryToNodeMap = Map<Types.TraceEvents.SyntheticTraceEntry, Helpers.TreeHelpers.TraceEntryNode>;\n\nexport const enum FilterAction {\n MERGE_FUNCTION = 'MERGE_FUNCTION',\n COLLAPSE_FUNCTION = 'COLLAPSE_FUNCTION',\n COLLAPSE_REPEATING_DESCENDANTS = 'COLLAPSE_REPEATING_DESCENDANTS',\n RESET_CHILDREN = 'RESET_CHILDREN',\n UNDO_ALL_ACTIONS = 'UNDO_ALL_ACTIONS',\n}\n\nexport interface UserFilterAction {\n type: FilterAction;\n entry: Types.TraceEvents.SyntheticTraceEntry;\n}\n\n// Object used to indicate to the Context Menu if an action is possible on the selected entry.\nexport interface PossibleFilterActions {\n [FilterAction.MERGE_FUNCTION]: boolean;\n [FilterAction.COLLAPSE_FUNCTION]: boolean;\n [FilterAction.COLLAPSE_REPEATING_DESCENDANTS]: boolean;\n [FilterAction.RESET_CHILDREN]: boolean;\n [FilterAction.UNDO_ALL_ACTIONS]: boolean;\n}\n\n/**\n * This class can take in a thread that has been generated by the\n * RendererHandler and apply certain actions to it in order to modify what is\n * shown to the user. These actions can be automatically applied by DevTools or\n * applied by the user.\n *\n * Once actions are applied, the invisibleEntries() method will return the\n * entries that are invisible, and this is the list of entries that should be\n * removed before rendering the resulting thread on the timeline.\n */\nexport class EntriesFilter {\n // Maps from an individual TraceEvent entry to its representation as a\n // RendererEntryNode. We need this so we can then parse the tree structure\n // generated by the RendererHandler.\n #entryToNode: EntryToNodeMap;\n\n // Track the set of invisible entries.\n #invisibleEntries: Types.TraceEvents.TraceEventData[] = [];\n // List of entries whose children are hidden. This list is used to\n // keep track of entries that should be identified in the UI as \"expandable\",\n // since they can be clicked to reveal their hidden children.\n #expandableEntries: Types.TraceEvents.TraceEventData[] = [];\n // Cache for descendants of entry that have already been gathered. The descendants\n // will never change so we can avoid running the potentially expensive search again.\n #entryToDescendantsMap: Map<Helpers.TreeHelpers.TraceEntryNode, Types.TraceEvents.TraceEventData[]> = new Map();\n\n constructor(entryToNodeMap: EntryToNodeMap) {\n this.#entryToNode = entryToNodeMap;\n }\n\n /**\n * Checks which actions can be applied on an entry. This allows us to only show possible actions in the Context Menu.\n * For example, if an entry has no children, COLLAPSE_FUNCTION will not change the FlameChart, therefore there is no need to show this action as an option.\n */\n findPossibleActions(entry: Types.TraceEvents.SyntheticTraceEntry): PossibleFilterActions {\n const entryNode = this.#entryToNode.get(entry);\n if (!entryNode) {\n // Invalid node was given, return no possible actions.\n return {\n [FilterAction.MERGE_FUNCTION]: false,\n [FilterAction.COLLAPSE_FUNCTION]: false,\n [FilterAction.COLLAPSE_REPEATING_DESCENDANTS]: false,\n [FilterAction.RESET_CHILDREN]: false,\n [FilterAction.UNDO_ALL_ACTIONS]: false,\n };\n }\n const entryParent = entryNode.parent;\n const allVisibleDescendants =\n this.#findAllDescendantsOfNode(entryNode).filter(descendant => !this.#invisibleEntries.includes(descendant));\n const allVisibleRepeatingDescendants = this.#findAllRepeatingDescendantsOfNext(entryNode).filter(\n descendant => !this.#invisibleEntries.includes(descendant));\n const allInVisibleDescendants =\n this.#findAllDescendantsOfNode(entryNode).filter(descendant => this.#invisibleEntries.includes(descendant));\n\n // If there are children to hide, indicate action as possible\n const possibleActions: PossibleFilterActions = {\n [FilterAction.MERGE_FUNCTION]: entryParent !== null,\n [FilterAction.COLLAPSE_FUNCTION]: allVisibleDescendants.length > 0,\n [FilterAction.COLLAPSE_REPEATING_DESCENDANTS]: allVisibleRepeatingDescendants.length > 0,\n [FilterAction.RESET_CHILDREN]: allInVisibleDescendants.length > 0,\n [FilterAction.UNDO_ALL_ACTIONS]: this.#invisibleEntries.length > 0,\n };\n return possibleActions;\n }\n\n /**\n * Returns the amount of entry descendants that belong to the hidden entries array.\n * */\n findHiddenDescendantsAmount(entry: Types.TraceEvents.SyntheticTraceEntry): number {\n const entryNode = this.#entryToNode.get(entry);\n if (!entryNode) {\n return 0;\n }\n const allDescendants = this.#findAllDescendantsOfNode(entryNode);\n return allDescendants.filter(descendant => this.invisibleEntries().includes(descendant)).length;\n }\n\n /**\n * Returns the set of entries that are invisible given the set of applied actions.\n */\n invisibleEntries(): Types.TraceEvents.TraceEventData[] {\n return this.#invisibleEntries;\n }\n\n /**\n * Sets hidden and expandable. Called when a trace with modifications is loaded and some entries are set as hidden and expandable.\n * Both arrays are set together because if there is one, the other must be present too.\n */\n setHiddenAndExpandableEntries(\n invisibleEntries: Types.TraceEvents.TraceEventData[],\n expandableEntries: Types.TraceEvents.TraceEventData[]): void {\n this.#invisibleEntries.push(...invisibleEntries);\n this.#expandableEntries.push(...expandableEntries);\n }\n\n inEntryInvisible(entry: Types.TraceEvents.TraceEventData): boolean {\n return this.#invisibleEntries.includes(entry);\n }\n\n /**\n * Returns the array of entries that have a sign indicating that entries below are hidden,\n * and so that they can be \"expanded\" to reveal their hidden children.\n */\n expandableEntries(): Types.TraceEvents.TraceEventData[] {\n return this.#expandableEntries;\n }\n\n /**\n * Applies an action to hide entries or removes entries\n * from hidden entries array depending on the action.\n */\n applyFilterAction(action: UserFilterAction): Types.TraceEvents.TraceEventData[] {\n // We apply new user action to the set of all entries, and mark\n // any that should be hidden by adding them to this set.\n // Another approach would be to use splice() to remove items from the\n // array, but doing this would be a mutation of the arry for every hidden\n // event. Instead, we add entries to this set and return it as an array at the end.\n const entriesToHide = new Set<Types.TraceEvents.TraceEventData>();\n\n switch (action.type) {\n case FilterAction.MERGE_FUNCTION: {\n // The entry that was clicked on is merged into its parent. All its\n // children remain visible, so we just have to hide the entry that was\n // selected.\n entriesToHide.add(action.entry);\n // If parent node exists, add it to expandableEntries, so it would be possible to uncollapse its children.\n const actionNode = this.#entryToNode.get(action.entry) || null;\n const parentNode = actionNode && this.#findNextVisibleParent(actionNode);\n if (parentNode) {\n this.#addExpandableEntry(parentNode.entry);\n }\n break;\n }\n case FilterAction.COLLAPSE_FUNCTION: {\n // The entry itself remains visible, but all of its descendants are hidden.\n const entryNode = this.#entryToNode.get(action.entry);\n if (!entryNode) {\n // Invalid node was given, just ignore and move on.\n break;\n }\n const allDescendants = this.#findAllDescendantsOfNode(entryNode);\n allDescendants.forEach(descendant => entriesToHide.add(descendant));\n this.#addExpandableEntry(action.entry);\n break;\n }\n case FilterAction.COLLAPSE_REPEATING_DESCENDANTS: {\n const entryNode = this.#entryToNode.get(action.entry);\n if (!entryNode) {\n // Invalid node was given, just ignore and move on.\n break;\n }\n const allRepeatingDescendants = this.#findAllRepeatingDescendantsOfNext(entryNode);\n allRepeatingDescendants.forEach(descendant => entriesToHide.add(descendant));\n if (entriesToHide.size > 0) {\n this.#addExpandableEntry(action.entry);\n }\n break;\n }\n case FilterAction.UNDO_ALL_ACTIONS: {\n this.#invisibleEntries = [];\n this.#expandableEntries = [];\n break;\n }\n case FilterAction.RESET_CHILDREN: {\n this.#makeEntryChildrenVisible(action.entry);\n break;\n }\n default:\n Platform.assertNever(action.type, `Unknown EntriesFilter action: ${action.type}`);\n }\n\n this.#invisibleEntries.push(...entriesToHide);\n\n return this.#invisibleEntries;\n }\n\n /**\n * Add an entry to the array of entries that have a sign indicating that entries below are hidden.\n * Also, remove all of the child entries of the new expandable entry from the expandable array. Do that because\n * to draw the initiator from the closest visible entry, we need to get the closest entry that is\n * marked as expandable and we do not want to get some that are hidden.\n */\n #addExpandableEntry(entry: Types.TraceEvents.TraceEventData): void {\n this.#expandableEntries.push(entry);\n const entryNode = this.#entryToNode.get(entry);\n if (!entryNode) {\n // Invalid node was given, just ignore and move on.\n return;\n }\n const allDescendants = this.#findAllDescendantsOfNode(entryNode);\n if (allDescendants.length > 0) {\n this.#expandableEntries = this.#expandableEntries.filter(entry => {\n return !allDescendants.includes(entry);\n });\n }\n }\n\n // The direct parent might be hidden by other actions, therefore we look for the next visible parent.\n #findNextVisibleParent(node: Helpers.TreeHelpers.TraceEntryNode): Helpers.TreeHelpers.TraceEntryNode|null {\n let parent = node.parent;\n while (parent && this.#invisibleEntries.includes(parent.entry)) {\n parent = parent.parent;\n }\n return parent;\n }\n\n #findAllDescendantsOfNode(root: Helpers.TreeHelpers.TraceEntryNode): Types.TraceEvents.TraceEventData[] {\n const cachedDescendants = this.#entryToDescendantsMap.get(root);\n if (cachedDescendants) {\n return cachedDescendants;\n }\n\n const descendants: Types.TraceEvents.TraceEventData[] = [];\n\n // Walk through all the descendants, starting at the root node.\n const children: Helpers.TreeHelpers.TraceEntryNode[] = [...root.children];\n while (children.length > 0) {\n const childNode = children.shift();\n if (childNode) {\n descendants.push(childNode.entry);\n const childNodeCachedDescendants = this.#entryToDescendantsMap.get(childNode);\n // If the descendants of a child are cached, get them from the cache instead of iterating through them again\n if (childNodeCachedDescendants) {\n descendants.push(...childNodeCachedDescendants);\n } else {\n children.push(...childNode.children);\n }\n }\n }\n\n this.#entryToDescendantsMap.set(root, descendants);\n return descendants;\n }\n\n #findAllRepeatingDescendantsOfNext(root: Helpers.TreeHelpers.TraceEntryNode):\n Types.TraceEvents.SyntheticTraceEntry[] {\n // Walk through all the ancestors, starting at the root node.\n const children: Helpers.TreeHelpers.TraceEntryNode[] = [...root.children];\n const repeatingNodes: Types.TraceEvents.SyntheticTraceEntry[] = [];\n const rootIsProfileCall = Types.TraceEvents.isProfileCall(root.entry);\n\n while (children.length > 0) {\n const childNode = children.shift();\n if (childNode) {\n const childIsProfileCall = Types.TraceEvents.isProfileCall(childNode.entry);\n if (/* Handle SyntheticProfileCalls */ rootIsProfileCall && childIsProfileCall) {\n const rootNodeEntry = root.entry as Types.TraceEvents.SyntheticProfileCall;\n const childNodeEntry = childNode.entry as Types.TraceEvents.SyntheticProfileCall;\n\n if (Helpers.SamplesIntegrator.SamplesIntegrator.framesAreEqual(\n rootNodeEntry.callFrame, childNodeEntry.callFrame)) {\n repeatingNodes.push(childNode.entry);\n }\n } /* Handle SyntheticRendererEvents */ else if (!rootIsProfileCall && !childIsProfileCall) {\n if (root.entry.name === childNode.entry.name) {\n repeatingNodes.push(childNode.entry);\n }\n }\n children.push(...childNode.children);\n }\n }\n\n return repeatingNodes;\n }\n\n /**\n * If an entry was selected from a link instead of clicking on it,\n * it might be in the invisible entries array.\n * If it is, reveal it by resetting clidren the closest expandable entry,\n */\n revealEntry(entry: Types.TraceEvents.SyntheticTraceEntry): void {\n const entryNode = this.#entryToNode.get(entry);\n if (!entryNode) {\n // Invalid node was given, just ignore and move on.\n return;\n }\n let closestExpandableParent = entryNode;\n while (closestExpandableParent.parent && !this.#expandableEntries.includes(closestExpandableParent.entry)) {\n closestExpandableParent = closestExpandableParent.parent;\n }\n this.#makeEntryChildrenVisible(closestExpandableParent.entry);\n }\n\n /**\n * Removes all of the entry children from the\n * invisible entries array to make them visible.\n */\n #makeEntryChildrenVisible(entry: Types.TraceEvents.SyntheticTraceEntry): void {\n const entryNode = this.#entryToNode.get(entry);\n if (!entryNode) {\n // Invalid node was given, just ignore and move on.\n return;\n }\n const descendants = this.#findAllDescendantsOfNode(entryNode);\n\n /**\n * Filter out all descendant of the node\n * from the invisible entries list.\n */\n this.#invisibleEntries = this.#invisibleEntries.filter(entry => {\n if (descendants.includes(entry)) {\n return false;\n }\n return true;\n });\n\n /**\n * Filter out all descentants and entry from expandable entries\n * list to not show that some entries below those are hidden.\n */\n this.#expandableEntries = this.#expandableEntries.filter(iterEntry => {\n if (descendants.includes(iterEntry) || iterEntry === entry) {\n return false;\n }\n return true;\n });\n }\n\n isEntryExpandable(event: Types.TraceEvents.TraceEventData): boolean {\n return this.#expandableEntries.includes(event);\n }\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import * as Handlers from './handlers/handlers.js';
2
+ import * as Helpers from './helpers/helpers.js';
2
3
  import type * as Insights from './insights/insights.js';
3
4
  import * as Types from './types/types.js';
4
5
  export interface ParseConfig {
@@ -20,7 +21,7 @@ export interface ParseConfig {
20
21
  **/
21
22
  export declare class Model<EnabledModelHandlers extends {
22
23
  [key: string]: Handlers.Types.TraceEventHandler;
23
- }> extends EventTarget {
24
+ } = typeof Handlers.ModelHandlers> extends EventTarget {
24
25
  #private;
25
26
  static createWithAllHandlers(config?: Types.Configuration.Configuration): Model<typeof Handlers.ModelHandlers>;
26
27
  constructor(handlers: EnabledModelHandlers, config?: Types.Configuration.Configuration);
@@ -58,9 +59,10 @@ export declare class Model<EnabledModelHandlers extends {
58
59
  */
59
60
  traceParsedData(index?: number): Handlers.Types.EnabledHandlerDataWithMeta<EnabledModelHandlers> | null;
60
61
  traceInsights(index?: number): Insights.Types.TraceInsightData<EnabledModelHandlers> | null;
61
- metadata(index: number): Types.File.MetaData | null;
62
- overrideAnnotations(index: number, newAnnotations: Types.File.Annotations): void;
63
- traceEvents(index: number): readonly Types.TraceEvents.TraceEventData[] | null;
62
+ metadata(index?: number): Types.File.MetaData | null;
63
+ overrideModifications(index: number, newModifications: Types.File.Modifications): void;
64
+ rawTraceEvents(index?: number): readonly Types.TraceEvents.TraceEventData[] | null;
65
+ syntheticTraceEventsManager(index?: number): Helpers.SyntheticEvents.SyntheticEventsManager | null;
64
66
  size(): number;
65
67
  deleteTraceByIndex(recordingIndex: number): void;
66
68
  getRecordingsAvailable(): string[];