Backed out changeset 92889fed3b3b (bug 1246017) for xpcshell bustage

This commit is contained in:
Carsten "Tomcat" Book 2016-02-05 14:06:27 +01:00
Родитель 8d08bd7177
Коммит 045e9f2c83
20 изменённых файлов: 66 добавлений и 90 удалений

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

@ -50,7 +50,7 @@ const takeCensusDiff = exports.takeCensusDiff = function (heapWorker, first, sec
assert(snapshotIsDiffable(second),
`Second snapshot must be in a diffable state, found ${second.state}`);
let report, parentMap;
let report;
let inverted = getState().inverted;
let breakdown = getState().breakdown;
let filter = getState().filter;

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

@ -136,7 +136,7 @@ const takeCensus = exports.takeCensus = function (heapWorker, id) {
assert([states.READ, states.SAVED_CENSUS].includes(snapshot.state),
`Can only take census of snapshots in READ or SAVED_CENSUS state, found ${snapshot.state}`);
let report, parentMap;
let report;
let inverted = getState().inverted;
let breakdown = getState().breakdown;
let filter = getState().filter;

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

@ -32,7 +32,7 @@ const Census = module.exports = createClass({
} = this.props;
const report = census.report;
let parentMap = census.parentMap;
let parentMap = createParentMap(report);
const { totalBytes, totalCount } = report;
const getPercentBytes = totalBytes === 0

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

@ -4,10 +4,9 @@
const { DOM: dom, createClass, PropTypes, createFactory } = require("devtools/client/shared/vendor/react");
const { assert, safeErrorString } = require("devtools/shared/DevToolsUtils");
const { createParentMap } = require("devtools/shared/heapsnapshot/CensusUtils");
const Tree = createFactory(require("devtools/client/shared/components/tree"));
const DominatorTreeItem = createFactory(require("./dominator-tree-item"));
const { L10N } = require("../utils");
const { createParentMap, L10N } = require("../utils");
const { TREE_ROW_HEIGHT, dominatorTreeState } = require("../constants");
const { dominatorTreeModel } = require("../models");
const DominatorTreeLazyChildren = require("../dominator-tree-lazy-children");

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

@ -56,8 +56,6 @@ let breakdownModel = exports.breakdown = PropTypes.shape({
let censusModel = exports.censusModel = PropTypes.shape({
// The current census report data.
report: PropTypes.object,
// The parent map for the report.
parentMap: PropTypes.object,
// The breakdown used to generate the current census
breakdown: breakdownModel,
// Whether the currently cached report tree is inverted or not.

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

@ -81,7 +81,6 @@ handlers[actions.TAKE_CENSUS_DIFF_END] = function (diffing, action) {
state: diffingState.TOOK_DIFF,
census: {
report: action.report,
parentMap: action.parentMap,
expanded: new Set(),
inverted: action.inverted,
filter: action.filter,

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

@ -67,15 +67,9 @@ handlers[actions.TAKE_CENSUS_START] = function (snapshots, { id, breakdown, inve
});
};
handlers[actions.TAKE_CENSUS_END] = function (snapshots, { id,
report,
parentMap,
breakdown,
inverted,
filter }) {
handlers[actions.TAKE_CENSUS_END] = function (snapshots, { id, report, breakdown, inverted, filter }) {
const census = {
report,
parentMap,
expanded: new Set(),
breakdown,
inverted,

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

@ -16,8 +16,7 @@ module.exports = function () {
// we'll later attach to the store
if (DevToolsUtils.testing) {
history = [];
// Uncomment this for TONS of logging in tests.
// shouldLog = true;
shouldLog = true;
}
let store = createStore({

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

@ -561,3 +561,25 @@ exports.formatPercent = function(percent, showSign = false) {
return exports.L10N.getFormatStr("tree-item.percent",
exports.formatNumber(percent, showSign));
};
/**
* Creates a hash map mapping node IDs to its parent node.
*
* @param {CensusTreeNode} node
* @param {Object<number, TreeNode>} aggregator
*
* @return {Object<number, TreeNode>}
*/
const createParentMap = exports.createParentMap = function (node,
getId = node => node.id,
aggregator = Object.create(null)) {
if (node.children) {
for (let i = 0, length = node.children.length; i < length; i++) {
const child = node.children[i];
aggregator[getId(child)] = node;
createParentMap(child, getId, aggregator);
}
}
return aggregator;
};

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

@ -360,25 +360,3 @@ function diff(breakdown, startCensus, endCensus) {
return visitor.results();
};
exports.diff = diff
/**
* Creates a hash map mapping node IDs to its parent node.
*
* @param {CensusTreeNode} node
* @param {Object<number, TreeNode>} aggregator
*
* @return {Object<number, TreeNode>}
*/
const createParentMap = exports.createParentMap = function (node,
getId = node => node.id,
aggregator = Object.create(null)) {
if (node.children) {
for (let i = 0, length = node.children.length; i < length; i++) {
const child = node.children[i];
aggregator[getId(child)] = getId(node);
createParentMap(child, getId, aggregator);
}
}
return aggregator;
};

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

@ -21,7 +21,7 @@ var workerCounter = 0;
const HeapAnalysesClient = module.exports = function () {
this._worker = new DevToolsWorker(WORKER_URL, {
name: `HeapAnalyses-${workerCounter++}`,
verbose: DevToolsUtils.dumpv.wantLogging
verbose: DevToolsUtils.dumpn.wantLogging
});
};
@ -104,15 +104,10 @@ HeapAnalysesClient.prototype.getCreationTime = function (snapshotFilePath) {
* A filter string to prune the resulting tree with. Only applies if
* either asTreeNode or asInvertedTreeNode is true.
*
* @returns Promise<Object>
* An object with the following properties:
* - report:
* The report generated by the given census breakdown, or a
* CensusTreeNode generated by the given census breakdown if
* `asTreeNode` is true.
* - parentMap:
* The result of calling CensusUtils.createParentMap on the generated
* report. Only exists if asTreeNode or asInvertedTreeNode are set.
* @returns Promise<census report|CensusTreeNode>
* The report generated by the given census breakdown, or
* a CensusTreeNode generated by the given census breakdown
* if `asTreeNode` is true.
*/
HeapAnalysesClient.prototype.takeCensus = function (snapshotFilePath,
censusOptions,
@ -152,14 +147,10 @@ HeapAnalysesClient.prototype.takeCensus = function (snapshotFilePath,
* A filter string to prune the resulting tree with. Only applies if
* either asTreeNode or asInvertedTreeNode is true.
*
* @returns Promise<Object>
* - delta:
* The delta report generated by diffing the two census reports, or a
* CensusTreeNode generated from the delta report if
* `requestOptions.asTreeNode` was true.
* - parentMap:
* The result of calling CensusUtils.createParentMap on the generated
* delta. Only exists if asTreeNode or asInvertedTreeNode are set.
* @returns Promise<delta report|CensusTreeNode>
* The delta report generated by diffing the two census reports, or a
* CensusTreeNode generated from the delta report if
* `requestOptions.asTreeNode` was true.
*/
HeapAnalysesClient.prototype.takeCensusDiff = function (firstSnapshotFilePath,
secondSnapshotFilePath,

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

@ -58,19 +58,17 @@ workerHelper.createTask(self, "takeCensus", ({ snapshotFilePath, censusOptions,
throw new Error(`No known heap snapshot for '${snapshotFilePath}'`);
}
let report = snapshots[snapshotFilePath].takeCensus(censusOptions);
let parentMap;
const report = snapshots[snapshotFilePath].takeCensus(censusOptions);
if (requestOptions.asTreeNode || requestOptions.asInvertedTreeNode) {
const opts = { filter: requestOptions.filter || null };
if (requestOptions.asInvertedTreeNode) {
opts.invert = true;
}
report = censusReportToCensusTreeNode(censusOptions.breakdown, report, opts);
parentMap = CensusUtils.createParentMap(report);
return censusReportToCensusTreeNode(censusOptions.breakdown, report, opts);
}
return { report, parentMap };
return report;
});
/**
@ -94,19 +92,17 @@ workerHelper.createTask(self, "takeCensusDiff", request => {
const first = snapshots[firstSnapshotFilePath].takeCensus(censusOptions);
const second = snapshots[secondSnapshotFilePath].takeCensus(censusOptions);
let delta = CensusUtils.diff(censusOptions.breakdown, first, second);
let parentMap;
const delta = CensusUtils.diff(censusOptions.breakdown, first, second);
if (requestOptions.asTreeNode || requestOptions.asInvertedTreeNode) {
const opts = { filter: requestOptions.filter || null };
if (requestOptions.asInvertedTreeNode) {
opts.invert = true;
}
delta = censusReportToCensusTreeNode(censusOptions.breakdown, delta, opts);
parentMap = CensusUtils.createParentMap(delta);
return censusReportToCensusTreeNode(censusOptions.breakdown, delta, opts);
}
return { delta, parentMap };
return delta;
});
/**

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

@ -30,17 +30,17 @@ add_task(function* () {
yield client.readHeapSnapshot(secondSnapshotFilePath);
ok(true, "Should have read both heap snapshot files");
const { delta } = yield client.takeCensusDiff(firstSnapshotFilePath,
secondSnapshotFilePath,
{ breakdown: BREAKDOWN });
const delta = yield client.takeCensusDiff(firstSnapshotFilePath,
secondSnapshotFilePath,
{ breakdown: BREAKDOWN });
equal(delta.AllocationMarker.count, 1,
"There exists one new AllocationMarker in the second heap snapshot");
const { delta: deltaTreeNode } = yield client.takeCensusDiff(firstSnapshotFilePath,
secondSnapshotFilePath,
{ breakdown: BREAKDOWN },
{ asTreeNode: true });
const deltaTreeNode = yield client.takeCensusDiff(firstSnapshotFilePath,
secondSnapshotFilePath,
{ breakdown: BREAKDOWN },
{ asTreeNode: true });
// Have to manually set these because symbol properties aren't structured
// cloned.

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

@ -39,14 +39,14 @@ add_task(function* () {
ok(true, "Should have read both heap snapshot files");
const { delta } = yield client.takeCensusDiff(firstSnapshotFilePath,
secondSnapshotFilePath,
{ breakdown: BREAKDOWN });
const delta = yield client.takeCensusDiff(firstSnapshotFilePath,
secondSnapshotFilePath,
{ breakdown: BREAKDOWN });
const { delta: deltaTreeNode } = yield client.takeCensusDiff(firstSnapshotFilePath,
secondSnapshotFilePath,
{ breakdown: BREAKDOWN },
{ asInvertedTreeNode: true });
const deltaTreeNode = yield client.takeCensusDiff(firstSnapshotFilePath,
secondSnapshotFilePath,
{ breakdown: BREAKDOWN },
{ asInvertedTreeNode: true });
// Have to manually set these because symbol properties aren't structured
// cloned.

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

@ -14,7 +14,7 @@ add_task(function* () {
yield client.readHeapSnapshot(snapshotFilePath);
ok(true, "Should have read the heap snapshot");
const { report } = yield client.takeCensus(snapshotFilePath);
const report = yield client.takeCensus(snapshotFilePath);
ok(report, "Should get a report");
equal(typeof report, "object", "report should be an object");

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

@ -15,7 +15,7 @@ add_task(function* () {
yield client.readHeapSnapshot(snapshotFilePath);
ok(true, "Should have read the heap snapshot");
const { report } = yield client.takeCensus(snapshotFilePath, {
const report = yield client.takeCensus(snapshotFilePath, {
breakdown: { by: "count", count: true, bytes: true }
});

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

@ -49,7 +49,7 @@ add_task(function* test() {
// Run a census broken down by class name -> allocation stack so we can grab
// only the AllocationMarker objects we have complete control over.
const { report } = yield client.takeCensus(snapshotFilePath, {
const report = yield client.takeCensus(snapshotFilePath, {
breakdown: { by: 'objectClass',
then: { by: 'allocationStack',
then: { by: 'count',

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

@ -20,11 +20,11 @@ add_task(function* () {
yield client.readHeapSnapshot(snapshotFilePath);
ok(true, "Should have read the heap snapshot");
const { report } = yield client.takeCensus(snapshotFilePath, {
const report = yield client.takeCensus(snapshotFilePath, {
breakdown: BREAKDOWN
});
const { report: treeNode } = yield client.takeCensus(snapshotFilePath, {
const treeNode = yield client.takeCensus(snapshotFilePath, {
breakdown: BREAKDOWN
}, {
asTreeNode: true

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

@ -59,11 +59,11 @@ add_task(function* () {
yield client.readHeapSnapshot(snapshotFilePath);
ok(true, "Should have read the heap snapshot");
const { report } = yield client.takeCensus(snapshotFilePath, {
const report = yield client.takeCensus(snapshotFilePath, {
breakdown: BREAKDOWN
});
const { report: treeNode } = yield client.takeCensus(snapshotFilePath, {
const treeNode = yield client.takeCensus(snapshotFilePath, {
breakdown: BREAKDOWN
}, {
asTreeNode: true

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

@ -36,11 +36,11 @@ add_task(function* () {
yield client.readHeapSnapshot(snapshotFilePath);
ok(true, "Should have read the heap snapshot");
const { report } = yield client.takeCensus(snapshotFilePath, {
const report = yield client.takeCensus(snapshotFilePath, {
breakdown: BREAKDOWN
});
const { report: treeNode } = yield client.takeCensus(snapshotFilePath, {
const treeNode = yield client.takeCensus(snapshotFilePath, {
breakdown: BREAKDOWN
}, {
asInvertedTreeNode: true