Commit 83bf8907 authored by Alexei Filippov's avatar Alexei Filippov Committed by Commit Bot

DevTools: Fix memory panel datagrid being empty.

1. The revealed getter should not return true for detached nodes.
2. The height of a node used to calculate the viewport should not depend on
   the node is attached or not.

Bug: 738932
Change-Id: Ib526c3476fd51996158d87736bdeb6cf2678aed5
Reviewed-on: https://chromium-review.googlesource.com/567774Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Commit-Queue: Alexei Filippov <alph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486282}
parent b642ce1b
https://crbug.com/738932 Tests the snapshot view is not empty on repeatitive expand-collapse.
Profiler was enabled.
Detailed heap profiles were enabled.
Running: testShowAll
A data-grid-data-grid-node parent revealed
A data-grid-data-grid-node parent revealed
A data-grid-data-grid-node parent revealed
A data-grid-data-grid-node parent revealed
A data-grid-data-grid-node parent revealed
A data-grid-data-grid-node parent revealed
A data-grid-data-grid-node parent revealed
A data-grid-data-grid-node parent revealed
A data-grid-data-grid-node parent revealed
A data-grid-data-grid-node parent revealed
undefined data-grid-data-grid-node revealed
Profiler was disabled.
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="heap-snapshot-test.js"></script>
<script>
function test()
{
var instanceCount = 25;
function createHeapSnapshot()
{
return InspectorTest.createHeapSnapshot(instanceCount);
}
InspectorTest.runHeapSnapshotTestSuite([
function testShowAll(next)
{
InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1);
function step1()
{
InspectorTest.switchToView("Summary", step2);
}
function step2()
{
InspectorTest.findAndExpandRow("A", step3);
}
function step3(row)
{
row.collapse();
row.expand();
for (var child of row.children)
InspectorTest.addResult(child._name + " " + child._element.classList.value);
next();
}
}
]);
}
</script>
</head>
<body onload="runTest()">
<p>
https://crbug.com/738932
Tests the snapshot view is not empty on repeatitive expand-collapse.
</p>
</body>
</html>
...@@ -1374,7 +1374,7 @@ DataGrid.DataGridNode = class extends Common.Object { ...@@ -1374,7 +1374,7 @@ DataGrid.DataGridNode = class extends Common.Object {
currentAncestor = currentAncestor.parent; currentAncestor = currentAncestor.parent;
} }
this._revealed = true; this.revealed = true;
return true; return true;
} }
......
...@@ -389,7 +389,6 @@ Profiler.HeapSnapshotViewportDataGrid = class extends Profiler.HeapSnapshotSorta ...@@ -389,7 +389,6 @@ Profiler.HeapSnapshotViewportDataGrid = class extends Profiler.HeapSnapshotSorta
var hasChildren = child.hasChildren(); var hasChildren = child.hasChildren();
child.removeChildren(); child.removeChildren();
child.setHasChildren(hasChildren); child.setHasChildren(hasChildren);
child.revealed = true;
parentNode.appendChild(child); parentNode.appendChild(child);
position += child.nodeSelfHeight(); position += child.nodeSelfHeight();
position += this._addVisibleNodes(child, topBound - position, bottomBound - position); position += this._addVisibleNodes(child, topBound - position, bottomBound - position);
...@@ -414,8 +413,6 @@ Profiler.HeapSnapshotViewportDataGrid = class extends Profiler.HeapSnapshotSorta ...@@ -414,8 +413,6 @@ Profiler.HeapSnapshotViewportDataGrid = class extends Profiler.HeapSnapshotSorta
* @return {number} * @return {number}
*/ */
_nodeHeight(node) { _nodeHeight(node) {
if (!node.revealed)
return 0;
var result = node.nodeSelfHeight(); var result = node.nodeSelfHeight();
if (!node.expanded) if (!node.expanded)
return result; return result;
......
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