- Revision
- 200086
- Author
- [email protected]
- Date
- 2016-04-26 08:03:37 -0700 (Tue, 26 Apr 2016)
Log Message
Web Inspector: Clarify Heap Snapshot instance Retained Size by hiding retained size of non-dominated children
https://bugs.webkit.org/show_bug.cgi?id=157018
Patch by Joseph Pecoraro <[email protected]> on 2016-04-26
Reviewed by Timothy Hatcher.
* UserInterface/Proxies/HeapSnapshotNodeProxy.js:
(WebInspector.HeapSnapshotNodeProxy):
(WebInspector.HeapSnapshotNodeProxy.deserialize):
* UserInterface/Workers/HeapSnapshot/HeapSnapshot.js:
(HeapSnapshot.prototype.serializeNode):
Include dominatorNodeIdentifier in the default proxy properties.
* UserInterface/Views/HeapSnapshotInstanceDataGridNode.js:
(WebInspector.HeapSnapshotInstanceDataGridNode):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype.get node):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype.createCellContent):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype._isDominatedByBase):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype._isDominatedByNonBaseParent):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype._populate):
* UserInterface/Views/HeapSnapshotInstancesContentView.css:
(.heap-snapshot > .data-grid td .sub-retained):
Save the base HeapSnapshotInstanceDataGridNode so that it can be referenced by
children. When expanding an instance, hide the retained size for children
that are not dominated by the base object. Show the retained size for children
for children that are dominated. If dominated directly, show the size in the
normal black. If dominated transitively, show the size in a dimmed gray.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (200085 => 200086)
--- trunk/Source/WebInspectorUI/ChangeLog 2016-04-26 14:58:50 UTC (rev 200085)
+++ trunk/Source/WebInspectorUI/ChangeLog 2016-04-26 15:03:37 UTC (rev 200086)
@@ -1,3 +1,32 @@
+2016-04-26 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: Clarify Heap Snapshot instance Retained Size by hiding retained size of non-dominated children
+ https://bugs.webkit.org/show_bug.cgi?id=157018
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Proxies/HeapSnapshotNodeProxy.js:
+ (WebInspector.HeapSnapshotNodeProxy):
+ (WebInspector.HeapSnapshotNodeProxy.deserialize):
+ * UserInterface/Workers/HeapSnapshot/HeapSnapshot.js:
+ (HeapSnapshot.prototype.serializeNode):
+ Include dominatorNodeIdentifier in the default proxy properties.
+
+ * UserInterface/Views/HeapSnapshotInstanceDataGridNode.js:
+ (WebInspector.HeapSnapshotInstanceDataGridNode):
+ (WebInspector.HeapSnapshotInstanceDataGridNode.prototype.get node):
+ (WebInspector.HeapSnapshotInstanceDataGridNode.prototype.createCellContent):
+ (WebInspector.HeapSnapshotInstanceDataGridNode.prototype._isDominatedByBase):
+ (WebInspector.HeapSnapshotInstanceDataGridNode.prototype._isDominatedByNonBaseParent):
+ (WebInspector.HeapSnapshotInstanceDataGridNode.prototype._populate):
+ * UserInterface/Views/HeapSnapshotInstancesContentView.css:
+ (.heap-snapshot > .data-grid td .sub-retained):
+ Save the base HeapSnapshotInstanceDataGridNode so that it can be referenced by
+ children. When expanding an instance, hide the retained size for children
+ that are not dominated by the base object. Show the retained size for children
+ for children that are dominated. If dominated directly, show the size in the
+ normal black. If dominated transitively, show the size in a dimmed gray.
+
2016-04-25 Matt Baker <[email protected]>
Web Inspector: hook up grid row filtering in the new Timelines UI
Modified: trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotNodeProxy.js (200085 => 200086)
--- trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotNodeProxy.js 2016-04-26 14:58:50 UTC (rev 200085)
+++ trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotNodeProxy.js 2016-04-26 15:03:37 UTC (rev 200086)
@@ -25,7 +25,7 @@
WebInspector.HeapSnapshotNodeProxy = class HeapSnapshotNodeProxy
{
- constructor(snapshotObjectId, identifier, className, size, retainedSize, internal, gcRoot, hasChildren)
+ constructor(snapshotObjectId, identifier, className, size, retainedSize, internal, gcRoot, dominatorNodeIdentifier, hasChildren)
{
this._proxyObjectId = snapshotObjectId;
@@ -35,6 +35,7 @@
this.retainedSize = retainedSize;
this.internal = internal;
this.gcRoot = gcRoot;
+ this.dominatorNodeIdentifier = dominatorNodeIdentifier;
this.hasChildren = hasChildren;
}
@@ -42,8 +43,8 @@
static deserialize(objectId, serializedNode)
{
- let {id, className, size, retainedSize, internal, gcRoot, hasChildren} = serializedNode;
- return new WebInspector.HeapSnapshotNodeProxy(objectId, id, className, size, retainedSize, internal, gcRoot, hasChildren);
+ let {id, className, size, retainedSize, internal, gcRoot, dominatorNodeIdentifier, hasChildren} = serializedNode;
+ return new WebInspector.HeapSnapshotNodeProxy(objectId, id, className, size, retainedSize, internal, gcRoot, dominatorNodeIdentifier, hasChildren);
}
// Proxied
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstanceDataGridNode.js (200085 => 200086)
--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstanceDataGridNode.js 2016-04-26 14:58:50 UTC (rev 200085)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstanceDataGridNode.js 2016-04-26 15:03:37 UTC (rev 200086)
@@ -25,7 +25,7 @@
WebInspector.HeapSnapshotInstanceDataGridNode = class HeapSnapshotInstanceDataGridNode extends WebInspector.DataGridNode
{
- constructor(node, tree, edge)
+ constructor(node, tree, edge, base)
{
// Don't treat strings as having child nodes, even if they have a Structure.
let hasChildren = node.hasChildren && node.className !== "string";
@@ -34,10 +34,12 @@
console.assert(node instanceof WebInspector.HeapSnapshotNodeProxy);
console.assert(!edge || edge instanceof WebInspector.HeapSnapshotEdgeProxy);
+ console.assert(!base || base instanceof WebInspector.HeapSnapshotInstanceDataGridNode);
this._node = node;
this._tree = tree;
this._edge = edge || null;
+ this._base = base || null;
// FIXME: Make instance grid nodes copyable.
this.copyable = false;
@@ -94,6 +96,7 @@
// Protected
get data() { return this._node; }
+ get node() { return this._node; }
get selectable() { return false; }
createCells()
@@ -106,6 +109,14 @@
createCellContent(columnIdentifier)
{
if (columnIdentifier === "retainedSize") {
+ let subRetainedSize = false;
+ if (this._base) {
+ if (this._isDominatedByNonBaseParent())
+ subRetainedSize = true;
+ else if (!this._isDominatedByBase())
+ return emDash;
+ }
+
let size = this._node.retainedSize;
let fragment = document.createDocumentFragment();
let sizeElement = fragment.appendChild(document.createElement("span"));
@@ -115,6 +126,12 @@
let percentElement = fragment.appendChild(document.createElement("span"));
percentElement.classList.add("percentage");
percentElement.textContent = Number.percentageString(fraction);
+
+ if (subRetainedSize) {
+ sizeElement.classList.add("sub-retained");
+ percentElement.classList.add("sub-retained");
+ }
+
return fragment;
}
@@ -208,6 +225,23 @@
// Private
+ _isDominatedByBase()
+ {
+ return this._node.dominatorNodeIdentifier === this._base.node.id;
+ }
+
+ _isDominatedByNonBaseParent()
+ {
+ for (let p = this.parent; p; p = p.parent) {
+ if (p === this._base)
+ return false;
+ if (this._node.dominatorNodeIdentifier === this.parent.node.id)
+ return true;
+ }
+
+ return false;
+ }
+
_populate()
{
this.removeEventListener("populate", this._populate, this);
@@ -226,7 +260,7 @@
// FIXME: This should gracefully handle a node that references many objects.
for (let instance of instances)
- this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(instance, this._tree, instance.__edge));
+ this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(instance, this._tree, instance.__edge, this._base || this));
});
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstancesContentView.css (200085 => 200086)
--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstancesContentView.css 2016-04-26 14:58:50 UTC (rev 200085)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstancesContentView.css 2016-04-26 15:03:37 UTC (rev 200086)
@@ -31,6 +31,10 @@
bottom: 0;
}
+.heap-snapshot > .data-grid td .sub-retained {
+ color: hsl(0, 0%, 60%);
+}
+
.heap-snapshot > .data-grid td .percentage {
width: 45px;
margin-left: 4px;
Modified: trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshot.js (200085 => 200086)
--- trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshot.js 2016-04-26 14:58:50 UTC (rev 200085)
+++ trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshot.js 2016-04-26 15:03:37 UTC (rev 200086)
@@ -331,6 +331,10 @@
let edgeIndex = this._nodeOrdinalToFirstOutgoingEdge[nodeOrdinal];
let hasChildren = this._edges[edgeIndex + edgeFromIdOffset] === nodeIdentifier;
+ let dominatorNodeOrdinal = this._nodeOrdinalToDominatorNodeOrdinal[nodeOrdinal];
+ let dominatorNodeIndex = dominatorNodeOrdinal * nodeFieldCount;
+ let dominatorNodeIdentifier = this._nodes[dominatorNodeIndex + nodeIdOffset];
+
return {
id: nodeIdentifier,
className: this._nodeClassNamesTable[this._nodes[nodeIndex + nodeClassNameOffset]],
@@ -338,6 +342,7 @@
retainedSize: this._nodeOrdinalToRetainedSizes[nodeOrdinal],
internal: this._nodes[nodeIndex + nodeInternalOffset] ? true : false,
gcRoot: this._nodeOrdinalIsGCRoot[nodeOrdinal] ? true : false,
+ dominatorNodeIdentifier,
hasChildren,
};
}