Bug 1325191 - Fix test_memory_allocations_* failures. r=bustage
authorTim Nguyen <ntim.bugs@gmail.com>
Fri, 23 Dec 2016 18:43:29 +0100
changeset 453569 88b62488ca303fea0b7ceebc04e5a59c138ebafe
parent 453568 f520551796df689734fa8c0c02eeab4e0eb2e3da
child 453570 8e6a515461cb2f8f8e8f567739ea9794533f0ba9
push id39711
push userdmitchell@mozilla.com
push dateFri, 23 Dec 2016 21:59:47 +0000
reviewersbustage
bugs1325191
milestone53.0a1
Bug 1325191 - Fix test_memory_allocations_* failures. r=bustage MozReview-Commit-ID: ISRQwIxnsHz
devtools/server/performance/memory.js
--- 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.