@paulirish/trace_engine 0.0.14 → 0.0.16
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/LICENSE +27 -0
- package/PAUL.readme.md +5 -0
- package/README.md +156 -0
- package/analyze-trace.mjs +184 -0
- package/core/platform/array-utilities.d.ts +66 -0
- package/core/platform/array-utilities.js +199 -0
- package/core/platform/array-utilities.js.map +1 -0
- package/core/platform/date-utilities.d.ts +2 -0
- package/core/platform/date-utilities.js +14 -0
- package/core/platform/date-utilities.js.map +1 -0
- package/core/platform/dcheck-tsconfig.json +8 -0
- package/core/platform/dcheck.d.ts +4 -0
- package/core/platform/dcheck.js +5 -0
- package/core/platform/dom-utilities.d.ts +8 -0
- package/core/platform/dom-utilities.js +109 -0
- package/core/platform/dom-utilities.js.map +1 -0
- package/core/platform/keyboard-utilities.d.ts +17 -0
- package/core/platform/keyboard-utilities.js +22 -0
- package/core/platform/keyboard-utilities.js.map +1 -0
- package/core/platform/map-utilities.d.ts +18 -0
- package/core/platform/map-utilities.js +76 -0
- package/core/platform/map-utilities.js.map +1 -0
- package/core/platform/number-utilities.d.ts +15 -0
- package/core/platform/number-utilities.js +82 -0
- package/core/platform/number-utilities.js.map +1 -0
- package/core/platform/promise-utilities.d.ts +10 -0
- package/core/platform/promise-utilities.js +18 -0
- package/core/platform/promise-utilities.js.map +1 -0
- package/core/platform/set-utilities.d.ts +2 -0
- package/core/platform/set-utilities.js +23 -0
- package/core/platform/set-utilities.js.map +1 -0
- package/core/platform/string-utilities.d.ts +71 -0
- package/core/platform/string-utilities.js +513 -0
- package/core/platform/string-utilities.js.map +1 -0
- package/core/platform/typescript-utilities.d.ts +56 -0
- package/core/platform/typescript-utilities.js +25 -0
- package/core/platform/typescript-utilities.js.map +1 -0
- package/models/trace/EntriesFilter.d.ts +6 -0
- package/models/trace/EntriesFilter.js +17 -0
- package/models/trace/EntriesFilter.js.map +1 -1
- package/package.json +8 -6
- package/test/invalid-animation-events.json.gz +0 -0
- package/test/test-trace-engine.mjs +52 -0
- /package/core/platform/{Brand.d.ts → brand.d.ts} +0 -0
- /package/core/platform/{Brand.js → brand.js} +0 -0
- /package/core/platform/{Brand.js.map → brand.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript-utilities.js","sourceRoot":"","sources":["../../../../../../front_end/core/platform/typescript-utilities.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAI,GAAM,EAAE,OAAgB;IAClE,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE;QACrC,MAAM,IAAI,KAAK,CAAC,6DAA6D,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;KACrH;AACH,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAW,EAAE,OAAe;IACtD,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAI,aAAgB;IACjD,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["// Copyright 2020 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n/**\n * This is useful to keep TypeScript happy in a test - if you have a value\n * that's potentially `null` you can use this function to assert that it isn't,\n * and satisfy TypeScript that the value is present.\n */\nexport function assertNotNullOrUndefined<T>(val: T, message?: string): asserts val is NonNullable<T> {\n if (val === null || val === undefined) {\n throw new Error(`Expected given value to not be null/undefined but it was: ${val}${message ? `\\n${message}` : ''}`);\n }\n}\n\nexport function assertNever(type: never, message: string): never {\n throw new Error(message);\n}\n\n/**\n * This is useful to check on the type-level that the unhandled cases of\n * a switch are exactly `T` (where T is usually a union type of enum values).\n * @param caseVariable\n */\nexport function assertUnhandled<T>(_caseVariable: T): T {\n return _caseVariable;\n}\n\nexport type FieldsThatExtend<Type, Selector> = {\n [Key in keyof Type]: Type[Key] extends Selector ? Key : never;\n}[keyof Type];\n\nexport type PickFieldsThatExtend<Type, Selector> = Pick<Type, FieldsThatExtend<Type, Selector>>;\n\n/**\n * Turns a Union type (a | b) into an Intersection type (a & b).\n * This is a helper type to implement the \"NoUnion\" guard.\n *\n * Adapted from https://stackoverflow.com/a/50375286.\n *\n * The tautological `T extends any` is necessary to trigger distributivity for\n * plain unions, e.g. in IntersectionFromUnion<'a'|'b'> TypeScript expands it\n * to ('a' extends any ? (arg: 'a') => void : never)\n * | ('b' extends any ? (arg: 'b') => void : never)\n *\n * The second extends clause then asks TypeScript to find a type of the form\n * `(arg: infer U) => void` that upper-bounds the union, i.e., intuitively,\n * a type that converts to each of the union members. This forces U to be the\n * intersection of 'a' and 'b' in the example.\n *\n * Please note that some intersection types are simply impossible, e.g.\n * `string & number`. There is no type that fulfills both at the same time. A\n * union of this kind is reduced to `never`.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype IntersectionFromUnion<T> = (T extends any ? (arg: T) => void : never) extends((arg: infer U) => void) ? U : never;\n\n/**\n * When writing generic code it may be desired to disallow Union types from\n * being passed. This type can be used in those cases.\n *\n * function foo<T>(argument: NoUnion<T>) {...}\n *\n * Would result in a compile error for foo<a|b>(...); invocations as `argument`\n * would be typed as `never`.\n *\n * Adapted from https://stackoverflow.com/a/50641073.\n *\n * Conditional types become distributive when receiving a union type. To\n * prevent this from happening, we use `[T] extends [IntersectionFromUnion<T>]`\n * instead of `T extends IntersectionFromUnion<T>`.\n * See: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html\n */\nexport type NoUnion<T> = [T] extends [IntersectionFromUnion<T>] ? T : never;\n"]}
|
|
@@ -54,6 +54,12 @@ export declare class EntriesFilter {
|
|
|
54
54
|
* from hidden entries array depending on the action.
|
|
55
55
|
**/
|
|
56
56
|
applyFilterAction(action: UserFilterAction): Types.TraceEvents.TraceEventData[];
|
|
57
|
+
/**
|
|
58
|
+
* If an entry was selected from a link instead of clicking on it,
|
|
59
|
+
* it might be in the invisible entries array.
|
|
60
|
+
* If it is, reveal it by resetting clidren the closest modified entry,
|
|
61
|
+
*/
|
|
62
|
+
revealEntry(entry: Types.TraceEvents.SyntheticTraceEntry): void;
|
|
57
63
|
isEntryModified(event: Types.TraceEvents.TraceEventData): boolean;
|
|
58
64
|
}
|
|
59
65
|
export {};
|
|
@@ -227,6 +227,23 @@ export class EntriesFilter {
|
|
|
227
227
|
}
|
|
228
228
|
return repeatingNodes;
|
|
229
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* If an entry was selected from a link instead of clicking on it,
|
|
232
|
+
* it might be in the invisible entries array.
|
|
233
|
+
* If it is, reveal it by resetting clidren the closest modified entry,
|
|
234
|
+
*/
|
|
235
|
+
revealEntry(entry) {
|
|
236
|
+
const entryNode = this.#entryToNode.get(entry);
|
|
237
|
+
if (!entryNode) {
|
|
238
|
+
// Invalid node was given, just ignore and move on.
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
let closestModifiedParent = entryNode;
|
|
242
|
+
while (closestModifiedParent.parent && !this.#modifiedVisibleEntries.includes(closestModifiedParent.entry)) {
|
|
243
|
+
closestModifiedParent = closestModifiedParent.parent;
|
|
244
|
+
}
|
|
245
|
+
this.#makeEntryChildrenVisible(closestModifiedParent.entry);
|
|
246
|
+
}
|
|
230
247
|
/**
|
|
231
248
|
* Removes all of the entry children from the
|
|
232
249
|
* invisible entries array to make them visible.
|
|
@@ -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;AAC5D,OAAO,KAAK,OAAO,MAAM,sBAAsB,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AAC,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;gBAC/B,OAAO,KAAK,CAAC;aACd;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;gBAC1D,OAAO,KAAK,CAAC;aACd;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';\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(entryToNode: EntryToNodeMap) {\n this.#entryToNode = entryToNode;\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 * 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 * 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;AAC5D,OAAO,KAAK,OA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S,CAAC;QACtC,OAAO,qBAAqB,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE;YAC1G,qBAAqB,GAAG,qBAAqB,CAAC,MAAM,CAAC;SACtD;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;YACd,mDAAmD;YACnD,OAAO;SACR;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;gBAC/B,OAAO,KAAK,CAAC;aACd;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;gBAC1D,OAAO,KAAK,CAAC;aACd;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';\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(entryToNode: EntryToNodeMap) {\n this.#entryToNode = entryToNode;\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 * 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"]}
|
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paulirish/trace_engine",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "",
|
|
5
|
+
"main": "models/trace/trace.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "node test/test-trace-engine.mjs",
|
|
8
|
+
"prepublishOnly": "npm test"
|
|
9
|
+
},
|
|
5
10
|
"type": "module",
|
|
6
11
|
"keywords": [],
|
|
7
12
|
"author": "",
|
|
8
13
|
"license": "BSD-3-Clause",
|
|
9
|
-
"dependencies": {
|
|
10
|
-
}
|
|
11
|
-
"devDependencies": {
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
+
"dependencies": {},
|
|
15
|
+
"devDependencies": {}
|
|
14
16
|
}
|
|
Binary file
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Copyright 2023 The Chromium Authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import {strict as assert} from 'assert';
|
|
6
|
+
import test from 'node:test';
|
|
7
|
+
|
|
8
|
+
import {analyzeTrace} from '../analyze-trace.mjs';
|
|
9
|
+
|
|
10
|
+
const filename = './test/invalid-animation-events.json.gz';
|
|
11
|
+
const data = await analyzeTrace(filename);
|
|
12
|
+
|
|
13
|
+
test('key values are populated', t => {
|
|
14
|
+
assert.equal(data.Renderer.allTraceEntries.length > 90_000, true);
|
|
15
|
+
assert.equal(data.Screenshots.length > 2, true);
|
|
16
|
+
assert.equal(data.Meta.threadsInProcess.size > 2, true);
|
|
17
|
+
assert.equal(data.Meta.mainFrameNavigations.length > 0, true);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test('numeric values are set and look legit', t => {
|
|
21
|
+
const shouldBeNumbers = [
|
|
22
|
+
data.Meta.traceBounds.min,
|
|
23
|
+
data.Meta.traceBounds.max,
|
|
24
|
+
data.Meta.traceBounds.range,
|
|
25
|
+
data.Meta.browserProcessId,
|
|
26
|
+
data.Meta.browserThreadId,
|
|
27
|
+
data.Meta.gpuProcessId,
|
|
28
|
+
data.Meta.gpuThreadId,
|
|
29
|
+
Array.from(data.Meta.topLevelRendererIds.values()).at(0),
|
|
30
|
+
Array.from(data.Meta.frameByProcessId.keys()).at(0),
|
|
31
|
+
];
|
|
32
|
+
for (const datum of shouldBeNumbers) {
|
|
33
|
+
assert.equal(isNaN(datum), false);
|
|
34
|
+
assert.equal(typeof datum, 'number');
|
|
35
|
+
assert.equal(datum > 10, true);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('string values are set and look legit', t => {
|
|
40
|
+
const shouldBeStrings = [
|
|
41
|
+
data.Meta.mainFrameId,
|
|
42
|
+
data.Meta.mainFrameURL,
|
|
43
|
+
Array.from(data.Meta.navigationsByFrameId.keys()).at(0),
|
|
44
|
+
Array.from(data.Meta.navigationsByNavigationId.keys()).at(0),
|
|
45
|
+
data.Meta.mainFrameId,
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
for (const datum of shouldBeStrings) {
|
|
49
|
+
assert.equal(typeof datum, 'string');
|
|
50
|
+
assert.equal(datum.length > 10, true);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|