refactor: allocate api::Session on cpp heap (#48141)

This commit is contained in:
Robo 2025-08-25 18:52:06 +09:00 committed by GitHub
commit 3ccb1bc0a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 632 additions and 293 deletions

View file

@ -0,0 +1,25 @@
export function containsRetainingPath (snapshot, retainingPath, options) {
let root = snapshot.filter(
(node) => node.name === retainingPath[0] && node.type !== 'string');
for (let i = 1; i < retainingPath.length; i++) {
const needle = retainingPath[i];
const newRoot = [];
for (const node of root) {
for (let j = 0; j < node.outgoingEdges.length; j++) {
const child = node.outgoingEdges[j].to;
if (child.type === 'string') continue;
if (child.name === needle) {
newRoot.push(child);
}
}
}
if (!newRoot.length) {
console.log(`No retaining path found for ${needle}`);
return false;
}
root = newRoot;
}
return options?.occurrances
? root.length === options.occurrances
: true;
}