Bug 1141817 - Fix yield statement to correctly return memory actor state so that the performance tool can poll for allocations during recording. r=vp

This commit is contained in:
Jordan Santell 2015-03-12 11:41:41 -07:00
parent b64b2d9a28
commit 52f6873793
2 changed files with 17 additions and 2 deletions

View File

@ -353,7 +353,7 @@ PerformanceFront.prototype = {
*/
_pullAllocationSites: Task.async(function *() {
let memoryData = yield this._request("memory", "getAllocations");
let isStillAttached = yield this._request("memory", "getState") == "attached";
let isStillAttached = (yield this._request("memory", "getState")) === "attached";
this.emit("allocations", {
sites: memoryData.allocations,

View File

@ -10,6 +10,9 @@ let WAIT_TIME = 1000;
function spawnTest () {
let { target, front } = yield initBackend(SIMPLE_URL);
let count = 0;
let counter = () => count++;
let {
profilerStartTime,
timelineStartTime,
@ -25,7 +28,14 @@ function spawnTest () {
ok(typeof memoryStartTime === "number",
"The front.startRecording() emits a memory start time.");
yield busyWait(WAIT_TIME);
// Record allocation events to ensure it's called more than once
// so we know it's polling
front.on("allocations", counter);
yield Promise.all([
busyWait(WAIT_TIME),
waitUntil(() => count > 1)
]);
let {
profilerEndTime,
@ -35,6 +45,8 @@ function spawnTest () {
withAllocations: true
});
front.off("allocations", counter);
ok(typeof profilerEndTime === "number",
"The front.stopRecording() emits a profiler end time.");
ok(typeof timelineEndTime === "number",
@ -49,6 +61,9 @@ function spawnTest () {
ok(memoryEndTime > memoryStartTime,
"The memoryEndTime is after memoryStartTime.");
is((yield front._request("memory", "getState")), "detached",
"memory actor is detached when stopping recording with allocations");
yield removeTab(target.tab);
finish();
}