Backed out changeset c457397a08bb (bug 1215955) for being a possible cause of frequent devtools failures in browser_profiler_tree-abstract-02.js a=backout

--HG--
extra : commitid : 9hiF1ztDIiJ
extra : histedit_source : 6388bc5df724f62b90c3309794bde9df82fa5631%2C131cc268c81bccca87b5dfc6ce58ae21230768cf
This commit is contained in:
Wes Kocher 2016-01-15 10:43:01 -08:00
Родитель a330ff03a6
Коммит 137b0dc6d1
22 изменённых файлов: 4 добавлений и 502 удалений

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

@ -84,10 +84,6 @@ take-snapshot=Take snapshot
# initiates importing a snapshot.
import-snapshot=Import…
# LOCALIZATION NOTE (clear-snapshots): The label describing the button that clears
# existing snapshot.
clear-snapshots=Clear
# LOCALIZATION NOTE (diff-snapshots): The label for the button that initiates
# selecting two snapshots to diff with each other.
diff-snapshots=+/-

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

@ -406,32 +406,6 @@ const selectSnapshot = exports.selectSnapshot = function (id) {
};
};
/**
* Delete all snapshots that are in the SAVED_CENSUS or ERROR state
*
* @param {HeapAnalysesClient} heapWorker
*/
const clearSnapshots = exports.clearSnapshots = function (heapWorker) {
return function*(dispatch, getState) {
let snapshots = getState().snapshots.filter(
s => s.state === states.SAVED_CENSUS || s.state === states.ERROR);
let ids = snapshots.map(s => s.id);
dispatch({ type: actions.DELETE_SNAPSHOTS_START, ids });
Promise.all(snapshots.map(s => {
heapWorker.deleteHeapSnapshot(s.path)
.catch(error => {
reportException("clearSnapshots", error);
dispatch({ type: actions.SNAPSHOT_ERROR, id: s.id, error });
});
}));
dispatch({ type: actions.DELETE_SNAPSHOTS_END, ids });
};
};
/**
* Expand the given node in the snapshot's census report.
*

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

@ -22,7 +22,6 @@ const { pickFileAndExportSnapshot, pickFileAndImportSnapshotAndCensus } = requir
const {
selectSnapshotAndRefresh,
takeSnapshotAndCensus,
clearSnapshots,
fetchImmediatelyDominated,
expandCensusNode,
collapseCensusNode,
@ -99,7 +98,6 @@ const MemoryApp = createClass({
snapshots,
breakdowns: getBreakdownDisplayData(),
onImportClick: () => dispatch(pickFileAndImportSnapshotAndCensus(heapWorker)),
onClearSnapshotsClick: () => dispatch(clearSnapshots(heapWorker)),
onTakeSnapshotClick: () => dispatch(takeSnapshotAndCensus(front, heapWorker)),
onBreakdownChange: breakdown =>
dispatch(setBreakdownAndRefresh(heapWorker, breakdownNameToSpec(breakdown))),

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

@ -17,7 +17,6 @@ const Toolbar = module.exports = createClass({
})).isRequired,
onTakeSnapshotClick: PropTypes.func.isRequired,
onImportClick: PropTypes.func.isRequired,
onClearSnapshotsClick: PropTypes.func.isRequired,
onBreakdownChange: PropTypes.func.isRequired,
onToggleRecordAllocationStacks: PropTypes.func.isRequired,
allocations: models.allocations,
@ -41,7 +40,6 @@ const Toolbar = module.exports = createClass({
let {
onTakeSnapshotClick,
onImportClick,
onClearSnapshotsClick,
onBreakdownChange,
breakdowns,
dominatorTreeBreakdowns,
@ -192,15 +190,7 @@ const Toolbar = module.exports = createClass({
"data-text-only": true,
},
L10N.getStr("import-snapshot")
),
dom.button({
id: "clear-snapshots",
className: "devtools-toolbarbutton clear-snapshots devtools-button",
onClick: onClearSnapshotsClick,
title: L10N.getStr("clear-snapshots"),
"data-text-only": true,
}, L10N.getStr("clear-snapshots"))
)
),
dom.label(

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

@ -50,10 +50,6 @@ actions.IMPORT_SNAPSHOT_ERROR = "import-snapshot-error";
// Fired by UI to select a snapshot to view.
actions.SELECT_SNAPSHOT = "select-snapshot";
// Fired to delete a provided list of snapshots
actions.DELETE_SNAPSHOTS_START = "delete-snapshots-start";
actions.DELETE_SNAPSHOTS_END = "delete-snapshots-end";
// Fired to toggle tree inversion on or off.
actions.TOGGLE_INVERTED = "toggle-inverted";

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

@ -138,14 +138,6 @@ handlers[actions.SELECT_SNAPSHOT] = function (snapshots, { id }) {
return snapshots.map(s => immutableUpdate(s, { selected: s.id === id }));
};
handlers[actions.DELETE_SNAPSHOTS_START] = function (snapshots, { ids }) {
return snapshots.filter(s => ids.indexOf(s.id) === -1);
};
handlers[actions.DELETE_SNAPSHOTS_END] = function (snapshots) {
return snapshots;
};
handlers[actions.CHANGE_VIEW] = function (snapshots, { view }) {
return view === viewState.DIFFING
? snapshots.map(s => immutableUpdate(s, { selected: false }))

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

@ -18,8 +18,6 @@ support-files =
[browser_memory_no_auto_expand.js]
skip-if = debug # bug 1219554
[browser_memory_percents_01.js]
[browser_memory-clear-snapshots.js]
skip-if = debug # bug 1219554
[browser_memory-simple-01.js]
skip-if = debug # bug 1219554
[browser_memory_transferHeapSnapshot_e10s_01.js]

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

@ -1,31 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests taking and then clearing snapshots.
*/
const TEST_URL = "http://example.com/browser/devtools/client/memory/test/browser/doc_steady_allocation.html";
this.test = makeMemoryTest(TEST_URL, function* ({ tab, panel }) {
const { gStore, document } = panel.panelWin;
const { getState, dispatch } = gStore;
let snapshotEls = document.querySelectorAll("#memory-tool-container .list li");
is(getState().snapshots.length, 0, "Starts with no snapshots in store");
is(snapshotEls.length, 0, "No snapshots visible");
info("Take two snapshots");
yield takeSnapshot(panel.panelWin);
yield takeSnapshot(panel.panelWin);
yield waitUntilSnapshotState(gStore, [states.SAVED_CENSUS, states.SAVED_CENSUS]);
snapshotEls = document.querySelectorAll("#memory-tool-container .list li");
is(snapshotEls.length, 2, "Two snapshots visible");
info("Click on Clear Snapshots");
yield clearSnapshots(panel.panelWin);
is(getState().snapshots.length, 0, "No snapshots in store");
snapshotEls = document.querySelectorAll("#memory-tool-container .list li");
is(snapshotEls.length, 0, "No snapshot visible");
});

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

@ -104,14 +104,6 @@ function takeSnapshot (window) {
return waitUntilState(gStore, () => gStore.getState().snapshots.length === snapshotCount + 1);
}
function clearSnapshots (window) {
let { gStore, document } = window;
document.querySelector(".devtools-toolbar .clear-snapshots").click();
return waitUntilState(gStore, () => gStore.getState().snapshots.every(
(snapshot) => snapshot.state !== states.SAVED_CENSUS)
);
}
/**
* Sets breakdown and waits for currently selected breakdown to use it
* and be completed the census.

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

@ -1,37 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Test clearSnapshots deletes snapshots with state SAVED_CENSUS
let { takeSnapshotAndCensus, clearSnapshots } = require("devtools/client/memory/actions/snapshot");
let { snapshotState: states, actions } = require("devtools/client/memory/constants");
function run_test() {
run_next_test();
}
add_task(function *() {
let front = new StubbedMemoryFront();
let heapWorker = new HeapAnalysesClient();
yield front.attach();
let store = Store();
const { getState, dispatch } = store;
dispatch(takeSnapshotAndCensus(front, heapWorker));
yield waitUntilSnapshotState(store, [states.SAVED_CENSUS]);
ok(true, "snapshot created");
ok(true, "dispatch clearSnapshots action");
let deleteEvents = Promise.all([
waitUntilAction(store, actions.DELETE_SNAPSHOTS_START),
waitUntilAction(store, actions.DELETE_SNAPSHOTS_END)
]);
dispatch(clearSnapshots(heapWorker));
yield deleteEvents;
ok(true, "received delete snapshots events");
equal(getState().snapshots.length, 0, "no snapshot remaining");
heapWorker.destroy();
yield front.detach();
});

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

@ -1,43 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Test clearSnapshots preserves snapshots with state != SAVED_CENSUS or ERROR
let { takeSnapshotAndCensus, clearSnapshots, takeSnapshot } = require("devtools/client/memory/actions/snapshot");
let { snapshotState: states, actions } = require("devtools/client/memory/constants");
function run_test() {
run_next_test();
}
add_task(function *() {
let front = new StubbedMemoryFront();
let heapWorker = new HeapAnalysesClient();
yield front.attach();
let store = Store();
const { getState, dispatch } = store;
ok(true, "create a snapshot in SAVED_CENSUS state");
dispatch(takeSnapshotAndCensus(front, heapWorker));
ok(true, "create a snapshot in SAVED state");
dispatch(takeSnapshot(front));
yield waitUntilSnapshotState(store, [states.SAVED_CENSUS, states.SAVED]);
ok(true, "snapshots created with expected states");
ok(true, "dispatch clearSnapshots action");
let deleteEvents = Promise.all([
waitUntilAction(store, actions.DELETE_SNAPSHOTS_START),
waitUntilAction(store, actions.DELETE_SNAPSHOTS_END)
]);
dispatch(clearSnapshots(heapWorker));
yield deleteEvents;
ok(true, "received delete snapshots events");
equal(getState().snapshots.length, 1, "one snapshot remaining");
let remainingSnapshot = getState().snapshots[0];
notEqual(remainingSnapshot.state, states.SAVED_CENSUS,
"remaining snapshot doesn't have the SAVED_CENSUS state");
heapWorker.destroy();
yield front.detach();
});

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

@ -1,43 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Test clearSnapshots deletes snapshots with state ERROR
let { takeSnapshotAndCensus, clearSnapshots } = require("devtools/client/memory/actions/snapshot");
let { snapshotState: states, actions } = require("devtools/client/memory/constants");
function run_test() {
run_next_test();
}
add_task(function *() {
let front = new StubbedMemoryFront();
let heapWorker = new HeapAnalysesClient();
yield front.attach();
let store = Store();
const { getState, dispatch } = store;
ok(true, "create a snapshot with SAVED_CENSUS state");
dispatch(takeSnapshotAndCensus(front, heapWorker));
yield waitUntilSnapshotState(store, [states.SAVED_CENSUS]);
ok(true, "snapshot created with SAVED_CENSUS state");
ok(true, "set snapshot state to error");
let id = getState().snapshots[0].id;
dispatch({ type: actions.SNAPSHOT_ERROR, id, error: new Error("_") });
yield waitUntilSnapshotState(store, [states.ERROR]);
ok(true, "snapshot set to error state");
ok(true, "dispatch clearSnapshots action");
let deleteEvents = Promise.all([
waitUntilAction(store, actions.DELETE_SNAPSHOTS_START),
waitUntilAction(store, actions.DELETE_SNAPSHOTS_END)
]);
dispatch(clearSnapshots(heapWorker));
yield deleteEvents;
ok(true, "received delete snapshots events");
equal(getState().snapshots.length, 0, "error snapshot deleted");
heapWorker.destroy();
yield front.detach();
});

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

@ -1,48 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Test clearSnapshots deletes several snapshots
let { takeSnapshotAndCensus, clearSnapshots } = require("devtools/client/memory/actions/snapshot");
let { snapshotState: states, actions } = require("devtools/client/memory/constants");
function run_test() {
run_next_test();
}
add_task(function *() {
let front = new StubbedMemoryFront();
let heapWorker = new HeapAnalysesClient();
yield front.attach();
let store = Store();
const { getState, dispatch } = store;
ok(true, "create 3 snapshots in SAVED_CENSUS state");
dispatch(takeSnapshotAndCensus(front, heapWorker));
dispatch(takeSnapshotAndCensus(front, heapWorker));
dispatch(takeSnapshotAndCensus(front, heapWorker));
ok(true, "snapshots created in SAVED_CENSUS state");
yield waitUntilSnapshotState(store,
[states.SAVED_CENSUS, states.SAVED_CENSUS, states.SAVED_CENSUS]);
ok(true, "set first snapshot state to error");
let id = getState().snapshots[0].id;
dispatch({ type: actions.SNAPSHOT_ERROR, id, error: new Error("_") });
yield waitUntilSnapshotState(store,
[states.ERROR, states.SAVED_CENSUS, states.SAVED_CENSUS]);
ok(true, "first snapshot set to error state");
ok(true, "dispatch clearSnapshots action");
let deleteEvents = Promise.all([
waitUntilAction(store, actions.DELETE_SNAPSHOTS_START),
waitUntilAction(store, actions.DELETE_SNAPSHOTS_END)
]);
dispatch(clearSnapshots(heapWorker));
yield deleteEvents;
ok(true, "received delete snapshots events");
equal(getState().snapshots.length, 0, "no snapshot remaining");
heapWorker.destroy();
yield front.detach();
});

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

@ -1,46 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Test clearSnapshots deletes several snapshots
let { takeSnapshotAndCensus, clearSnapshots } = require("devtools/client/memory/actions/snapshot");
let { snapshotState: states, actions } = require("devtools/client/memory/constants");
function run_test() {
run_next_test();
}
add_task(function *() {
let front = new StubbedMemoryFront();
let heapWorker = new HeapAnalysesClient();
yield front.attach();
let store = Store();
const { getState, dispatch } = store;
ok(true, "create 3 snapshots in SAVED_CENSUS state");
dispatch(takeSnapshotAndCensus(front, heapWorker));
dispatch(takeSnapshotAndCensus(front, heapWorker));
ok(true, "snapshots created in SAVED_CENSUS state");
yield waitUntilSnapshotState(store, [states.SAVED_CENSUS, states.SAVED_CENSUS]);
let errorHeapWorker = {
deleteHeapSnapshot: function() {
return Promise.reject("_");
}
};
ok(true, "dispatch clearSnapshots action");
let deleteEvents = Promise.all([
waitUntilAction(store, actions.DELETE_SNAPSHOTS_START),
waitUntilAction(store, actions.DELETE_SNAPSHOTS_END),
waitUntilAction(store, actions.SNAPSHOT_ERROR),
waitUntilAction(store, actions.SNAPSHOT_ERROR),
]);
dispatch(clearSnapshots(errorHeapWorker));
yield deleteEvents;
ok(true, "received delete snapshots and snapshot error events");
equal(getState().snapshots.length, 0, "no snapshot remaining");
heapWorker.destroy();
yield front.detach();
});

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

@ -10,11 +10,6 @@ skip-if = toolkit == 'android' || toolkit == 'gonk'
[test_action_diffing_03.js]
[test_action_diffing_04.js]
[test_action_diffing_05.js]
[test_action-clear-snapshots_01.js]
[test_action-clear-snapshots_02.js]
[test_action-clear-snapshots_03.js]
[test_action-clear-snapshots_04.js]
[test_action-clear-snapshots_05.js]
[test_action-export-snapshot.js]
[test_action-filter-01.js]
[test_action-filter-02.js]

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

@ -58,10 +58,9 @@ html, body, #app, #memory-tool {
* We want this to be exactly at a `--sidebar-width` distance from the
* toolbar's start boundary. A `.devtools-toolbar` has a 3px start padding.
*/
flex: 0 0 calc(var(--sidebar-width) - 4px);
flex: 0 0 calc(var(--sidebar-width) - 3px);
border-inline-end: 1px solid var(--theme-splitter-color);
margin-inline-end: 5px;
padding-right: 1px;
}
.devtools-toolbar > .toolbar-group {
@ -112,13 +111,8 @@ html, body, #app, #memory-tool {
* Due to toolbar styles of `.devtools-toolbarbutton:not([label])` which overrides
* .devtools-toolbarbutton's min-width of 78px, reset the min-width.
*/
#import-snapshot,
#clear-snapshots {
-moz-box-align: center;
flex-grow: 1;
padding: 1px;
margin: 2px 1px;
min-width: unset;
#import-snapshot {
min-width: 78px;
}
.spacer {

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

@ -51,17 +51,6 @@ HeapAnalysesClient.prototype.readHeapSnapshot = function (snapshotFilePath) {
return this._worker.performTask("readHeapSnapshot", { snapshotFilePath });
};
/**
* Tell the worker to delete all references to the snapshot and dominator trees
* linked to the provided snapshot file path.
*
* @param {String} snapshotFilePath
* @return Promise<undefined>
*/
HeapAnalysesClient.prototype.deleteHeapSnapshot = function (snapshotFilePath) {
return this._worker.performTask("deleteHeapSnapshot", { snapshotFilePath });
};
/**
* Request the creation time given a snapshot file path. Returns `null`
* if snapshot does not exist.

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

@ -32,24 +32,6 @@ workerHelper.createTask(self, "readHeapSnapshot", ({ snapshotFilePath }) => {
return true;
});
/**
* @see HeapAnalysesClient.prototype.deleteHeapSnapshot
*/
workerHelper.createTask(self, "deleteHeapSnapshot", ({ snapshotFilePath }) => {
let snapshot = snapshots[snapshotFilePath];
if (!snapshot) {
throw new Error(`No known heap snapshot for '${snapshotFilePath}'`);
}
snapshots[snapshotFilePath] = undefined;
let dominatorTreeId = dominatorTreeSnapshots.indexOf(snapshot);
if (dominatorTreeId != -1) {
dominatorTreeSnapshots[dominatorTreeId] = undefined;
dominatorTrees[dominatorTreeId] = undefined;
}
});
/**
* @see HeapAnalysesClient.prototype.takeCensus
*/

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

@ -1,59 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Test that the HeapAnalyses{Client,Worker} can delete heap snapshots.
function run_test() {
run_next_test();
}
const breakdown = {
by: "coarseType",
objects: { by: "count", count: true, bytes: true },
scripts: { by: "count", count: true, bytes: true },
strings: { by: "count", count: true, bytes: true },
other: { by: "count", count: true, bytes: true },
};
add_task(function* () {
const client = new HeapAnalysesClient();
const snapshotFilePath = saveNewHeapSnapshot();
yield client.readHeapSnapshot(snapshotFilePath);
ok(true, "Should have read the heap snapshot");
let dominatorTreeId = yield client.computeDominatorTree(snapshotFilePath);
ok(true, "Should have computed the dominator tree");
yield client.deleteHeapSnapshot(snapshotFilePath);
ok(true, "Should have deleted the snapshot");
let threw = false;
try {
yield client.getDominatorTree({
dominatorTreeId: dominatorTreeId,
breakdown
});
} catch (_) {
threw = true;
}
ok(threw, "getDominatorTree on deleted tree should throw an error");
threw = false;
try {
yield client.computeDominatorTree(snapshotFilePath);
} catch (_) {
threw = true;
}
ok(threw, "computeDominatorTree on deleted snapshot should throw an error");
threw = false;
try {
yield client.takeCensus(snapshotFilePath);
} catch (_) {
threw = true;
}
ok(threw, "takeCensus on deleted tree should throw an error");
client.destroy();
});

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

@ -1,22 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Test deleteHeapSnapshot is a noop if the provided path matches no snapshot
function run_test() {
run_next_test();
}
add_task(function* () {
const client = new HeapAnalysesClient();
let threw = false;
try {
yield client.deleteHeapSnapshot("path-does-not-exist");
} catch (_) {
threw = true;
}
ok(threw, "deleteHeapSnapshot on non-existant path should throw an error");
client.destroy();
});

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

@ -1,62 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Test other dominatorTrees can still be retrieved after deleting a snapshot
function run_test() {
run_next_test();
}
const breakdown = {
by: "coarseType",
objects: { by: "count", count: true, bytes: true },
scripts: { by: "count", count: true, bytes: true },
strings: { by: "count", count: true, bytes: true },
other: { by: "count", count: true, bytes: true },
};
function* createSnapshotAndDominatorTree(client) {
let snapshotFilePath = saveNewHeapSnapshot();
yield client.readHeapSnapshot(snapshotFilePath);
let dominatorTreeId = yield client.computeDominatorTree(snapshotFilePath);
return { dominatorTreeId, snapshotFilePath };
}
add_task(function* () {
const client = new HeapAnalysesClient();
let savedSnapshots = [
yield createSnapshotAndDominatorTree(client),
yield createSnapshotAndDominatorTree(client),
yield createSnapshotAndDominatorTree(client)
];
ok(true, "Create 3 snapshots and dominator trees");
yield client.deleteHeapSnapshot(savedSnapshots[1].snapshotFilePath);
ok(true, "Snapshot deleted");
let tree = yield client.getDominatorTree({
dominatorTreeId: savedSnapshots[0].dominatorTreeId,
breakdown
});
ok(tree, "Should get a valid tree for first snapshot");
let threw = false;
try {
yield client.getDominatorTree({
dominatorTreeId: savedSnapshots[1].dominatorTreeId,
breakdown
});
} catch (_) {
threw = true;
}
ok(threw, "getDominatorTree on a deleted snapshot should throw an error");
tree = yield client.getDominatorTree({
dominatorTreeId: savedSnapshots[2].dominatorTreeId,
breakdown
});
ok(tree, "Should get a valid tree for third snapshot");
client.destroy();
});

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

@ -43,9 +43,6 @@ support-files =
[test_DominatorTreeNode_LabelAndShallowSize_04.js]
[test_HeapAnalyses_computeDominatorTree_01.js]
[test_HeapAnalyses_computeDominatorTree_02.js]
[test_HeapAnalyses_deleteHeapSnapshot_01.js]
[test_HeapAnalyses_deleteHeapSnapshot_02.js]
[test_HeapAnalyses_deleteHeapSnapshot_03.js]
[test_HeapAnalyses_getCreationTime_01.js]
[test_HeapAnalyses_getDominatorTree_01.js]
[test_HeapAnalyses_getDominatorTree_02.js]