Bug 1325191 - Fix test_memory_allocations_* failures. r=bustage
MozReview-Commit-ID: ISRQwIxnsHz
--- a/devtools/server/performance/memory.js
+++ b/devtools/server/performance/memory.js
@@ -177,41 +177,40 @@ exports.Memory = Class({
* The maximum number of allocation events to keep in the
* log. If new allocs occur while at capacity, oldest
* allocations are lost. Must fit in a 32 bit signed integer.
* @param {number} options.drainAllocationsTimeout
* A number in milliseconds of how often, at least, an `allocation`
* event gets emitted (and drained), and also emits and drains on every
* GC event, resetting the timer.
*/
- startRecordingAllocations: expectState("attached", function ({
- probability = 1,
- drainAllocationsTimeout = null,
- maxLogLength = null
- }) {
+ startRecordingAllocations: expectState("attached", function (options = {}) {
if (this.isRecordingAllocations()) {
return this._getCurrentTime();
}
this._frameCache.initFrames();
- this.dbg.memory.allocationSamplingProbability = probability;
- this.drainAllocationsTimeoutTimer = drainAllocationsTimeout;
+ this.dbg.memory.allocationSamplingProbability = options.probability != null
+ ? options.probability
+ : 1.0;
+
+ this.drainAllocationsTimeoutTimer = options.drainAllocationsTimeout;
if (this.drainAllocationsTimeoutTimer != null) {
if (this._poller) {
this._poller.disarm();
}
this._poller = new DeferredTask(this._emitAllocations,
this.drainAllocationsTimeoutTimer);
this._poller.arm();
}
- if (maxLogLength != null) {
- this.dbg.memory.maxAllocationsLogLength = maxLogLength;
+ if (options.maxLogLength != null) {
+ this.dbg.memory.maxAllocationsLogLength = options.maxLogLength;
}
this.dbg.memory.trackingAllocationSites = true;
return this._getCurrentTime();
}, "starting recording allocations"),
/**
* Stop recording allocation sites.