@paulirish/trace_engine 0.0.11 → 0.0.13
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/core/platform/{array-utilities.js → ArrayUtilities.js} +1 -1
- package/core/platform/ArrayUtilities.js.map +1 -0
- package/core/platform/{brand.js → Brand.js} +1 -1
- package/core/platform/{brand.js.map → Brand.js.map} +1 -1
- package/core/platform/{dom-utilities.js → DOMUtilities.js} +1 -1
- package/core/platform/DOMUtilities.js.map +1 -0
- package/core/platform/{date-utilities.js → DateUtilities.js} +1 -1
- package/core/platform/DateUtilities.js.map +1 -0
- package/core/platform/DevToolsPath.d.ts +1 -1
- package/core/platform/DevToolsPath.js.map +1 -1
- package/core/platform/{keyboard-utilities.js → KeyboardUtilities.js} +1 -1
- package/core/platform/KeyboardUtilities.js.map +1 -0
- package/core/platform/{map-utilities.js → MapUtilities.js} +1 -1
- package/core/platform/MapUtilities.js.map +1 -0
- package/core/platform/{number-utilities.js → NumberUtilities.js} +1 -1
- package/core/platform/NumberUtilities.js.map +1 -0
- package/core/platform/{promise-utilities.js → PromiseUtilities.js} +1 -1
- package/core/platform/PromiseUtilities.js.map +1 -0
- package/core/platform/{set-utilities.js → SetUtilities.js} +1 -1
- package/core/platform/SetUtilities.js.map +1 -0
- package/core/platform/{string-utilities.js → StringUtilities.js} +4 -4
- package/core/platform/StringUtilities.js.map +1 -0
- package/core/platform/Timing.d.ts +1 -1
- package/core/platform/Timing.js.map +1 -1
- package/core/platform/{typescript-utilities.js → TypescriptUtilities.js} +1 -1
- package/core/platform/TypescriptUtilities.js.map +1 -0
- package/core/platform/UIString.d.ts +1 -1
- package/core/platform/UIString.js.map +1 -1
- package/core/platform/platform-tsconfig.json +11 -16
- package/core/platform/platform.d.ts +12 -13
- package/core/platform/platform.js +16 -17
- package/core/platform/platform.js.map +1 -1
- package/generated/protocol.d.ts +83 -28
- package/models/trace/ModelImpl.d.ts +3 -0
- package/models/trace/ModelImpl.js +10 -2
- package/models/trace/ModelImpl.js.map +1 -1
- package/models/trace/Processor.d.ts +3 -1
- package/models/trace/Processor.js +43 -4
- package/models/trace/Processor.js.map +1 -1
- package/models/trace/TracingManager.js.map +1 -1
- package/models/trace/extras/FetchNodes.d.ts +10 -3
- package/models/trace/extras/FetchNodes.js +14 -1
- package/models/trace/extras/FetchNodes.js.map +1 -1
- package/models/trace/handlers/NetworkRequestsHandler.js +5 -0
- package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -1
- package/models/trace/handlers/RendererHandler.js +2 -1
- package/models/trace/handlers/RendererHandler.js.map +1 -1
- package/models/trace/insights/InsightRunners.d.ts +1 -0
- package/models/trace/insights/InsightRunners.js +5 -0
- package/models/trace/insights/InsightRunners.js.map +1 -0
- package/models/trace/insights/RenderBlocking.d.ts +6 -0
- package/models/trace/insights/RenderBlocking.js +27 -0
- package/models/trace/insights/RenderBlocking.js.map +1 -0
- package/models/trace/insights/bundle-tsconfig.json +1 -0
- package/models/trace/{frames → insights}/devtools_entrypoint-bundle-typescript-tsconfig.json +5 -4
- package/models/trace/{worker/processor-tsconfig.json → insights/insights-tsconfig.json} +9 -8
- package/models/trace/insights/insights.d.ts +2 -0
- package/models/trace/insights/insights.js +6 -0
- package/models/trace/insights/insights.js.map +1 -0
- package/models/trace/insights/types.d.ts +33 -0
- package/models/trace/insights/types.js +5 -0
- package/models/trace/insights/types.js.map +1 -0
- package/models/trace/trace-tsconfig.json +3 -0
- package/models/trace/trace.d.ts +2 -1
- package/models/trace/trace.js +2 -1
- package/models/trace/trace.js.map +1 -1
- package/models/trace/types/TraceEvents.d.ts +24 -0
- package/models/trace/types/TraceEvents.js.map +1 -1
- package/package.json +7 -5
- package/LICENSE +0 -27
- package/PAUL.readme.md +0 -5
- package/README.md +0 -156
- package/analyze-trace.mjs +0 -184
- package/core/platform/array-utilities.js.map +0 -1
- package/core/platform/date-utilities.js.map +0 -1
- package/core/platform/dcheck-tsconfig.json +0 -8
- package/core/platform/dcheck.d.ts +0 -4
- package/core/platform/dcheck.js +0 -5
- package/core/platform/devtools_entrypoint-bundle-tsconfig-tsconfig.json +0 -40
- package/core/platform/dom-utilities.js.map +0 -1
- package/core/platform/keyboard-utilities.js.map +0 -1
- package/core/platform/map-utilities.js.map +0 -1
- package/core/platform/number-utilities.js.map +0 -1
- package/core/platform/platform.js.compressed +0 -0
- package/core/platform/platform.js.hash +0 -1
- package/core/platform/platform.prebundle.d.ts +0 -15
- package/core/platform/platform.prebundle.js +0 -50
- package/core/platform/platform.prebundle.js.map +0 -1
- package/core/platform/platform.prebundle.ts +0 -64
- package/core/platform/promise-utilities.js.map +0 -1
- package/core/platform/set-utilities.js.map +0 -1
- package/core/platform/string-utilities.js.map +0 -1
- package/core/platform/typescript-utilities.js.map +0 -1
- package/models/trace/SDKServices.js +0 -104
- package/models/trace/SDKServices.js.map +0 -7
- package/models/trace/TraceProcessor.js +0 -133
- package/models/trace/TraceProcessor.js.map +0 -7
- package/models/trace/TreeManipulator.js +0 -85
- package/models/trace/TreeManipulator.js.map +0 -7
- package/models/trace/devtools_entrypoint-legacy-typescript-tsconfig.json +0 -43
- package/models/trace/frames/TimelineFrameModel.js +0 -392
- package/models/trace/frames/TimelineFrameModel.js.map +0 -7
- package/models/trace/frames/bundle-tsconfig.json +0 -1
- package/models/trace/frames/frames-tsconfig.json +0 -58
- package/models/trace/frames/frames.js +0 -5
- package/models/trace/frames/frames.js.map +0 -7
- package/models/trace/handlers/Migration.js +0 -27
- package/models/trace/handlers/Migration.js.map +0 -7
- package/models/trace/handlers/UberFramesHandler.js +0 -293
- package/models/trace/handlers/UberFramesHandler.js.map +0 -7
- package/models/trace/legacy-tsconfig.json +0 -1
- package/models/trace/sdk_services/DOMNodeLookup.js +0 -41
- package/models/trace/sdk_services/DOMNodeLookup.js.map +0 -7
- package/models/trace/sdk_services/LayoutShifts.js +0 -68
- package/models/trace/sdk_services/LayoutShifts.js.map +0 -7
- package/models/trace/sdk_services/bundle-tsconfig.json +0 -1
- package/models/trace/sdk_services/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -41
- package/models/trace/sdk_services/sdk_services-tsconfig.json +0 -57
- package/models/trace/sdk_services/sdk_services.js +0 -7
- package/models/trace/sdk_services/sdk_services.js.map +0 -7
- package/models/trace/trace-legacy.js +0 -16
- package/models/trace/trace-legacy.js.map +0 -7
- package/models/trace/worker/Processor.js +0 -143
- package/models/trace/worker/Processor.js.map +0 -7
- package/models/trace/worker/Types.js +0 -1
- package/models/trace/worker/Types.js.map +0 -7
- package/models/trace/worker/bundle-tsconfig.json +0 -1
- package/models/trace/worker/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -41
- package/models/trace/worker/devtools_entrypoint-worker_entrypoint-typescript-tsconfig.json +0 -41
- package/models/trace/worker/worker.js +0 -7
- package/models/trace/worker/worker.js.map +0 -7
- package/models/trace/worker/worker_entrypoint-tsconfig.json +0 -1
- package/models/trace/worker/worker_entrypoint.js +0 -36
- package/models/trace/worker/worker_entrypoint.js.map +0 -7
- package/test/invalid-animation-events.json.gz +0 -0
- package/test/test-trace-engine.mjs +0 -52
- /package/core/platform/{array-utilities.d.ts → ArrayUtilities.d.ts} +0 -0
- /package/core/platform/{brand.d.ts → Brand.d.ts} +0 -0
- /package/core/platform/{dom-utilities.d.ts → DOMUtilities.d.ts} +0 -0
- /package/core/platform/{date-utilities.d.ts → DateUtilities.d.ts} +0 -0
- /package/core/platform/{keyboard-utilities.d.ts → KeyboardUtilities.d.ts} +0 -0
- /package/core/platform/{map-utilities.d.ts → MapUtilities.d.ts} +0 -0
- /package/core/platform/{number-utilities.d.ts → NumberUtilities.d.ts} +0 -0
- /package/core/platform/{promise-utilities.d.ts → PromiseUtilities.d.ts} +0 -0
- /package/core/platform/{set-utilities.d.ts → SetUtilities.d.ts} +0 -0
- /package/core/platform/{string-utilities.d.ts → StringUtilities.d.ts} +0 -0
- /package/core/platform/{typescript-utilities.d.ts → TypescriptUtilities.d.ts} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"promise-utilities.js","sourceRoot":"","sources":["../../../../../../front_end/core/platform/promise-utilities.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAKlC,IAAI,OAA2C,CAAC;IAChD,IAAI,MAAgC,CAAC;IACrC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAI,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC1C,OAAO,GAAG,GAAG,CAAC;QACd,MAAM,GAAG,GAAG,CAAC;IACf,CAAC,CAAC,CAAC;IACH,OAAO,EAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAC,CAAC;AACpC,CAAC","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.\n\n/**\n * Returns a new pending promise together with it's resolve and reject functions.\n *\n * Polyfill for https://github.com/tc39/proposal-promise-with-resolvers.\n */\nexport function promiseWithResolvers<T = unknown>(): {\n promise: Promise<T>,\n resolve: (value: T|PromiseLike<T>) => void,\n reject: (error?: Error) => void,\n} {\n let resolve!: (value: T|PromiseLike<T>) => void;\n let reject!: (error?: Error) => void;\n const promise = new Promise<T>((res, rej) => {\n resolve = res;\n reject = rej;\n });\n return {promise, resolve, reject};\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"set-utilities.js","sourceRoot":"","sources":["../../../../../../front_end/core/platform/set-utilities.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,yEAAyE;AACzE,6BAA6B;AAE7B,MAAM,CAAC,MAAM,MAAM,GAAG,UAAY,GAAW,EAAE,QAAqB;IAClE,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE;QAC3B,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;KACf;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,UAAY,IAAY,EAAE,IAAY;IAC3D,IAAI,IAAI,KAAK,IAAI,EAAE;QACjB,OAAO,IAAI,CAAC;KACb;IACD,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE;QAC3B,OAAO,KAAK,CAAC;KACd;IACD,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE;QACvB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACnB,OAAO,KAAK,CAAC;SACd;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["// Copyright (c) 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\nexport const addAll = function<T>(set: Set<T>, iterable: Iterable<T>): void {\n for (const item of iterable) {\n set.add(item);\n }\n};\n\nexport const isEqual = function<T>(setA: Set<T>, setB: Set<T>): boolean {\n if (setA === setB) {\n return true;\n }\n if (setA.size !== setB.size) {\n return false;\n }\n for (const item of setA) {\n if (!setB.has(item)) {\n return false;\n }\n }\n return true;\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"string-utilities.js","sourceRoot":"","sources":["../../../../../../front_end/core/platform/string-utilities.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,yEAAyE;AACzE,6BAA6B;AAE7B,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,WAAmB,EAAE,aAAqB,EAAU,EAAE;IACrF,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;QAC7C,IAAI,WAAW,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE;YACvD,SAAS,GAAG,IAAI,CAAC;YACjB,MAAM;SACP;KACF;IAED,IAAI,CAAC,SAAS,EAAE;QACd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that can be\n// found in the LICENSE file.\n\nexport const escapeCharacters = (inputString: string, charsToEscape: string): string => {\n let foundChar = false;\n for (let i = 0; i < charsToEscape.length; ++i) {\n if (inputString.indexOf(charsToEscape.charAt(i)) !== -1) {\n foundChar = true;\n break;\n }\n }\n\n if (!foundChar) {\n return String(inputString);\n }\n\n let result = '';\n for (let i = 0; i < inputString.length; ++i) {\n if (charsToEscape.indexOf(inputString.charAt(i)) !== -1) {\n result += '\\\\';\n }\n result += inputString.charAt(i);\n }\n\n return result;\n};\n\nconst toHexadecimal = (charCode: number, padToLength: number): string => {\n return charCode.toString(16).toUpperCase().padStart(padToLength, '0');\n};\n\n// Remember to update the third group in the regexps patternsToEscape and\n// patternsToEscapePlusSingleQuote when adding new entries in this map.\nconst escapedReplacements = new Map([\n ['\\b', '\\\\b'],\n ['\\f', '\\\\f'],\n ['\\n', '\\\\n'],\n ['\\r', '\\\\r'],\n ['\\t', '\\\\t'],\n ['\\v', '\\\\v'],\n ['\\'', '\\\\\\''],\n ['\\\\', '\\\\\\\\'],\n ['<!--', '\\\\x3C!--'],\n ['<script', '\\\\x3Cscript'],\n ['</script', '\\\\x3C/script'],\n]);\n\nexport const formatAsJSLiteral = (content: string): string => {\n const patternsToEscape = /(\\\\|<(?:!--|\\/?script))|(\\p{Control})|(\\p{Surrogate})/gu;\n const patternsToEscapePlusSingleQuote = /(\\\\|'|<(?:!--|\\/?script))|(\\p{Control})|(\\p{Surrogate})/gu;\n const escapePattern = (match: string, pattern: string, controlChar: string, loneSurrogate: string): string => {\n if (controlChar) {\n if (escapedReplacements.has(controlChar)) {\n // @ts-ignore https://github.com/microsoft/TypeScript/issues/13086\n return escapedReplacements.get(controlChar);\n }\n const twoDigitHex = toHexadecimal(controlChar.charCodeAt(0), 2);\n return '\\\\x' + twoDigitHex;\n }\n if (loneSurrogate) {\n const fourDigitHex = toHexadecimal(loneSurrogate.charCodeAt(0), 4);\n return '\\\\u' + fourDigitHex;\n }\n if (pattern) {\n return escapedReplacements.get(pattern) || '';\n }\n return match;\n };\n\n let escapedContent = '';\n let quote = '';\n if (!content.includes('\\'')) {\n quote = '\\'';\n escapedContent = content.replaceAll(patternsToEscape, escapePattern);\n } else if (!content.includes('\"')) {\n quote = '\"';\n escapedContent = content.replaceAll(patternsToEscape, escapePattern);\n } else if (!content.includes('`') && !content.includes('${')) {\n quote = '`';\n escapedContent = content.replaceAll(patternsToEscape, escapePattern);\n } else {\n quote = '\\'';\n escapedContent = content.replaceAll(patternsToEscapePlusSingleQuote, escapePattern);\n }\n return `${quote}${escapedContent}${quote}`;\n};\n\n/**\n * This implements a subset of the sprintf() function described in the Single UNIX\n * Specification. It supports the %s, %f, %d, and %% formatting specifiers, and\n * understands the %m$d notation to select the m-th parameter for this substitution,\n * as well as the optional precision for %s, %f, and %d.\n *\n * @param fmt format string.\n * @param args parameters to the format string.\n * @returns the formatted output string.\n */\nexport const sprintf = (fmt: string, ...args: unknown[]): string => {\n let argIndex = 0;\n const RE = /%(?:(\\d+)\\$)?(?:\\.(\\d*))?([%dfs])/g;\n return fmt.replaceAll(RE, (_: string, index?: string, precision?: string, specifier?: string) => {\n if (specifier === '%') {\n return '%';\n }\n if (index !== undefined) {\n argIndex = parseInt(index, 10) - 1;\n if (argIndex < 0) {\n throw new RangeError(`Invalid parameter index ${argIndex + 1}`);\n }\n }\n if (argIndex >= args.length) {\n throw new RangeError(`Expected at least ${argIndex + 1} format parameters, but only ${args.length} where given.`);\n }\n if (specifier === 's') {\n const argValue = String(args[argIndex++]);\n if (precision !== undefined) {\n return argValue.substring(0, Number(precision));\n }\n return argValue;\n }\n let argValue = Number(args[argIndex++]);\n if (isNaN(argValue)) {\n argValue = 0;\n }\n if (specifier === 'd') {\n return String(Math.floor(argValue)).padStart(Number(precision), '0');\n }\n if (precision !== undefined) {\n return argValue.toFixed(Number(precision));\n }\n return String(argValue);\n });\n};\n\nexport const toBase64 = (inputString: string): string => {\n /* note to the reader: we can't use btoa here because we need to\n * support Unicode correctly. See the test cases for this function and\n * also\n * https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_Unicode_Problem\n */\n\n function encodeBits(b: number): number {\n return b < 26 ? b + 65 : b < 52 ? b + 71 : b < 62 ? b - 4 : b === 62 ? 43 : b === 63 ? 47 : 65;\n }\n const encoder = new TextEncoder();\n const data = encoder.encode(inputString.toString());\n const n = data.length;\n let encoded = '';\n if (n === 0) {\n return encoded;\n }\n let shift;\n let v = 0;\n for (let i = 0; i < n; i++) {\n shift = i % 3;\n v |= data[i] << (16 >>> shift & 24);\n if (shift === 2) {\n encoded += String.fromCharCode(\n encodeBits(v >>> 18 & 63), encodeBits(v >>> 12 & 63), encodeBits(v >>> 6 & 63), encodeBits(v & 63));\n v = 0;\n }\n }\n if (shift === 0) {\n encoded += String.fromCharCode(encodeBits(v >>> 18 & 63), encodeBits(v >>> 12 & 63), 61, 61);\n } else if (shift === 1) {\n encoded += String.fromCharCode(encodeBits(v >>> 18 & 63), encodeBits(v >>> 12 & 63), encodeBits(v >>> 6 & 63), 61);\n }\n return encoded;\n};\n\nexport const findIndexesOfSubString = (inputString: string, searchString: string): number[] => {\n const matches = [];\n let i = inputString.indexOf(searchString);\n while (i !== -1) {\n matches.push(i);\n i = inputString.indexOf(searchString, i + searchString.length);\n }\n return matches;\n};\n\nexport const findLineEndingIndexes = (inputString: string): number[] => {\n const endings = findIndexesOfSubString(inputString, '\\n');\n endings.push(inputString.length);\n return endings;\n};\n\nexport const isWhitespace = (inputString: string): boolean => {\n return /^\\s*$/.test(inputString);\n};\n\nexport const trimURL = (url: string, baseURLDomain?: string): string => {\n let result = url.replace(/^(https|http|file):\\/\\//i, '');\n if (baseURLDomain) {\n if (result.toLowerCase().startsWith(baseURLDomain.toLowerCase())) {\n result = result.substr(baseURLDomain.length);\n }\n }\n return result;\n};\n\nexport const collapseWhitespace = (inputString: string): string => {\n return inputString.replace(/[\\s\\xA0]+/g, ' ');\n};\n\nexport const reverse = (inputString: string): string => {\n return inputString.split('').reverse().join('');\n};\n\nexport const replaceControlCharacters = (inputString: string): string => {\n // Replace C0 and C1 control character sets with replacement character.\n // Do not replace '\\t', \\n' and '\\r'.\n return inputString.replace(/[\\0-\\x08\\x0B\\f\\x0E-\\x1F\\x80-\\x9F]/g, '\\uFFFD');\n};\n\nexport const countWtf8Bytes = (inputString: string): number => {\n let count = 0;\n for (let i = 0; i < inputString.length; i++) {\n const c = inputString.charCodeAt(i);\n if (c <= 0x7F) {\n count++;\n } else if (c <= 0x07FF) {\n count += 2;\n } else if (c < 0xD800 || 0xDFFF < c) {\n count += 3;\n } else {\n if (c <= 0xDBFF && i + 1 < inputString.length) {\n // The current character is a leading surrogate, and there is a\n // next character.\n const next = inputString.charCodeAt(i + 1);\n if (0xDC00 <= next && next <= 0xDFFF) {\n // The next character is a trailing surrogate, meaning this\n // is a surrogate pair.\n count += 4;\n i++;\n continue;\n }\n }\n count += 3;\n }\n }\n return count;\n};\n\nexport const stripLineBreaks = (inputStr: string): string => {\n return inputStr.replace(/(\\r)?\\n/g, '');\n};\n\nconst EXTENDED_KEBAB_CASE_REGEXP = /^([a-z0-9]+(?:-[a-z0-9]+)*\\.)*[a-z0-9]+(?:-[a-z0-9]+)*$/;\n\n/**\n * Tests if the `inputStr` is following the extended Kebab Case naming convetion,\n * where words are separated with either a dash (`-`) or a dot (`.`), and all\n * characters must be lower-case alphanumeric.\n *\n * For example, it will yield `true` for `'my.amazing-string.literal'`, but `false`\n * for `'Another.AmazingLiteral'` or '`another_amazing_literal'`.\n *\n * @param inputStr the input string to test.\n * @return `true` if the `inputStr` follows the extended Kebab Case convention.\n */\nexport const isExtendedKebabCase = (inputStr: string): boolean => {\n return EXTENDED_KEBAB_CASE_REGEXP.test(inputStr);\n};\n\nexport const toTitleCase = (inputStr: string): string => {\n return inputStr.substring(0, 1).toUpperCase() + inputStr.substring(1);\n};\n\nexport const removeURLFragment = (inputStr: string): string => {\n const url = new URL(inputStr);\n url.hash = '';\n return url.toString();\n};\n\nconst SPECIAL_REGEX_CHARACTERS = '^[]{}()\\\\.^$*+?|-,';\n\nexport const regexSpecialCharacters = function(): string {\n return SPECIAL_REGEX_CHARACTERS;\n};\n\nexport const filterRegex = function(query: string): RegExp {\n let regexString = '^(?:.*\\\\0)?'; // Start from beginning or after a \\0\n for (let i = 0; i < query.length; ++i) {\n let c = query.charAt(i);\n if (SPECIAL_REGEX_CHARACTERS.indexOf(c) !== -1) {\n c = '\\\\' + c;\n }\n regexString += '[^\\\\0' + c + ']*' + c;\n }\n return new RegExp(regexString, 'i');\n};\n\nexport const createSearchRegex = function(\n query: string, caseSensitive: boolean, isRegex: boolean, matchWholeWord: boolean = false): RegExp {\n const regexFlags = caseSensitive ? 'g' : 'gi';\n let regexObject;\n\n if (isRegex) {\n try {\n regexObject = new RegExp(query, regexFlags);\n } catch (e) {\n // Silent catch.\n }\n }\n\n if (!regexObject) {\n regexObject = createPlainTextSearchRegex(query, regexFlags);\n }\n\n if (matchWholeWord && regexObject) {\n regexObject = new RegExp(`\\\\b${regexObject.source}\\\\b`, regexFlags);\n }\n\n return regexObject;\n};\n\nexport const caseInsensetiveComparator = function(a: string, b: string): number {\n a = a.toUpperCase();\n b = b.toUpperCase();\n if (a === b) {\n return 0;\n }\n return a > b ? 1 : -1;\n};\n\nexport const hashCode = function(string?: string): number {\n if (!string) {\n return 0;\n }\n // Hash algorithm for substrings is described in \"Über die Komplexität der Multiplikation in\n // eingeschränkten Branchingprogrammmodellen\" by Woelfe.\n // http://opendatastructures.org/versions/edition-0.1d/ods-java/node33.html#SECTION00832000000000000000\n const p = ((1 << 30) * 4 - 5); // prime: 2^32 - 5\n const z = 0x5033d967; // 32 bits from random.org\n const z2 = 0x59d2f15d; // random odd 32 bit number\n let s = 0;\n let zi = 1;\n for (let i = 0; i < string.length; i++) {\n const xi = string.charCodeAt(i) * z2;\n s = (s + zi * xi) % p;\n zi = (zi * z) % p;\n }\n s = (s + zi * (p - 1)) % p;\n return Math.abs(s | 0);\n};\n\nexport const compare = (a: string, b: string): number => {\n if (a > b) {\n return 1;\n }\n if (a < b) {\n return -1;\n }\n return 0;\n};\n\nexport const trimMiddle = (str: string, maxLength: number): string => {\n if (str.length <= maxLength) {\n return String(str);\n }\n let leftHalf = maxLength >> 1;\n let rightHalf = maxLength - leftHalf - 1;\n if ((str.codePointAt(str.length - rightHalf - 1) as number) >= 0x10000) {\n --rightHalf;\n ++leftHalf;\n }\n if (leftHalf > 0 && (str.codePointAt(leftHalf - 1) as number) >= 0x10000) {\n --leftHalf;\n }\n return str.substr(0, leftHalf) + '…' + str.substr(str.length - rightHalf, rightHalf);\n};\n\nexport const trimEndWithMaxLength = (str: string, maxLength: number): string => {\n if (str.length <= maxLength) {\n return String(str);\n }\n return str.substr(0, maxLength - 1) + '…';\n};\n\nexport const escapeForRegExp = (str: string): string => {\n return escapeCharacters(str, SPECIAL_REGEX_CHARACTERS);\n};\n\nexport const naturalOrderComparator = (a: string, b: string): number => {\n const chunk = /^\\d+|^\\D+/;\n let chunka, chunkb, anum, bnum;\n while (true) {\n if (a) {\n if (!b) {\n return 1;\n }\n } else {\n if (b) {\n return -1;\n }\n return 0;\n }\n chunka = (a.match(chunk) as string[])[0];\n chunkb = (b.match(chunk) as string[])[0];\n anum = !Number.isNaN(Number(chunka));\n bnum = !Number.isNaN(Number(chunkb));\n if (anum && !bnum) {\n return -1;\n }\n if (bnum && !anum) {\n return 1;\n }\n if (anum && bnum) {\n const diff = Number(chunka) - Number(chunkb);\n if (diff) {\n return diff;\n }\n if (chunka.length !== chunkb.length) {\n if (!Number(chunka) && !Number(chunkb)) { // chunks are strings of all 0s (special case)\n return chunka.length - chunkb.length;\n }\n return chunkb.length - chunka.length;\n }\n } else if (chunka !== chunkb) {\n return (chunka < chunkb) ? -1 : 1;\n }\n a = a.substring(chunka.length);\n b = b.substring(chunkb.length);\n }\n};\n\nexport const base64ToSize = function(content: string|null): number {\n if (!content) {\n return 0;\n }\n let size = content.length * 3 / 4;\n if (content[content.length - 1] === '=') {\n size--;\n }\n if (content.length > 1 && content[content.length - 2] === '=') {\n size--;\n }\n return size;\n};\n\nexport const SINGLE_QUOTE = '\\'';\nexport const DOUBLE_QUOTE = '\"';\nconst BACKSLASH = '\\\\';\n\nexport const findUnclosedCssQuote = function(str: string): string {\n let unmatchedQuote = '';\n for (let i = 0; i < str.length; ++i) {\n const char = str[i];\n if (char === BACKSLASH) {\n i++;\n continue;\n }\n if (char === SINGLE_QUOTE || char === DOUBLE_QUOTE) {\n if (unmatchedQuote === char) {\n unmatchedQuote = '';\n } else if (unmatchedQuote === '') {\n unmatchedQuote = char;\n }\n }\n }\n return unmatchedQuote;\n};\n\nexport const countUnmatchedLeftParentheses = (str: string): number => {\n let unmatchedCount = 0;\n for (const c of str) {\n if (c === '(') {\n unmatchedCount++;\n } else if (c === ')' && unmatchedCount > 0) {\n unmatchedCount--;\n }\n }\n return unmatchedCount;\n};\n\nexport const createPlainTextSearchRegex = function(query: string, flags?: string): RegExp {\n // This should be kept the same as the one in StringUtil.cpp.\n let regex = '';\n for (let i = 0; i < query.length; ++i) {\n const c = query.charAt(i);\n if (regexSpecialCharacters().indexOf(c) !== -1) {\n regex += '\\\\';\n }\n regex += c;\n }\n return new RegExp(regex, flags || '');\n};\n\nclass LowerCaseStringTag {\n private lowerCaseStringTag: (string|undefined);\n}\n\nexport type LowerCaseString = string&LowerCaseStringTag;\n\nexport const toLowerCaseString = function(input: string): LowerCaseString {\n return input.toLowerCase() as LowerCaseString;\n};\n\nconst WORD = /[A-Z]{2,}(?=[A-Z0-9][a-z0-9]+|\\b)|[A-Za-z][0-9]+[a-z]|[A-Z]?[a-z]+|[0-9][A-Za-z]+|[A-Z]|[0-9]+|[.]/g;\n// <---1---><-----------2----------> <--------3--------> <-----4----> <------5-----> <-----6----> <7>\n// 1: two or more consecutive uppercase letters. This is useful for identifying acronyms\n// 2: lookahead assertion that matches a word boundary\n// 3: numeronym: single letter followed by number and another letter\n// 4: word starting with an optional uppercase letter\n// 5: single digit followed by word to handle '3D' or '2px' (this might be controverial)\n// 6: single uppercase letter or number\n// 7: a dot character. We extract it into a separate word and remove dashes around it later.\n// This is makes more sense conceptually and allows accounting for all possible word variants.\n// Making dot a part of a word prevent us from handling acronyms or numeronyms after the word\n// correctly without making the RegExp prohibitively complicated.\n// https://regex101.com/r/LtFugp/1\nexport const toKebabCase = function(input: string): Lowercase<string> {\n return (input.match?.(WORD)?.map(w => w.toLowerCase()).join('-').replaceAll('-.-', '.') || input) as\n Lowercase<string>;\n};\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nexport function toKebabCaseKeys(settingValue: {\n [x: string]: any,\n}): {[x: string]: any} {\n const result: {\n [x: string]: any,\n } = {};\n for (const [key, value] of Object.entries(settingValue)) {\n result[toKebabCase(key)] = value;\n }\n return result;\n}\n/* eslint-enable @typescript-eslint/no-explicit-any */\n\n// Replaces the last ocurrence of parameter `search` with parameter `replacement` in `input`\nexport const replaceLast = function(input: string, search: string, replacement: string): string {\n const replacementStartIndex = input.lastIndexOf(search);\n if (replacementStartIndex === -1) {\n return input;\n }\n\n return input.slice(0, replacementStartIndex) + input.slice(replacementStartIndex).replace(search, replacement);\n};\n\nexport const stringifyWithPrecision = function stringifyWithPrecision(s: number, precision = 2): string {\n if (precision === 0) {\n return s.toFixed(0);\n }\n const string = s.toFixed(precision).replace(/\\.?0*$/, '');\n return string === '-0' ? '0' : string;\n};\n\n/**\n * Somewhat efficiently concatenates 2 base64 encoded strings.\n */\nexport const concatBase64 = function(lhs: string, rhs: string): string {\n if (lhs.length === 0 || !lhs.endsWith('=')) {\n // Empty string or no padding, we can straight-up concatenate.\n return lhs + rhs;\n }\n const lhsLeaveAsIs = lhs.substring(0, lhs.length - 4);\n const lhsToDecode = lhs.substring(lhs.length - 4);\n return lhsLeaveAsIs + window.btoa(window.atob(lhsToDecode) + window.atob(rhs));\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import * as SDK from "../../core/sdk/sdk.js";
|
|
2
|
-
const domLookUpSingleNodeCache = /* @__PURE__ */ new Map();
|
|
3
|
-
const domLookUpBatchNodesCache = /* @__PURE__ */ new Map();
|
|
4
|
-
export function _TEST_clearCache() {
|
|
5
|
-
domLookUpSingleNodeCache.clear();
|
|
6
|
-
domLookUpBatchNodesCache.clear();
|
|
7
|
-
layoutShiftSourcesCache.clear();
|
|
8
|
-
normalizedLayoutShiftNodesCache.clear();
|
|
9
|
-
}
|
|
10
|
-
export async function domNodeForBackendNodeID(modelData, nodeId) {
|
|
11
|
-
const fromCache = domLookUpSingleNodeCache.get(modelData)?.get(nodeId);
|
|
12
|
-
if (fromCache !== void 0) {
|
|
13
|
-
return fromCache;
|
|
14
|
-
}
|
|
15
|
-
const target = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
|
|
16
|
-
const domModel = target?.model(SDK.DOMModel.DOMModel);
|
|
17
|
-
if (!domModel) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
const domNodesMap = await domModel.pushNodesByBackendIdsToFrontend(/* @__PURE__ */ new Set([nodeId]));
|
|
21
|
-
const result = domNodesMap?.get(nodeId) || null;
|
|
22
|
-
const cacheForModel = domLookUpSingleNodeCache.get(modelData) || /* @__PURE__ */ new Map();
|
|
23
|
-
cacheForModel.set(nodeId, result);
|
|
24
|
-
domLookUpSingleNodeCache.set(modelData, cacheForModel);
|
|
25
|
-
return result;
|
|
26
|
-
}
|
|
27
|
-
export async function domNodesForMultipleBackendNodeIds(modelData, nodeIds) {
|
|
28
|
-
const fromCache = domLookUpBatchNodesCache.get(modelData)?.get(nodeIds);
|
|
29
|
-
if (fromCache) {
|
|
30
|
-
return fromCache;
|
|
31
|
-
}
|
|
32
|
-
const target = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
|
|
33
|
-
const domModel = target?.model(SDK.DOMModel.DOMModel);
|
|
34
|
-
if (!domModel) {
|
|
35
|
-
return /* @__PURE__ */ new Map();
|
|
36
|
-
}
|
|
37
|
-
const domNodesMap = await domModel.pushNodesByBackendIdsToFrontend(nodeIds) || /* @__PURE__ */ new Map();
|
|
38
|
-
const cacheForModel = domLookUpBatchNodesCache.get(modelData) || /* @__PURE__ */ new Map();
|
|
39
|
-
cacheForModel.set(nodeIds, domNodesMap);
|
|
40
|
-
domLookUpBatchNodesCache.set(modelData, cacheForModel);
|
|
41
|
-
return domNodesMap;
|
|
42
|
-
}
|
|
43
|
-
const layoutShiftSourcesCache = /* @__PURE__ */ new Map();
|
|
44
|
-
const normalizedLayoutShiftNodesCache = /* @__PURE__ */ new Map();
|
|
45
|
-
export async function sourcesForLayoutShift(modelData, event) {
|
|
46
|
-
const fromCache = layoutShiftSourcesCache.get(modelData)?.get(event);
|
|
47
|
-
if (fromCache) {
|
|
48
|
-
return fromCache;
|
|
49
|
-
}
|
|
50
|
-
const impactedNodes = event.args.data?.impacted_nodes;
|
|
51
|
-
if (!impactedNodes) {
|
|
52
|
-
return [];
|
|
53
|
-
}
|
|
54
|
-
const sources = [];
|
|
55
|
-
await Promise.all(impactedNodes.map(async (node) => {
|
|
56
|
-
const domNode = await domNodeForBackendNodeID(modelData, node.node_id);
|
|
57
|
-
if (domNode) {
|
|
58
|
-
sources.push({
|
|
59
|
-
previousRect: new DOMRect(node.old_rect[0], node.old_rect[1], node.old_rect[2], node.old_rect[3]),
|
|
60
|
-
currentRect: new DOMRect(node.new_rect[0], node.new_rect[1], node.new_rect[2], node.new_rect[3]),
|
|
61
|
-
node: domNode
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}));
|
|
65
|
-
const cacheForModel = layoutShiftSourcesCache.get(modelData) || /* @__PURE__ */ new Map();
|
|
66
|
-
cacheForModel.set(event, sources);
|
|
67
|
-
layoutShiftSourcesCache.set(modelData, cacheForModel);
|
|
68
|
-
return sources;
|
|
69
|
-
}
|
|
70
|
-
export async function normalizedImpactedNodesForLayoutShift(modelData, event) {
|
|
71
|
-
const fromCache = normalizedLayoutShiftNodesCache.get(modelData)?.get(event);
|
|
72
|
-
if (fromCache) {
|
|
73
|
-
return fromCache;
|
|
74
|
-
}
|
|
75
|
-
const impactedNodes = event.args?.data?.impacted_nodes;
|
|
76
|
-
if (!impactedNodes) {
|
|
77
|
-
return [];
|
|
78
|
-
}
|
|
79
|
-
let viewportScale = null;
|
|
80
|
-
const target = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
|
|
81
|
-
const evaluateResult = await target?.runtimeAgent().invoke_evaluate({ expression: "window.devicePixelRatio" });
|
|
82
|
-
if (evaluateResult?.result.type === "number") {
|
|
83
|
-
viewportScale = evaluateResult?.result.value ?? null;
|
|
84
|
-
}
|
|
85
|
-
if (!viewportScale) {
|
|
86
|
-
return impactedNodes;
|
|
87
|
-
}
|
|
88
|
-
const normalizedNodes = [];
|
|
89
|
-
for (const impactedNode of impactedNodes) {
|
|
90
|
-
const newNode = { ...impactedNode };
|
|
91
|
-
for (let i = 0; i < impactedNode.old_rect.length; i++) {
|
|
92
|
-
newNode.old_rect[i] /= viewportScale;
|
|
93
|
-
}
|
|
94
|
-
for (let i = 0; i < impactedNode.new_rect.length; i++) {
|
|
95
|
-
newNode.new_rect[i] /= viewportScale;
|
|
96
|
-
}
|
|
97
|
-
normalizedNodes.push(newNode);
|
|
98
|
-
}
|
|
99
|
-
const cacheForModel = normalizedLayoutShiftNodesCache.get(modelData) || /* @__PURE__ */ new Map();
|
|
100
|
-
cacheForModel.set(event, normalizedNodes);
|
|
101
|
-
normalizedLayoutShiftNodesCache.set(modelData, cacheForModel);
|
|
102
|
-
return normalizedNodes;
|
|
103
|
-
}
|
|
104
|
-
//# sourceMappingURL=SDKServices.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../front_end/models/trace/SDKServices.ts"],
|
|
4
|
-
"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.\n\nimport type * as Protocol from '../../generated/protocol.js';\nimport * as SDK from '../../core/sdk/sdk.js';\nimport type * as Handlers from './handlers/handlers.js';\nimport type * as Types from './types/types.js';\n\nconst domLookUpSingleNodeCache =\n new Map<Handlers.Types.TraceParseData, Map<Protocol.DOM.BackendNodeId, SDK.DOMModel.DOMNode|null>>();\nconst domLookUpBatchNodesCache = new Map<\n Handlers.Types.TraceParseData,\n Map<Set<Protocol.DOM.BackendNodeId>, Map<Protocol.DOM.BackendNodeId, SDK.DOMModel.DOMNode|null>>>();\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function _TEST_clearCache(): void {\n domLookUpSingleNodeCache.clear();\n domLookUpBatchNodesCache.clear();\n layoutShiftSourcesCache.clear();\n normalizedLayoutShiftNodesCache.clear();\n}\n\n/**\n * Looks up the DOM Node on the page for the given BackendNodeId. Uses the\n * provided TraceParseData as the cache and will cache the result after the\n * first lookup.\n */\nexport async function domNodeForBackendNodeID(\n modelData: Handlers.Types.TraceParseData, nodeId: Protocol.DOM.BackendNodeId): Promise<SDK.DOMModel.DOMNode|null> {\n const fromCache = domLookUpSingleNodeCache.get(modelData)?.get(nodeId);\n if (fromCache !== undefined) {\n return fromCache;\n }\n\n const target = SDK.TargetManager.TargetManager.instance().primaryPageTarget();\n const domModel = target?.model(SDK.DOMModel.DOMModel);\n if (!domModel) {\n return null;\n }\n\n const domNodesMap = await domModel.pushNodesByBackendIdsToFrontend(new Set([nodeId]));\n const result = domNodesMap?.get(nodeId) || null;\n\n const cacheForModel =\n domLookUpSingleNodeCache.get(modelData) || new Map<Protocol.DOM.BackendNodeId, SDK.DOMModel.DOMNode|null>();\n cacheForModel.set(nodeId, result);\n domLookUpSingleNodeCache.set(modelData, cacheForModel);\n\n return result;\n}\n\n/**\n * Takes a set of Protocol.DOM.BackendNodeId ids and will return a map of NodeId=>DOMNode.\n * Results are cached based on 1) the provided TraceParseData and 2) the provided set of IDs.\n */\nexport async function domNodesForMultipleBackendNodeIds(\n modelData: Handlers.Types.TraceParseData,\n nodeIds: Set<Protocol.DOM.BackendNodeId>): Promise<Map<Protocol.DOM.BackendNodeId, SDK.DOMModel.DOMNode|null>> {\n const fromCache = domLookUpBatchNodesCache.get(modelData)?.get(nodeIds);\n if (fromCache) {\n return fromCache;\n }\n const target = SDK.TargetManager.TargetManager.instance().primaryPageTarget();\n const domModel = target?.model(SDK.DOMModel.DOMModel);\n if (!domModel) {\n return new Map();\n }\n\n const domNodesMap = await domModel.pushNodesByBackendIdsToFrontend(nodeIds) || new Map();\n\n const cacheForModel = domLookUpBatchNodesCache.get(modelData) ||\n new Map<Set<Protocol.DOM.BackendNodeId>, Map<Protocol.DOM.BackendNodeId, SDK.DOMModel.DOMNode|null>>();\n cacheForModel.set(nodeIds, domNodesMap);\n domLookUpBatchNodesCache.set(modelData, cacheForModel);\n\n return domNodesMap;\n}\n\nconst layoutShiftSourcesCache = new Map<\n Handlers.Types.TraceParseData, Map<Types.TraceEvents.TraceEventLayoutShift, readonly LayoutShiftSource[]>>();\n\nconst normalizedLayoutShiftNodesCache = new Map<\n Handlers.Types.TraceParseData,\n Map<Types.TraceEvents.TraceEventLayoutShift, readonly Types.TraceEvents.TraceImpactedNode[]>>();\n\nexport interface LayoutShiftSource {\n previousRect: DOMRect;\n currentRect: DOMRect;\n node: SDK.DOMModel.DOMNode;\n}\n\n/**\n * Calculates and returns a list of sources for a LayoutShift.\n * Here, a source is considered as a node that moved and contributed to the\n * given LayoutShift existing and the score it was given. Each source returned\n * contains a reference to the DOM Node, and its dimensions (as a DOMRect), both\n * before and now, so we can see how this node changed and how that impacted the\n * layout shift.\n *\n * This data is cached based on the provided model data and the given layout\n * shift, so it is is safe to call multiple times with the same input.\n */\nexport async function sourcesForLayoutShift(\n modelData: Handlers.Types.TraceParseData,\n event: Types.TraceEvents.TraceEventLayoutShift): Promise<readonly LayoutShiftSource[]> {\n const fromCache = layoutShiftSourcesCache.get(modelData)?.get(event);\n if (fromCache) {\n return fromCache;\n }\n const impactedNodes = event.args.data?.impacted_nodes;\n if (!impactedNodes) {\n return [];\n }\n const sources: LayoutShiftSource[] = [];\n await Promise.all(impactedNodes.map(async node => {\n const domNode = await domNodeForBackendNodeID(modelData, node.node_id);\n if (domNode) {\n sources.push({\n previousRect: new DOMRect(node.old_rect[0], node.old_rect[1], node.old_rect[2], node.old_rect[3]),\n currentRect: new DOMRect(node.new_rect[0], node.new_rect[1], node.new_rect[2], node.new_rect[3]),\n node: domNode,\n });\n }\n }));\n const cacheForModel =\n layoutShiftSourcesCache.get(modelData) || new Map<Types.TraceEvents.TraceEventLayoutShift, LayoutShiftSource[]>();\n cacheForModel.set(event, sources);\n layoutShiftSourcesCache.set(modelData, cacheForModel);\n return sources;\n}\n\n/**\n * Takes a LayoutShift and normalizes its node dimensions based on the device\n * pixel ratio (DPR) of the user's display.\n * This is required because the Layout Instability API is not based on CSS\n * pixels, but physical pixels. Therefore we need to map these to normalized CSS\n * pixels if we can. For example, if the user is on a device with a DPR of 2,\n * the values of the node dimensions reported by the Instability API need to be\n * divided by 2 to be accurate.\n * This function is safe to call multiple times as results are cached based on\n * the provided model data.\n * See https://crbug.com/1300309 for details.\n */\nexport async function normalizedImpactedNodesForLayoutShift(\n modelData: Handlers.Types.TraceParseData,\n event: Types.TraceEvents.TraceEventLayoutShift): Promise<readonly Types.TraceEvents.TraceImpactedNode[]> {\n const fromCache = normalizedLayoutShiftNodesCache.get(modelData)?.get(event);\n if (fromCache) {\n return fromCache;\n }\n const impactedNodes = event.args?.data?.impacted_nodes;\n if (!impactedNodes) {\n return [];\n }\n\n let viewportScale: number|null = null;\n const target = SDK.TargetManager.TargetManager.instance().primaryPageTarget();\n // Get the CSS-to-physical pixel ratio of the device the inspected\n // target is running at.\n const evaluateResult = await target?.runtimeAgent().invoke_evaluate({expression: 'window.devicePixelRatio'});\n if (evaluateResult?.result.type === 'number') {\n viewportScale = evaluateResult?.result.value as number ?? null;\n }\n\n if (!viewportScale) {\n // Bail and return the nodes as is.\n return impactedNodes;\n }\n\n const normalizedNodes: Types.TraceEvents.TraceImpactedNode[] = [];\n for (const impactedNode of impactedNodes) {\n const newNode = {...impactedNode};\n for (let i = 0; i < impactedNode.old_rect.length; i++) {\n newNode.old_rect[i] /= viewportScale;\n }\n for (let i = 0; i < impactedNode.new_rect.length; i++) {\n newNode.new_rect[i] /= viewportScale;\n }\n normalizedNodes.push(newNode);\n }\n\n const cacheForModel = normalizedLayoutShiftNodesCache.get(modelData) ||\n new Map<Types.TraceEvents.TraceEventLayoutShift, readonly Types.TraceEvents.TraceImpactedNode[]>();\n cacheForModel.set(event, normalizedNodes);\n normalizedLayoutShiftNodesCache.set(modelData, cacheForModel);\n\n return normalizedNodes;\n}\n"],
|
|
5
|
-
"mappings": "AAKA;AAIA,MAAM,2BACF,oBAAI;AACR,MAAM,2BAA2B,oBAAI;AAK9B,mCAAkC;AACvC,2BAAyB;AACzB,2BAAyB;AACzB,0BAAwB;AACxB,kCAAgC;AAAA;AAQlC,8CACI,WAA0C,QAAwE;AACpH,QAAM,YAAY,yBAAyB,IAAI,YAAY,IAAI;AAC/D,MAAI,cAAc,QAAW;AAC3B,WAAO;AAAA;AAGT,QAAM,SAAS,IAAI,cAAc,cAAc,WAAW;AAC1D,QAAM,WAAW,QAAQ,MAAM,IAAI,SAAS;AAC5C,MAAI,CAAC,UAAU;AACb,WAAO;AAAA;AAGT,QAAM,cAAc,MAAM,SAAS,gCAAgC,oBAAI,IAAI,CAAC;AAC5E,QAAM,SAAS,aAAa,IAAI,WAAW;AAE3C,QAAM,gBACF,yBAAyB,IAAI,cAAc,oBAAI;AACnD,gBAAc,IAAI,QAAQ;AAC1B,2BAAyB,IAAI,WAAW;AAExC,SAAO;AAAA;AAOT,wDACI,WACA,SAA+G;AACjH,QAAM,YAAY,yBAAyB,IAAI,YAAY,IAAI;AAC/D,MAAI,WAAW;AACb,WAAO;AAAA;AAET,QAAM,SAAS,IAAI,cAAc,cAAc,WAAW;AAC1D,QAAM,WAAW,QAAQ,MAAM,IAAI,SAAS;AAC5C,MAAI,CAAC,UAAU;AACb,WAAO,oBAAI;AAAA;AAGb,QAAM,cAAc,MAAM,SAAS,gCAAgC,YAAY,oBAAI;AAEnF,QAAM,gBAAgB,yBAAyB,IAAI,cAC/C,oBAAI;AACR,gBAAc,IAAI,SAAS;AAC3B,2BAAyB,IAAI,WAAW;AAExC,SAAO;AAAA;AAGT,MAAM,0BAA0B,oBAAI;AAGpC,MAAM,kCAA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aAAa,SAAS,QAAQ,KAAK;AACrD,cAAQ,SAAS,MAAM;AAAA;AAEzB,aAAS,IAAI,GAAG,IAAI,aAAa,SAAS,QAAQ,KAAK;AACrD,cAAQ,SAAS,MAAM;AAAA;AAEzB,oBAAgB,KAAK;AAAA;AAGvB,QAAM,gBAAgB,gCAAgC,IAAI,cACtD,oBAAI;AACR,gBAAc,IAAI,OAAO;AACzB,kCAAgC,IAAI,WAAW;AAE/C,SAAO;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { TraceParseEvent } from "./ModelImpl.js";
|
|
2
|
-
var Status = /* @__PURE__ */ ((Status2) => {
|
|
3
|
-
Status2[Status2["IDLE"] = 0] = "IDLE";
|
|
4
|
-
Status2[Status2["PARSING"] = 1] = "PARSING";
|
|
5
|
-
Status2[Status2["FINISHED_PARSING"] = 2] = "FINISHED_PARSING";
|
|
6
|
-
Status2[Status2["ERRORED_WHILE_PARSING"] = 3] = "ERRORED_WHILE_PARSING";
|
|
7
|
-
return Status2;
|
|
8
|
-
})(Status || {});
|
|
9
|
-
export class TraceProcessor extends EventTarget {
|
|
10
|
-
#traceHandlers;
|
|
11
|
-
#pauseDuration;
|
|
12
|
-
#pauseFrequencyMs;
|
|
13
|
-
#status = 0 /* IDLE */;
|
|
14
|
-
constructor(traceHandlers, { pauseDuration = 20, pauseFrequencyMs = 100 } = {}) {
|
|
15
|
-
super();
|
|
16
|
-
this.#traceHandlers = traceHandlers;
|
|
17
|
-
this.#pauseDuration = pauseDuration;
|
|
18
|
-
this.#pauseFrequencyMs = pauseFrequencyMs;
|
|
19
|
-
}
|
|
20
|
-
reset() {
|
|
21
|
-
if (this.#status === 1 /* PARSING */) {
|
|
22
|
-
throw new Error("Trace processor can't reset while parsing.");
|
|
23
|
-
}
|
|
24
|
-
const handlers = Object.values(this.#traceHandlers);
|
|
25
|
-
for (const handler of handlers) {
|
|
26
|
-
handler.reset();
|
|
27
|
-
}
|
|
28
|
-
this.#status = 0 /* IDLE */;
|
|
29
|
-
}
|
|
30
|
-
async parse(traceEvents, freshRecording = false) {
|
|
31
|
-
if (this.#status !== 0 /* IDLE */) {
|
|
32
|
-
throw new Error("Trace processor can't start parsing when not idle.");
|
|
33
|
-
}
|
|
34
|
-
try {
|
|
35
|
-
this.#status = 1 /* PARSING */;
|
|
36
|
-
await this.#parse(traceEvents, freshRecording);
|
|
37
|
-
this.#status = 2 /* FINISHED_PARSING */;
|
|
38
|
-
} catch (e) {
|
|
39
|
-
this.#status = 3 /* ERRORED_WHILE_PARSING */;
|
|
40
|
-
throw e;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
async #parse(traceEvents, freshRecording) {
|
|
44
|
-
const traceEventIterator = new TraceEventIterator(traceEvents, this.#pauseDuration, this.#pauseFrequencyMs);
|
|
45
|
-
const sortedHandlers = [...sortHandlers(this.#traceHandlers).values()];
|
|
46
|
-
for (const handler of sortedHandlers) {
|
|
47
|
-
handler.reset();
|
|
48
|
-
}
|
|
49
|
-
for (const handler of sortedHandlers) {
|
|
50
|
-
handler.initialize?.(freshRecording);
|
|
51
|
-
}
|
|
52
|
-
for await (const item of traceEventIterator) {
|
|
53
|
-
if (item.kind === IteratorItemType.STATUS_UPDATE) {
|
|
54
|
-
this.dispatchEvent(new TraceParseEvent(item.data));
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
for (const handler of sortedHandlers) {
|
|
58
|
-
handler.handleEvent(item.data);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
for (const handler of sortedHandlers) {
|
|
62
|
-
await handler.finalize?.();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
get data() {
|
|
66
|
-
if (this.#status !== 2 /* FINISHED_PARSING */) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
const data = {};
|
|
70
|
-
for (const [name, handler] of Object.entries(this.#traceHandlers)) {
|
|
71
|
-
Object.assign(data, { [name]: handler.data() });
|
|
72
|
-
}
|
|
73
|
-
return data;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
export function sortHandlers(traceHandlers) {
|
|
77
|
-
const sortedMap = /* @__PURE__ */ new Map();
|
|
78
|
-
const visited = /* @__PURE__ */ new Set();
|
|
79
|
-
const visitHandler = (handlerName) => {
|
|
80
|
-
if (sortedMap.has(handlerName)) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
if (visited.has(handlerName)) {
|
|
84
|
-
let stackPath = "";
|
|
85
|
-
for (const handler2 of visited) {
|
|
86
|
-
if (stackPath || handler2 === handlerName) {
|
|
87
|
-
stackPath += `${handler2}->`;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
stackPath += handlerName;
|
|
91
|
-
throw new Error(`Found dependency cycle in trace event handlers: ${stackPath}`);
|
|
92
|
-
}
|
|
93
|
-
visited.add(handlerName);
|
|
94
|
-
const handler = traceHandlers[handlerName];
|
|
95
|
-
if (!handler) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const deps = handler.deps?.();
|
|
99
|
-
if (deps) {
|
|
100
|
-
deps.forEach(visitHandler);
|
|
101
|
-
}
|
|
102
|
-
sortedMap.set(handlerName, handler);
|
|
103
|
-
};
|
|
104
|
-
for (const handlerName of Object.keys(traceHandlers)) {
|
|
105
|
-
visitHandler(handlerName);
|
|
106
|
-
}
|
|
107
|
-
return sortedMap;
|
|
108
|
-
}
|
|
109
|
-
var IteratorItemType = /* @__PURE__ */ ((IteratorItemType2) => {
|
|
110
|
-
IteratorItemType2[IteratorItemType2["TRACE_EVENT"] = 1] = "TRACE_EVENT";
|
|
111
|
-
IteratorItemType2[IteratorItemType2["STATUS_UPDATE"] = 2] = "STATUS_UPDATE";
|
|
112
|
-
return IteratorItemType2;
|
|
113
|
-
})(IteratorItemType || {});
|
|
114
|
-
class TraceEventIterator {
|
|
115
|
-
constructor(traceEvents, pauseDuration, pauseFrequencyMs) {
|
|
116
|
-
this.traceEvents = traceEvents;
|
|
117
|
-
this.pauseDuration = pauseDuration;
|
|
118
|
-
this.pauseFrequencyMs = pauseFrequencyMs;
|
|
119
|
-
this.#time = performance.now();
|
|
120
|
-
}
|
|
121
|
-
#time;
|
|
122
|
-
async *[Symbol.asyncIterator]() {
|
|
123
|
-
for (let i = 0, length = this.traceEvents.length; i < length; i++) {
|
|
124
|
-
if (performance.now() - this.#time > this.pauseFrequencyMs) {
|
|
125
|
-
this.#time = performance.now();
|
|
126
|
-
yield { kind: 2 /* STATUS_UPDATE */, data: { index: i, total: length } };
|
|
127
|
-
await new Promise((resolve) => setTimeout(resolve, this.pauseDuration));
|
|
128
|
-
}
|
|
129
|
-
yield { kind: 1 /* TRACE_EVENT */, data: this.traceEvents[i] };
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
//# sourceMappingURL=TraceProcessor.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../front_end/models/trace/TraceProcessor.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright 2022 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\nimport type * as Handlers from './handlers/handlers.js';\nimport type * as Types from './types/types.js';\n\nimport {type TraceParseEventProgressData, TraceParseEvent} from './ModelImpl.js';\nconst enum Status {\n IDLE = 0,\n PARSING = 1,\n FINISHED_PARSING = 2,\n ERRORED_WHILE_PARSING = 3,\n}\n\nexport class TraceProcessor<ModelHandlers extends {[key: string]: Handlers.Types.TraceEventHandler}> extends\n EventTarget {\n readonly #traceHandlers: {[key: string]: Handlers.Types.TraceEventHandler};\n #pauseDuration: number;\n #pauseFrequencyMs: number;\n #status = Status.IDLE;\n\n constructor(traceHandlers: ModelHandlers, {pauseDuration = 20, pauseFrequencyMs = 100} = {}) {\n super();\n\n this.#traceHandlers = traceHandlers;\n this.#pauseDuration = pauseDuration;\n this.#pauseFrequencyMs = pauseFrequencyMs;\n }\n\n reset(): void {\n if (this.#status === Status.PARSING) {\n throw new Error('Trace processor can\\'t reset while parsing.');\n }\n\n const handlers = Object.values(this.#traceHandlers);\n for (const handler of handlers) {\n handler.reset();\n }\n\n this.#status = Status.IDLE;\n }\n\n async parse(traceEvents: readonly Types.TraceEvents.TraceEventData[], freshRecording = false): Promise<void> {\n if (this.#status !== Status.IDLE) {\n throw new Error('Trace processor can\\'t start parsing when not idle.');\n }\n try {\n this.#status = Status.PARSING;\n await this.#parse(traceEvents, freshRecording);\n this.#status = Status.FINISHED_PARSING;\n } catch (e) {\n this.#status = Status.ERRORED_WHILE_PARSING;\n throw e;\n }\n }\n\n async #parse(traceEvents: readonly Types.TraceEvents.TraceEventData[], freshRecording: boolean): Promise<void> {\n // This iterator steps through all events, periodically yielding back to the\n // main thread to avoid blocking execution. It uses `dispatchEvent` to\n // provide status update events, and other various bits of config like the\n // pause duration and frequency.\n const traceEventIterator = new TraceEventIterator(traceEvents, this.#pauseDuration, this.#pauseFrequencyMs);\n\n // Convert to array so that we are able to iterate all handlers multiple times.\n const sortedHandlers = [...sortHandlers(this.#traceHandlers).values()];\n // Reset.\n for (const handler of sortedHandlers) {\n handler.reset();\n }\n\n // Initialize.\n for (const handler of sortedHandlers) {\n handler.initialize?.(freshRecording);\n }\n\n // Handle each event.\n for await (const item of traceEventIterator) {\n if (item.kind === IteratorItemType.STATUS_UPDATE) {\n this.dispatchEvent(new TraceParseEvent(item.data));\n continue;\n }\n for (const handler of sortedHandlers) {\n handler.handleEvent(item.data);\n }\n }\n\n // Finalize.\n for (const handler of sortedHandlers) {\n await handler.finalize?.();\n }\n }\n\n get data(): Handlers.Types.HandlerData<ModelHandlers>|null {\n if (this.#status !== Status.FINISHED_PARSING) {\n return null;\n }\n\n const data = {};\n for (const [name, handler] of Object.entries(this.#traceHandlers)) {\n Object.assign(data, {[name]: handler.data()});\n }\n\n return data as Handlers.Types.HandlerData<ModelHandlers>;\n }\n}\n\n/**\n * Some Handlers need data provided by others. Dependencies of a handler handler are\n * declared in the `deps` field.\n * @returns A map from trace event handler name to trace event hander whose entries\n * iterate in such a way that each handler is visited after its dependencies.\n */\nexport function sortHandlers(\n traceHandlers: Partial<{[key in Handlers.Types.TraceEventHandlerName]: Handlers.Types.TraceEventHandler}>):\n Map<Handlers.Types.TraceEventHandlerName, Handlers.Types.TraceEventHandler> {\n const sortedMap = new Map<Handlers.Types.TraceEventHandlerName, Handlers.Types.TraceEventHandler>();\n const visited = new Set<Handlers.Types.TraceEventHandlerName>();\n const visitHandler = (handlerName: Handlers.Types.TraceEventHandlerName): void => {\n if (sortedMap.has(handlerName)) {\n return;\n }\n if (visited.has(handlerName)) {\n let stackPath = '';\n for (const handler of visited) {\n if (stackPath || handler === handlerName) {\n stackPath += `${handler}->`;\n }\n }\n stackPath += handlerName;\n throw new Error(`Found dependency cycle in trace event handlers: ${stackPath}`);\n }\n visited.add(handlerName);\n const handler = traceHandlers[handlerName];\n if (!handler) {\n return;\n }\n const deps = handler.deps?.();\n if (deps) {\n deps.forEach(visitHandler);\n }\n sortedMap.set(handlerName, handler);\n };\n\n for (const handlerName of Object.keys(traceHandlers)) {\n visitHandler(handlerName as Handlers.Types.TraceEventHandlerName);\n }\n return sortedMap;\n}\n\nconst enum IteratorItemType {\n TRACE_EVENT = 1,\n STATUS_UPDATE = 2,\n}\n\ntype IteratorItem = IteratorTraceEventItem|IteratorStatusUpdateItem;\n\ntype IteratorTraceEventItem = {\n kind: IteratorItemType.TRACE_EVENT,\n data: Types.TraceEvents.TraceEventData,\n};\n\ntype IteratorStatusUpdateItem = {\n kind: IteratorItemType.STATUS_UPDATE,\n data: TraceParseEventProgressData,\n};\n\nclass TraceEventIterator {\n #time: number;\n\n constructor(\n private traceEvents: readonly Types.TraceEvents.TraceEventData[], private pauseDuration: number,\n private pauseFrequencyMs: number) {\n this.#time = performance.now();\n }\n\n async * [Symbol.asyncIterator](): AsyncGenerator<IteratorItem, void, void> {\n for (let i = 0, length = this.traceEvents.length; i < length; i++) {\n // Every so often we take a break just to render.\n if (performance.now() - this.#time > this.pauseFrequencyMs) {\n this.#time = performance.now();\n // Take the opportunity to provide status update events.\n yield {kind: IteratorItemType.STATUS_UPDATE, data: {index: i, total: length}};\n // Wait for rendering before resuming.\n await new Promise(resolve => setTimeout(resolve, this.pauseDuration));\n }\n\n yield {kind: IteratorItemType.TRACE_EVENT, data: this.traceEvents[i]};\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "AAOA;AACA,IAAW,SAAX,kBAAW,YAAX;AACE,4BAAO,KAAP;AACA,+BAAU,KAAV;AACA,wCAAmB,KAAnB;AACA,6CAAwB,KAAxB;AAJS;AAAA;AAOJ,oCACH,YAAY;AAAA;AAAA;AAAA;AAAA,YAIJ;AAAA,EAEV,YAAY,eAA8B,EAAC,gBAAgB,IAAI,mBAAmB,QAAO,IAAI;AAC3F;AAEA,0BAAsB;AACtB,0BAAsB;AACtB,6BAAyB;AAAA;AAAA,EAG3B,QAAc;AACZ,QAAI,iBAAiB,iBAAgB;AACnC,YAAM,IAAI,MAAM;AAAA;AAGlB,UAAM,WAAW,OAAO,OAAO;AAC/B,eAAW,WAAW,UAAU;AAC9B,cAAQ;AAAA;AAGV,mBAAe;AAAA;AAAA,QAGX,MAAM,aAA0D,iBAAiB,OAAsB;AAC3G,QAAI,iBAAiB,cAAa;AAChC,YAAM,IAAI,MAAM;AAAA;AAElB,QAAI;AACF,qBAAe;AACf,YAAM,YAAY,aAAa;AAC/B,qBAAe;AAAA,aACR,GAAP;AACA,qBAAe;AACf,YAAM;AAAA;AAAA;AAAA,eAIG,aAA0D,gBAAwC;AAK7G,UAAM,qBAAqB,IAAI,mBAAmB,aAAa,qBAAqB;AAGpF,UAAM,iBAAiB,CAAC,GAAG,aAAa,qBAAqB;AAE7D,eAAW,WAAW,gBAAgB;AACpC,cAAQ;AAAA;AAIV,eAAW,WAAW,gBAAgB;AACpC,cAAQ,aAAa;AAAA;A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;AAAA;AAAA,UAGlB,OAAO,iBAA2D;AACzE,aAAS,IAAI,GAAG,SAAS,KAAK,YAAY,QAAQ,IAAI,QAAQ,KAAK;AAEjE,UAAI,YAAY,QAAQ,aAAa,KAAK,kBAAkB;AAC1D,qBAAa,YAAY;AAEzB,cAAM,EAAC,MAAM,uBAAgC,MAAM,EAAC,OAAO,GAAG,OAAO;AAErE,cAAM,IAAI,QAAQ,aAAW,WAAW,SAAS,KAAK;AAAA;AAGxD,YAAM,EAAC,MAAM,qBAA8B,MAAM,KAAK,YAAY;AAAA;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import * as Platform from "../../core/platform/platform.js";
|
|
2
|
-
export var TreeAction = /* @__PURE__ */ ((TreeAction2) => {
|
|
3
|
-
TreeAction2["MERGE_FUNCTION"] = "MERGE_FUNCTION";
|
|
4
|
-
TreeAction2["COLLAPSE_FUNCTION"] = "COLLAPSE_FUNCTION";
|
|
5
|
-
return TreeAction2;
|
|
6
|
-
})(TreeAction || {});
|
|
7
|
-
export class TreeManipulator {
|
|
8
|
-
#entryToNode;
|
|
9
|
-
#lastInvisibleEntries = null;
|
|
10
|
-
#activeActions = [];
|
|
11
|
-
constructor(entryToNode) {
|
|
12
|
-
this.#entryToNode = entryToNode;
|
|
13
|
-
}
|
|
14
|
-
applyAction(action) {
|
|
15
|
-
if (this.#actionIsActive(action)) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
this.#activeActions.push(action);
|
|
19
|
-
this.#lastInvisibleEntries = null;
|
|
20
|
-
}
|
|
21
|
-
removeActiveAction(action) {
|
|
22
|
-
let removedAction = false;
|
|
23
|
-
this.#activeActions = this.#activeActions.filter((activeAction) => {
|
|
24
|
-
if (activeAction.type === action.type && activeAction.entry === action.entry) {
|
|
25
|
-
removedAction = true;
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
return true;
|
|
29
|
-
});
|
|
30
|
-
if (removedAction) {
|
|
31
|
-
this.#lastInvisibleEntries = null;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
#actionIsActive(action) {
|
|
35
|
-
return this.#activeActions.some((activeAction) => {
|
|
36
|
-
return action.entry === activeAction.entry && action.type === activeAction.type;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
invisibleEntries() {
|
|
40
|
-
if (this.#activeActions.length === 0) {
|
|
41
|
-
return [];
|
|
42
|
-
}
|
|
43
|
-
return this.#calculateInvisibleEntries();
|
|
44
|
-
}
|
|
45
|
-
#calculateInvisibleEntries() {
|
|
46
|
-
if (this.#lastInvisibleEntries) {
|
|
47
|
-
return this.#lastInvisibleEntries;
|
|
48
|
-
}
|
|
49
|
-
const entriesToHide = /* @__PURE__ */ new Set();
|
|
50
|
-
for (const action of this.#activeActions) {
|
|
51
|
-
switch (action.type) {
|
|
52
|
-
case "MERGE_FUNCTION" /* MERGE_FUNCTION */: {
|
|
53
|
-
entriesToHide.add(action.entry);
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
case "COLLAPSE_FUNCTION" /* COLLAPSE_FUNCTION */: {
|
|
57
|
-
const entryNode = this.#entryToNode.get(action.entry);
|
|
58
|
-
if (!entryNode) {
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
const allAncestors = this.#findAllAncestorsOfNode(entryNode);
|
|
62
|
-
allAncestors.forEach((ancestor) => entriesToHide.add(ancestor));
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
default:
|
|
66
|
-
Platform.assertNever(action.type, `Unknown TreeManipulator action: ${action.type}`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
this.#lastInvisibleEntries = [...entriesToHide];
|
|
70
|
-
return this.#lastInvisibleEntries;
|
|
71
|
-
}
|
|
72
|
-
#findAllAncestorsOfNode(root) {
|
|
73
|
-
const ancestors = [];
|
|
74
|
-
const children = [...root.children];
|
|
75
|
-
while (children.length > 0) {
|
|
76
|
-
const childNode = children.shift();
|
|
77
|
-
if (childNode) {
|
|
78
|
-
ancestors.push(childNode.entry);
|
|
79
|
-
children.push(...childNode.children);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return ancestors;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=TreeManipulator.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../front_end/models/trace/TreeManipulator.ts"],
|
|
4
|
-
"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 type * as Helpers from './helpers/helpers.js';\nimport type * as Types from './types/types.js';\n\ntype EntryToNodeMap = Map<Types.TraceEvents.TraceEntry, Helpers.TreeHelpers.TraceEntryNode>;\n\nexport const enum TreeAction {\n MERGE_FUNCTION = 'MERGE_FUNCTION',\n COLLAPSE_FUNCTION = 'COLLAPSE_FUNCTION',\n}\n\nexport interface UserTreeAction {\n type: TreeAction;\n entry: Types.TraceEvents.TraceEntry;\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 TreeManipulator {\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 last calculated set of invisible entries. This means we can avoid\n // re-generating this if the set of actions that have been applied has not\n // changed.\n #lastInvisibleEntries: Types.TraceEvents.TraceEntry[]|null = null;\n #activeActions: UserTreeAction[] = [];\n\n constructor(entryToNode: EntryToNodeMap) {\n this.#entryToNode = entryToNode;\n }\n\n /**\n * Applies an action to the visible tree. This will also clear the cache of\n * invisible entries, ensuring that it will be recalculated with the latest set\n * of actions.\n **/\n applyAction(action: UserTreeAction): void {\n if (this.#actionIsActive(action)) {\n // If the action is already active there is no reason to apply it again.\n return;\n }\n\n this.#activeActions.push(action);\n // Clear the last list of invisible entries - this invalidates the cache and\n // ensures that the invisible list will be recalculated, which we have to do\n // now we have changed the list of actions.\n this.#lastInvisibleEntries = null;\n }\n\n /**\n * Removes a matching action, if one is found, from the active actions set.\n * Note that we do not match on action equality and instead search through\n * the set of active actions for one that is of the same type, and has the\n * same entry associated with it.\n *\n * This is a no-op if the action is not active.\n **/\n removeActiveAction(action: UserTreeAction): void {\n let removedAction = false;\n this.#activeActions = this.#activeActions.filter(activeAction => {\n if (activeAction.type === action.type && activeAction.entry === action.entry) {\n removedAction = true;\n return false;\n }\n return true;\n });\n\n if (removedAction) {\n // If we found and removed an action, we need to clear the cache to force\n // the set of invisible entries to be recalculcated.\n this.#lastInvisibleEntries = null;\n }\n }\n\n #actionIsActive(action: UserTreeAction): boolean {\n return this.#activeActions.some(activeAction => {\n return action.entry === activeAction.entry && action.type === activeAction.type;\n });\n }\n\n /**\n * The set of entries that are invisible given the set of applied actions. If\n * no actions are applied, this will return an empty list of entries.\n *\n * This method is cached, so it is safe to call multiple times.\n **/\n invisibleEntries(): Types.TraceEvents.TraceEventData[] {\n if (this.#activeActions.length === 0) {\n return [];\n }\n return this.#calculateInvisibleEntries();\n }\n\n #calculateInvisibleEntries(): Types.TraceEvents.TraceEventData[] {\n // When an action is added, we clear this cache. So if this cache is\n // present it means that the set of active actions has not changed, and so\n // we do not need to recalculate anything.\n if (this.#lastInvisibleEntries) {\n return this.#lastInvisibleEntries;\n }\n\n // We apply each user action in turn to the set of all entries, and mark\n // any that should be hidden by adding them to this set. We do this to\n // ensure we minimise the amount of passes through the list of all entries.\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.TraceEntry>();\n\n for (const action of this.#activeActions) {\n switch (action.type) {\n case TreeAction.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 break;\n }\n\n case TreeAction.COLLAPSE_FUNCTION: {\n // The entry itself remains visible, but all of its ancestors are hidden.\n const entryNode = this.#entryToNode.get(action.entry);\n if (!entryNode) {\n // Invalid node was given, just ignore and move on.\n continue;\n }\n const allAncestors = this.#findAllAncestorsOfNode(entryNode);\n allAncestors.forEach(ancestor => entriesToHide.add(ancestor));\n break;\n }\n default:\n Platform.assertNever(action.type, `Unknown TreeManipulator action: ${action.type}`);\n }\n }\n\n // Now we have applied all actions, return the invisible entries.\n // We cache this under lastInvisibleEntries - if this function is called\n // again and the user actions have not changed, we can avoid recalculating\n // this and just return the last one. This cache is automatically cleared\n // when the user actions are changed.\n\n this.#lastInvisibleEntries = [...entriesToHide];\n\n return this.#lastInvisibleEntries;\n }\n\n #findAllAncestorsOfNode(root: Helpers.TreeHelpers.TraceEntryNode): Types.TraceEvents.TraceEntry[] {\n const ancestors: Types.TraceEvents.TraceEntry[] = [];\n\n // Walk through all the ancestors, 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 ancestors.push(childNode.entry);\n children.push(...childNode.children);\n }\n }\n\n return ancestors;\n }\n}\n"],
|
|
5
|
-
"mappings": "AAGA;AAOO,WAAW,aAAX,kBAAW,gBAAX;AACL,kCAAiB;AACjB,qCAAoB;AAFJ;AAAA;AAoBX,6BAAsB;AAAA;AAAA,0BASkC;AAAA,mBAC1B;AAAA,EAEnC,YAAY,aAA6B;AACvC,wBAAoB;AAAA;AAAA,EAQtB,YAAY,QAA8B;AACxC,QAAI,qBAAqB,SAAS;AAEhC;AAAA;AAGF,wBAAoB,KAAK;AAIzB,iCAA6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-1,43 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"allowJs": true,
|
|
4
|
-
"checkJs": true,
|
|
5
|
-
"composite": true,
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"experimentalDecorators": true,
|
|
8
|
-
"forceConsistentCasingInFileNames": true,
|
|
9
|
-
"inlineSources": true,
|
|
10
|
-
"lib": [
|
|
11
|
-
"esnext",
|
|
12
|
-
"dom",
|
|
13
|
-
"dom.iterable"
|
|
14
|
-
],
|
|
15
|
-
"module": "esnext",
|
|
16
|
-
"noEmitOnError": true,
|
|
17
|
-
"noFallthroughCasesInSwitch": true,
|
|
18
|
-
"noImplicitOverride": true,
|
|
19
|
-
"noImplicitReturns": true,
|
|
20
|
-
"noUnusedLocals": false,
|
|
21
|
-
"outDir": ".",
|
|
22
|
-
"rootDir": "../../../../../../front_end/models/trace",
|
|
23
|
-
"skipLibCheck": true,
|
|
24
|
-
"sourceMap": true,
|
|
25
|
-
"strict": true,
|
|
26
|
-
"target": "esnext",
|
|
27
|
-
"tsBuildInfoFile": "devtools_entrypoint-legacy-typescript-tsconfig.json.tsbuildinfo",
|
|
28
|
-
"typeRoots": [],
|
|
29
|
-
"useUnknownInCatchVariables": false
|
|
30
|
-
},
|
|
31
|
-
"files": [
|
|
32
|
-
"../../../../../../front_end/models/trace/trace-legacy.ts",
|
|
33
|
-
"../../../../../../front_end/legacy/legacy-defs.d.ts",
|
|
34
|
-
"../../../../../../front_end/global_typings/global_defs.d.ts",
|
|
35
|
-
"../../../../../../front_end/global_typings/request_idle_callback.d.ts",
|
|
36
|
-
"../../../../../../node_modules/@types/filesystem/index.d.ts"
|
|
37
|
-
],
|
|
38
|
-
"references": [
|
|
39
|
-
{
|
|
40
|
-
"path": "./bundle-tsconfig.json"
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
}
|