Bug 1239495 - Label the GC roots in the dominator tree. r=jdescottes

Before this patch, we used the underlying root list's C++ type as the label of
the GC roots node in the dominator tree. This patch changes that label to "GC
Roots", which does not require knowing our implementation of heap snapshots to
understand.
This commit is contained in:
Nick Fitzgerald 2016-01-19 16:29:00 +01:00
Родитель d5dae46c5f
Коммит d09fc47e9a
5 изменённых файлов: 57 добавлений и 0 удалений

Просмотреть файл

@ -109,6 +109,10 @@ viewsourceindebugger=View source in Debugger → %S
# lazily loaded sub trees in the dominator tree view. # lazily loaded sub trees in the dominator tree view.
tree-item.load-more=Load more… tree-item.load-more=Load more…
# LOCALIZATION NOTE (tree-item.rootlist): The label for the root of the
# dominator tree.
tree-item.rootlist=GC Roots
# LOCALIZATION NOTE (tree-item.nostack): The label describing the row in the heap tree # LOCALIZATION NOTE (tree-item.nostack): The label describing the row in the heap tree
# that represents a row broken down by allocation stack when no stack was available. # that represents a row broken down by allocation stack when no stack was available.
tree-item.nostack=(no stack available) tree-item.nostack=(no stack available)

Просмотреть файл

@ -78,6 +78,12 @@ const DominatorTreeItem = module.exports = createClass({
} else if (piece === "noFilename") { } else if (piece === "noFilename") {
label[i * 2] = dom.span({ key, className: "not-available" }, label[i * 2] = dom.span({ key, className: "not-available" },
L10N.getStr("tree-item.nofilename")); L10N.getStr("tree-item.nofilename"));
} else if (piece === "JS::ubi::RootList") {
// Don't use the usual labeling machinery for root lists: replace it
// with the "GC Roots" string.
label.splice(0, label.length);
label.push(L10N.getStr("tree-item.rootlist"));
break;
} else { } else {
label[i * 2] = piece; label[i * 2] = piece;
} }

Просмотреть файл

@ -4,6 +4,7 @@ support-files =
[test_DominatorTree_01.html] [test_DominatorTree_01.html]
[test_DominatorTree_02.html] [test_DominatorTree_02.html]
[test_DominatorTreeItem_01.html]
[test_Heap_01.html] [test_Heap_01.html]
[test_Heap_02.html] [test_Heap_02.html]
[test_Heap_03.html] [test_Heap_03.html]

Просмотреть файл

@ -35,6 +35,7 @@ var React = require("devtools/client/shared/vendor/react");
var ReactDOM = require("devtools/client/shared/vendor/react-dom"); var ReactDOM = require("devtools/client/shared/vendor/react-dom");
var Heap = React.createFactory(require("devtools/client/memory/components/heap")); var Heap = React.createFactory(require("devtools/client/memory/components/heap"));
var DominatorTreeComponent = React.createFactory(require("devtools/client/memory/components/dominator-tree")); var DominatorTreeComponent = React.createFactory(require("devtools/client/memory/components/dominator-tree"));
var DominatorTreeItem = React.createFactory(require("devtools/client/memory/components/dominator-tree-item"));
var Toolbar = React.createFactory(require("devtools/client/memory/components/toolbar")); var Toolbar = React.createFactory(require("devtools/client/memory/components/toolbar"));
// All tests are asynchronous. // All tests are asynchronous.

Просмотреть файл

@ -0,0 +1,45 @@
<!DOCTYPE HTML>
<html>
<!--
Test that we don't display `JS::ubi::RootList` for the root, and instead show "GC Roots".
-->
<head>
<meta charset="utf-8">
<title>Tree component test</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
</head>
<body>
<!-- Give the container height so that the whole tree is rendered. -->
<div id="container" style="height: 900px;"></div>
<pre id="test">
<script src="head.js" type="application/javascript;version=1.8"></script>
<script type="application/javascript;version=1.8">
window.onload = Task.async(function* () {
try {
const container = document.getElementById("container");
yield renderComponent(DominatorTreeItem({
item: makeTestDominatorTreeNode({ label: ["other", "JS::ubi::RootList"] }),
depth: 0,
arrow: React.DOM.div(),
focused: true,
getPercentSize: _ => 50,
onViewSourceInDebugger: _ => { },
}), container);
ok(container.textContent.indexOf("JS::ubi::RootList") == -1,
"Should not display `JS::ubi::RootList`");
ok(container.textContent.indexOf("GC Roots") >= 0,
"Should display `GC Roots` instead");
} catch(e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();
}
});
</script>
</pre>
</body>
</html>