@paulirish/trace_engine 0.0.22 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generated/protocol.d.ts +60 -4
- package/models/trace/EntriesFilter.d.ts +14 -13
- package/models/trace/EntriesFilter.js +40 -38
- package/models/trace/EntriesFilter.js.map +1 -1
- package/models/trace/ModelImpl.d.ts +6 -4
- package/models/trace/ModelImpl.js +13 -4
- package/models/trace/ModelImpl.js.map +1 -1
- package/models/trace/Processor.js +6 -1
- package/models/trace/Processor.js.map +1 -1
- package/models/trace/TracingManager.js.map +1 -1
- package/models/trace/extras/FetchNodes.js +1 -1
- package/models/trace/extras/FetchNodes.js.map +1 -1
- package/models/trace/extras/URLForEntry.d.ts +4 -0
- package/models/trace/extras/URLForEntry.js +35 -0
- package/models/trace/extras/URLForEntry.js.map +1 -0
- package/models/trace/extras/extras-tsconfig.json +1 -0
- package/models/trace/extras/extras.js.map +1 -1
- package/models/trace/handlers/AuctionWorkletsHandler.js +5 -2
- package/models/trace/handlers/AuctionWorkletsHandler.js.map +1 -1
- package/models/trace/handlers/ExtensionTraceDataHandler.js +18 -5
- package/models/trace/handlers/ExtensionTraceDataHandler.js.map +1 -1
- package/models/trace/handlers/InitiatorsHandler.js +1 -12
- package/models/trace/handlers/InitiatorsHandler.js.map +1 -1
- package/models/trace/handlers/LayoutShiftsHandler.d.ts +1 -0
- package/models/trace/handlers/LayoutShiftsHandler.js +11 -2
- package/models/trace/handlers/LayoutShiftsHandler.js.map +1 -1
- package/models/trace/handlers/NetworkRequestsHandler.d.ts +1 -1
- package/models/trace/handlers/NetworkRequestsHandler.js +6 -4
- package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -1
- package/models/trace/handlers/PageLoadMetricsHandler.js +1 -1
- package/models/trace/handlers/PageLoadMetricsHandler.js.map +1 -1
- package/models/trace/handlers/RendererHandler.d.ts +1 -0
- package/models/trace/handlers/RendererHandler.js +2 -0
- package/models/trace/handlers/RendererHandler.js.map +1 -1
- package/models/trace/handlers/ScreenshotsHandler.js +4 -2
- package/models/trace/handlers/ScreenshotsHandler.js.map +1 -1
- package/models/trace/handlers/UserInteractionsHandler.js +4 -2
- package/models/trace/handlers/UserInteractionsHandler.js.map +1 -1
- package/models/trace/helpers/Extensions.js +4 -0
- package/models/trace/helpers/Extensions.js.map +1 -1
- package/models/trace/helpers/SyntheticEvents.d.ts +30 -0
- package/models/trace/helpers/SyntheticEvents.js +87 -0
- package/models/trace/helpers/SyntheticEvents.js.map +1 -0
- package/models/trace/helpers/Trace.d.ts +2 -0
- package/models/trace/helpers/Trace.js +23 -3
- package/models/trace/helpers/Trace.js.map +1 -1
- package/models/trace/helpers/TreeHelpers.d.ts +20 -0
- package/models/trace/helpers/TreeHelpers.js +50 -0
- package/models/trace/helpers/TreeHelpers.js.map +1 -1
- package/models/trace/helpers/helpers-tsconfig.json +1 -0
- package/models/trace/helpers/helpers.d.ts +1 -0
- package/models/trace/helpers/helpers.js +1 -0
- package/models/trace/helpers/helpers.js.map +1 -1
- package/models/trace/insights/CumulativeLayoutShift.d.ts +7 -2
- package/models/trace/insights/CumulativeLayoutShift.js +130 -2
- package/models/trace/insights/CumulativeLayoutShift.js.map +1 -1
- package/models/trace/insights/RenderBlocking.js +14 -0
- package/models/trace/insights/RenderBlocking.js.map +1 -1
- package/models/trace/trace-tsconfig.json +0 -1
- package/models/trace/trace.d.ts +1 -2
- package/models/trace/trace.js +1 -4
- package/models/trace/trace.js.map +1 -1
- package/models/trace/types/File.d.ts +11 -6
- package/models/trace/types/File.js +0 -3
- package/models/trace/types/File.js.map +1 -1
- package/models/trace/types/TraceEvents.d.ts +104 -10
- package/models/trace/types/TraceEvents.js +46 -2
- package/models/trace/types/TraceEvents.js.map +1 -1
- package/package.json +1 -1
package/generated/protocol.d.ts
CHANGED
|
@@ -1060,6 +1060,9 @@ export declare namespace Audits {
|
|
|
1060
1060
|
*/
|
|
1061
1061
|
interface CookieDeprecationMetadataIssueDetails {
|
|
1062
1062
|
allowedSites: string[];
|
|
1063
|
+
optOutPercentage: number;
|
|
1064
|
+
isOptOutTopLevel: boolean;
|
|
1065
|
+
operation: CookieOperation;
|
|
1063
1066
|
}
|
|
1064
1067
|
const enum ClientHintIssueReason {
|
|
1065
1068
|
MetaTagAllowListInvalidOrigin = "MetaTagAllowListInvalidOrigin",
|
|
@@ -1114,7 +1117,8 @@ export declare namespace Audits {
|
|
|
1114
1117
|
ThirdPartyCookiesBlocked = "ThirdPartyCookiesBlocked",
|
|
1115
1118
|
NotSignedInWithIdp = "NotSignedInWithIdp",
|
|
1116
1119
|
MissingTransientUserActivation = "MissingTransientUserActivation",
|
|
1117
|
-
ReplacedByButtonMode = "ReplacedByButtonMode"
|
|
1120
|
+
ReplacedByButtonMode = "ReplacedByButtonMode",
|
|
1121
|
+
RelyingPartyOriginIsOpaque = "RelyingPartyOriginIsOpaque"
|
|
1118
1122
|
}
|
|
1119
1123
|
interface FederatedAuthUserInfoRequestIssueDetails {
|
|
1120
1124
|
federatedAuthUserInfoRequestIssueReason: FederatedAuthUserInfoRequestIssueReason;
|
|
@@ -3417,13 +3421,14 @@ export declare namespace DOM {
|
|
|
3417
3421
|
Marker = "marker",
|
|
3418
3422
|
Backdrop = "backdrop",
|
|
3419
3423
|
Selection = "selection",
|
|
3424
|
+
SearchText = "search-text",
|
|
3420
3425
|
TargetText = "target-text",
|
|
3421
3426
|
SpellingError = "spelling-error",
|
|
3422
3427
|
GrammarError = "grammar-error",
|
|
3423
3428
|
Highlight = "highlight",
|
|
3424
3429
|
FirstLineInherited = "first-line-inherited",
|
|
3425
3430
|
ScrollMarker = "scroll-marker",
|
|
3426
|
-
|
|
3431
|
+
ScrollMarkerGroup = "scroll-marker-group",
|
|
3427
3432
|
Scrollbar = "scrollbar",
|
|
3428
3433
|
ScrollbarThumb = "scrollbar-thumb",
|
|
3429
3434
|
ScrollbarButton = "scrollbar-button",
|
|
@@ -4361,6 +4366,25 @@ export declare namespace DOM {
|
|
|
4361
4366
|
*/
|
|
4362
4367
|
nodeIds: NodeId[];
|
|
4363
4368
|
}
|
|
4369
|
+
interface GetAnchorElementRequest {
|
|
4370
|
+
/**
|
|
4371
|
+
* Id of the positioned element from which to find the anchor.
|
|
4372
|
+
*/
|
|
4373
|
+
nodeId: NodeId;
|
|
4374
|
+
/**
|
|
4375
|
+
* An optional anchor specifier, as defined in
|
|
4376
|
+
* https://www.w3.org/TR/css-anchor-position-1/#anchor-specifier.
|
|
4377
|
+
* If not provided, it will return the implicit anchor element for
|
|
4378
|
+
* the given positioned element.
|
|
4379
|
+
*/
|
|
4380
|
+
anchorSpecifier?: string;
|
|
4381
|
+
}
|
|
4382
|
+
interface GetAnchorElementResponse extends ProtocolResponseWithError {
|
|
4383
|
+
/**
|
|
4384
|
+
* The anchor element of the given anchor query.
|
|
4385
|
+
*/
|
|
4386
|
+
nodeId: NodeId;
|
|
4387
|
+
}
|
|
4364
4388
|
/**
|
|
4365
4389
|
* Fired when `Element`'s attribute is modified.
|
|
4366
4390
|
*/
|
|
@@ -7413,6 +7437,14 @@ export declare namespace Network {
|
|
|
7413
7437
|
* Settled fetch event respondWith promise.
|
|
7414
7438
|
*/
|
|
7415
7439
|
workerRespondWithSettled: number;
|
|
7440
|
+
/**
|
|
7441
|
+
* Started ServiceWorker static routing source evaluation.
|
|
7442
|
+
*/
|
|
7443
|
+
workerRouterEvaluationStart?: number;
|
|
7444
|
+
/**
|
|
7445
|
+
* Started cache lookup when the source was evaluated to `cache`.
|
|
7446
|
+
*/
|
|
7447
|
+
workerCacheLookupStart?: number;
|
|
7416
7448
|
/**
|
|
7417
7449
|
* Started sending request.
|
|
7418
7450
|
*/
|
|
@@ -7766,6 +7798,10 @@ export declare namespace Network {
|
|
|
7766
7798
|
* field will be set, otherwise no value will be set.
|
|
7767
7799
|
*/
|
|
7768
7800
|
matchedSourceType?: ServiceWorkerRouterSource;
|
|
7801
|
+
/**
|
|
7802
|
+
* The actual router source used.
|
|
7803
|
+
*/
|
|
7804
|
+
actualSourceType?: ServiceWorkerRouterSource;
|
|
7769
7805
|
}
|
|
7770
7806
|
/**
|
|
7771
7807
|
* HTTP response data.
|
|
@@ -8132,7 +8168,8 @@ export declare namespace Network {
|
|
|
8132
8168
|
EnterprisePolicy = "EnterprisePolicy",
|
|
8133
8169
|
StorageAccess = "StorageAccess",
|
|
8134
8170
|
TopLevelStorageAccess = "TopLevelStorageAccess",
|
|
8135
|
-
CorsOptIn = "CorsOptIn"
|
|
8171
|
+
CorsOptIn = "CorsOptIn",
|
|
8172
|
+
Scheme = "Scheme"
|
|
8136
8173
|
}
|
|
8137
8174
|
/**
|
|
8138
8175
|
* A cookie which was not stored from a response with the corresponding reason.
|
|
@@ -9582,7 +9619,7 @@ export declare namespace Network {
|
|
|
9582
9619
|
FailedPrecondition = "FailedPrecondition",
|
|
9583
9620
|
ResourceExhausted = "ResourceExhausted",
|
|
9584
9621
|
AlreadyExists = "AlreadyExists",
|
|
9585
|
-
|
|
9622
|
+
ResourceLimited = "ResourceLimited",
|
|
9586
9623
|
Unauthorized = "Unauthorized",
|
|
9587
9624
|
BadResponse = "BadResponse",
|
|
9588
9625
|
InternalError = "InternalError",
|
|
@@ -11807,6 +11844,12 @@ export declare namespace Page {
|
|
|
11807
11844
|
* Argument will be ignored if reloading dataURL origin.
|
|
11808
11845
|
*/
|
|
11809
11846
|
scriptToEvaluateOnLoad?: string;
|
|
11847
|
+
/**
|
|
11848
|
+
* If set, an error will be thrown if the target page's main frame's
|
|
11849
|
+
* loader id does not match the provided id. This prevents accidentally
|
|
11850
|
+
* reloading an unintended target in case there's a racing navigation.
|
|
11851
|
+
*/
|
|
11852
|
+
loaderId?: Network.LoaderId;
|
|
11810
11853
|
}
|
|
11811
11854
|
interface RemoveScriptToEvaluateOnLoadRequest {
|
|
11812
11855
|
identifier: ScriptIdentifier;
|
|
@@ -15956,6 +15999,19 @@ export declare namespace PWA {
|
|
|
15956
15999
|
*/
|
|
15957
16000
|
targetId: Target.TargetID;
|
|
15958
16001
|
}
|
|
16002
|
+
interface LaunchFilesInAppRequest {
|
|
16003
|
+
manifestId: string;
|
|
16004
|
+
files: string[];
|
|
16005
|
+
}
|
|
16006
|
+
interface LaunchFilesInAppResponse extends ProtocolResponseWithError {
|
|
16007
|
+
/**
|
|
16008
|
+
* IDs of the tab targets created as the result.
|
|
16009
|
+
*/
|
|
16010
|
+
targetIds: Target.TargetID[];
|
|
16011
|
+
}
|
|
16012
|
+
interface OpenCurrentPageInAppRequest {
|
|
16013
|
+
manifestId: string;
|
|
16014
|
+
}
|
|
15959
16015
|
}
|
|
15960
16016
|
/**
|
|
15961
16017
|
* 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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
67
|
+
* If it is, reveal it by resetting clidren the closest expandable entry,
|
|
67
68
|
*/
|
|
68
69
|
revealEntry(entry: Types.TraceEvents.SyntheticTraceEntry): void;
|
|
69
|
-
|
|
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
|
|
25
|
-
// keep track of entries that should be identified in the UI as
|
|
26
|
-
|
|
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
|
|
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
|
-
|
|
84
|
+
*/
|
|
85
|
+
setHiddenAndExpandableEntries(invisibleEntries, expandableEntries) {
|
|
85
86
|
this.#invisibleEntries.push(...invisibleEntries);
|
|
86
|
-
this.#
|
|
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
|
-
|
|
95
|
-
|
|
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
|
|
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.#
|
|
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.#
|
|
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.#
|
|
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.#
|
|
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
|
|
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
|
|
168
|
+
* marked as expandable and we do not want to get some that are hidden.
|
|
167
169
|
*/
|
|
168
|
-
#
|
|
169
|
-
this.#
|
|
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.#
|
|
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
|
|
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
|
|
253
|
-
while (
|
|
254
|
-
|
|
254
|
+
let closestExpandableParent = entryNode;
|
|
255
|
+
while (closestExpandableParent.parent && !this.#expandableEntries.includes(closestExpandableParent.entry)) {
|
|
256
|
+
closestExpandableParent = closestExpandableParent.parent;
|
|
255
257
|
}
|
|
256
|
-
this.#makeEntryChildrenVisible(
|
|
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
|
|
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.#
|
|
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
|
-
|
|
291
|
-
return this.#
|
|
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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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,EAAE,CAAC;IAC3D,kEAAkE;IAClE,6EAA6E;IAC7E,6DAA6D;IAC7D,kBAAkB,GAAuC,EAAE,CAAC;IAC5D,kFAAkF;IAClF,oFAAoF;IACpF,sBAAsB,GAAgF,IAAI,GAAG,EAAE,CAAC;IAEhH,YAAY,cAA8B;QACxC,IAAI,CAAC,YAAY,GAAG,cAAc,CAAC;IACrC,CAAC;IAED;;;OAGG;IACH,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;gBACp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,uBAAuB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1G,uBAAuB,GAAG,uBAAuB,CAAC,MAAM,CAAC;QAC3D,CAAC;QACD,IAAI,CAAC,yBAAyB,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;IAED;;;OAGG;IACH,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;;;WAGG;QACH,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;;;WAGG;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
|
|
62
|
-
|
|
63
|
-
|
|
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[];
|
|
@@ -21,6 +21,7 @@ import * as Types from './types/types.js';
|
|
|
21
21
|
**/
|
|
22
22
|
export class Model extends EventTarget {
|
|
23
23
|
#traces = [];
|
|
24
|
+
#syntheticEventsManagerByTrace = [];
|
|
24
25
|
#nextNumberByDomain = new Map();
|
|
25
26
|
#recordingsAvailable = [];
|
|
26
27
|
#lastRecordingIndex = 0;
|
|
@@ -83,11 +84,13 @@ export class Model extends EventTarget {
|
|
|
83
84
|
try {
|
|
84
85
|
// Wait for all outstanding promises before finishing the async execution,
|
|
85
86
|
// but perform all tasks in parallel.
|
|
87
|
+
const syntheticEventsManager = Helpers.SyntheticEvents.SyntheticEventsManager.initSyntheticEventsManagerForTrace(traceEvents);
|
|
86
88
|
await this.#processor.parse(traceEvents, isFreshRecording);
|
|
87
89
|
this.#storeParsedFileData(file, this.#processor.traceParsedData, this.#processor.insights);
|
|
88
90
|
// We only push the file onto this.#traces here once we know it's valid
|
|
89
91
|
// and there's been no errors in the parsing.
|
|
90
92
|
this.#traces.push(file);
|
|
93
|
+
this.#syntheticEventsManagerByTrace.push(syntheticEventsManager);
|
|
91
94
|
}
|
|
92
95
|
catch (e) {
|
|
93
96
|
throw e;
|
|
@@ -131,23 +134,29 @@ export class Model extends EventTarget {
|
|
|
131
134
|
}
|
|
132
135
|
return this.#traces[index].traceInsights;
|
|
133
136
|
}
|
|
134
|
-
metadata(index) {
|
|
137
|
+
metadata(index = this.#traces.length - 1) {
|
|
135
138
|
if (!this.#traces[index]) {
|
|
136
139
|
return null;
|
|
137
140
|
}
|
|
138
141
|
return this.#traces[index].metadata;
|
|
139
142
|
}
|
|
140
|
-
|
|
143
|
+
overrideModifications(index, newModifications) {
|
|
141
144
|
if (this.#traces[index]) {
|
|
142
|
-
this.#traces[index].metadata.
|
|
145
|
+
this.#traces[index].metadata.modifications = newModifications;
|
|
143
146
|
}
|
|
144
147
|
}
|
|
145
|
-
|
|
148
|
+
rawTraceEvents(index = this.#traces.length - 1) {
|
|
146
149
|
if (!this.#traces[index]) {
|
|
147
150
|
return null;
|
|
148
151
|
}
|
|
149
152
|
return this.#traces[index].traceEvents;
|
|
150
153
|
}
|
|
154
|
+
syntheticTraceEventsManager(index = this.#traces.length - 1) {
|
|
155
|
+
if (!this.#syntheticEventsManagerByTrace[index]) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
return this.#syntheticEventsManagerByTrace[index];
|
|
159
|
+
}
|
|
151
160
|
size() {
|
|
152
161
|
return this.#traces.length;
|
|
153
162
|
}
|