Bug 1218840 - Remove vestigial census-view module. r=fitzgen

This commit is contained in:
Jordan Santell 2015-10-27 14:54:00 -07:00
parent d84a57cf18
commit 4b4e44b080
6 changed files with 0 additions and 258 deletions

View File

@ -1,126 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/**
* This file contains the tree view, displaying all the samples and frames
* received from the proviler in a tree-like structure.
*/
const { Cc, Ci, Cu, Cr } = require("chrome");
const { Heritage } = require("resource://devtools/client/shared/widgets/ViewHelpers.jsm");
const { AbstractTreeItem } = require("resource://devtools/client/shared/widgets/AbstractTreeItem.jsm");
const INDENTATION = exports.INDENTATION = 16; // px
const DEFAULT_AUTO_EXPAND_DEPTH = 2;
const COURSE_TYPES = ["objects", "scripts", "strings", "other"];
/**
* Every instance of a `CensusView` represents a row in the census tree. The same
* parent node is used for all rows.
*
* @param CensusView parent
* The CensusView considered the parent row. Should be null
* for root node.
* @param {CensusTreeNode} censusTreeNode
* Data from `takeCensus` transformed via `CensusTreeNode`.
* @see browser/toolkit/heapsnapshot/census-tree-node.js
* @param number level [optional]
* The indentation level in the call tree. The root node is at level 0.
* @param boolean hidden [optional]
* Whether this node should be hidden and not contribute to depth/level
* calculations. Defaults to false.
* @param number autoExpandDepth [optional]
* The depth to which the tree should automatically expand. Defaults to
* the caller's `autoExpandDepth` if a caller exists, otherwise defaults
* to DEFAULT_AUTO_EXPAND_DEPTH.
*/
function CensusView ({ caller, censusTreeNode, level, hidden, autoExpandDepth }) {
AbstractTreeItem.call(this, { parent: caller, level: level|0 - (hidden ? 1 : 0) });
this.autoExpandDepth = autoExpandDepth != null
? autoExpandDepth
: caller ? caller.autoExpandDepth
: DEFAULT_AUTO_EXPAND_DEPTH;
this.caller = caller;
this.censusTreeNode = censusTreeNode;
this.hidden = hidden;
};
CensusView.prototype = Heritage.extend(AbstractTreeItem.prototype, {
/**
* Creates the view for this tree node.
* @param nsIDOMNode document
* @param nsIDOMNode arrowNode
* @return nsIDOMNode
*/
_displaySelf: function (document, arrowNode) {
let data = this.censusTreeNode;
let cells = [];
// Only use an arrow if there are children
if (data.children && data.children.length) {
cells.push(arrowNode);
}
cells.push(this._createCell(document, data.name, "name"));
if (data.bytes != null) {
cells.push(this._createCell(document, data.bytes, "bytes"));
}
if (data.count != null) {
cells.push(this._createCell(document, data.count, "count"));
}
let targetNode = document.createElement("li");
targetNode.className = "heap-tree-item";
targetNode.style.MozMarginStart = `${this.level * INDENTATION}px`;
if (this.hidden) {
targetNode.style.display = "none";
}
for (let i = 0; i < cells.length; i++) {
targetNode.appendChild(cells[i]);
}
return targetNode;
},
/**
* Populates this node in the call tree with the corresponding "callees".
* These are defined in the `frame` data source for this call view.
* @param array:AbstractTreeItem children
*/
_populateSelf: function (children) {
let newLevel = this.level + 1;
let data = this.censusTreeNode;
if (data.children) {
for (let node of data.children) {
children.push(new CensusView({
caller: this,
level: newLevel,
censusTreeNode: node,
}));
}
}
},
/**
* Functions creating each cell in this call view.
* Invoked by `_displaySelf`.
*/
_createCell: function (doc, value, type) {
let cell = doc.createElement("span");
cell.className = "plain heap-tree-cell";
cell.setAttribute("type", type);
cell.innerHTML = value;
return cell;
},
});
exports.CensusView = CensusView;

View File

@ -1,8 +0,0 @@
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DevToolsModules(
'census-view.js',
)

View File

@ -6,7 +6,6 @@
DIRS += [
'actions',
'components',
'modules',
'reducers',
]
@ -22,5 +21,4 @@ DevToolsModules(
)
BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini']
MOCHITEST_CHROME_MANIFESTS += ['test/mochitest/chrome.ini']
XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']

View File

@ -1,7 +0,0 @@
[DEFAULT]
tags = devtools
skip-if = buildapp == 'b2g' || os == 'android'
support-files =
head.js
[test_census-view-01.html]

View File

@ -1,12 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
var Cc = Components.classes;
var Ci = Components.interfaces;
var Cu = Components.utils;
var Cr = Components.results;
var CC = Components.Constructor;
const { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});

View File

@ -1,103 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
Bug 1067491 - Test taking a census over the RDP.
-->
<head>
<meta charset="utf-8">
<title>Census Tree 01</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link href="chrome://devtools/content/shared/widgets/widgets.css" type="text/css" />
<link href="chrome://devtools/skin/themes/light-theme.css" type="text/css" />
<link href="chrome://devtools/skin/themes/common.css" type="text/css" />
<link href="chrome://devtools/skin/themes/widgets.css" type="text/css" />
<link href="chrome://devtools/skin/themes/memory.css" type="text/css" />
</head>
<body>
<ul id="container" style="width:100%;height:300px;"></ul>
<pre id="test">
<script src="head.js" type="application/javascript;version=1.8"></script>
<script>
window.onload = function() {
var { censusReportToCensusTreeNode } = require("devtools/shared/heapsnapshot/census-tree-node");
var { INDENTATION, CensusView } = require("devtools/client/memory/modules/census-view");
SimpleTest.waitForExplicitFinish();
const countBreakdown = { by: "count", count: true, bytes: true };
const BREAKDOWN = {
by: "coarseType",
objects: { by: "objectClass", then: countBreakdown },
strings: countBreakdown,
scripts: countBreakdown,
other: { by: "internalType", then: countBreakdown },
};
const REPORT = {
"objects": {
"Function": { bytes: 10, count: 1 },
"Array": { bytes: 20, count: 2 },
},
"strings": { bytes: 10, count: 1 },
"scripts": { bytes: 20, count: 2 },
"other": {
"js::Shape": { bytes: 30, count: 3 },
"js::Shape2": { bytes: 40, count: 4 }
},
};
const EXPECTED_ROWS = [
{ level: 0, name: "other", bytes: 0, count: 0 },
{ level: 1, name: "js::Shape2", bytes: 40, count: 4, },
{ level: 1, name: "js::Shape", bytes: 30, count: 3, },
{ level: 0, name: "objects", bytes: 0, count: 0 },
{ level: 1, name: "Array", bytes: 20, count: 2, },
{ level: 1, name: "Function", bytes: 10, count: 1, },
{ level: 0, name: "scripts", bytes: 20, count: 2, },
{ level: 0, name: "strings", bytes: 10, count: 1, },
];
var censusTreeNode = censusReportToCensusTreeNode(BREAKDOWN, REPORT);
var view = new CensusView({
censusTreeNode: censusTreeNode,
hidden: true
});
view.attachTo(document.querySelector("#container"));
var ul = document.querySelector("#container");
var children = Array.from(ul.children).filter(n => n.style.display !== "none");
for (var i = 0; i < children.length; i++) {
var el = children[i];
var expected = EXPECTED_ROWS[i];
var nameEl = el.querySelector(".heap-tree-cell[type='name']");
var bytesEl = el.querySelector(".heap-tree-cell[type='bytes']");
var countEl = el.querySelector(".heap-tree-cell[type='count']");
is(nameEl.innerHTML, expected.name,
`correct name "${expected.name}" in heap tree`);
is(el.style.MozMarginStart, (INDENTATION * expected.level) + "px",
`correct indentation for ${expected.name}`);
if ("bytes" in expected) {
is(bytesEl.innerHTML, String(expected.bytes),
`correct bytes "${expected.bytes}" in heap tree`);
} else {
ok(!bytesEl, `no bytes correctly displayed for ${expected.name}`);
}
if ("count" in expected) {
is(countEl.innerHTML, String(expected.count),
`correct count "${expected.count}" in heap tree`);
} else {
ok(!countEl, `no count correctly displayed for ${expected.name}`);
}
}
SimpleTest.finish();
};
</script>
</pre>
</body>
</html>