Commit aa8286d1 authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[heap-profiler] Fix highlighting of detached DOM tree nodes.

The _markDetachedDOMTreeNodes in the worker sets the detachedDOMTreeNode
flag if the node is native and its name starts with "Detached " prefix.

This patch also ensures that '.highlight' and '.detached-dom-tree-node'
CSS styles are not set both at the same time.

Bug: 811925
Change-Id: Iee4ee0647abb19a36c1be2f078b4c2915d67cba5
Reviewed-on: https://chromium-review.googlesource.com/964761
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: default avatarAlexei Filippov <alph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544327}
parent 34cd61b7
......@@ -2616,26 +2616,20 @@ HeapSnapshotWorker.JSHeapSnapshot = class extends HeapSnapshotWorker.HeapSnapsho
}
_markDetachedDOMTreeNodes() {
const nodes = this.nodes;
const nodesLength = nodes.length;
const nodeFieldCount = this._nodeFieldCount;
const nodeNativeType = this._nodeNativeType;
const nodeTypeOffset = this._nodeTypeOffset;
const flag = this._nodeFlags.detachedDOMTreeNode;
let detachedDOMTreesRoot;
for (let iter = this.rootNode().edges(); iter.hasNext(); iter.next()) {
const node = iter.edge.node();
if (node.name() === '(Detached DOM trees)') {
detachedDOMTreesRoot = node;
break;
}
}
if (!detachedDOMTreesRoot)
return;
const detachedDOMTreeRE = /^Detached DOM tree/;
for (let iter = detachedDOMTreesRoot.edges(); iter.hasNext(); iter.next()) {
const node = iter.edge.node();
if (detachedDOMTreeRE.test(node.className())) {
for (let edgesIter = node.edges(); edgesIter.hasNext(); edgesIter.next())
this._flags[edgesIter.edge.node().nodeIndex / this._nodeFieldCount] |= flag;
}
const node = this.rootNode();
for (let nodeIndex = 0, ordinal = 0; nodeIndex < nodesLength; nodeIndex += nodeFieldCount, ordinal++) {
const nodeType = nodes[nodeIndex + nodeTypeOffset];
if (nodeType !== nodeNativeType)
continue;
node.nodeIndex = nodeIndex;
if (node.name().startsWith('Detached '))
this._flags[ordinal] |= flag;
}
}
......
......@@ -549,7 +549,7 @@ Profiler.HeapSnapshotGenericObjectNode = class extends Profiler.HeapSnapshotGrid
value = (value || '') + '[]';
break;
}
if (this._reachableFromWindow)
if (this._reachableFromWindow && !this.detachedDOMTreeNode)
valueStyle += ' highlight';
if (value === 'Object')
value = '';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment