Bug 1010568: Remove usage of 2nd WeakMap#get parameter from TelemetryStopwatch; r=felipe
authorArpad Borsos <arpad.borsos@googlemail.com>
Thu, 15 May 2014 15:58:05 +0200
changeset 183669 6e53692a840f75df9f82b3c099015d125a75e0a1
parent 183668 89964e80a62766f63eb7573a168175831b8a02c4
child 183670 61d0065e67a634c96b75d0c9001f5557dbc8c031
push id6844
push userphilringnalda@gmail.com
push dateSun, 18 May 2014 01:12:08 +0000
treeherderfx-team@41a54c8add09 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfelipe
bugs1010568
milestone32.0a1
Bug 1010568: Remove usage of 2nd WeakMap#get parameter from TelemetryStopwatch; r=felipe
toolkit/components/telemetry/TelemetryStopwatch.jsm
--- a/toolkit/components/telemetry/TelemetryStopwatch.jsm
+++ b/toolkit/components/telemetry/TelemetryStopwatch.jsm
@@ -36,17 +36,17 @@ this.TelemetryStopwatch = {
    *         one will be cleared in order to avoid measurements errors.
    */
   start: function(aHistogram, aObj) {
     if (!validTypes(aHistogram, aObj))
       return false;
 
     let timers;
     if (aObj) {
-      timers = objectTimers.get(aObj, {});
+      timers = objectTimers.get(aObj) || {};
       objectTimers.set(aObj, timers);
     } else {
       timers = simpleTimers;
     }
 
     if (timers.hasOwnProperty(aHistogram)) {
       delete timers[aHistogram];
       Cu.reportError("TelemetryStopwatch: key \"" +
@@ -74,17 +74,17 @@ this.TelemetryStopwatch = {
    *
    * @return true if the timer exist and it was cleared, false otherwise.
    */
   cancel: function ts_cancel(aHistogram, aObj) {
     if (!validTypes(aHistogram, aObj))
       return false;
 
     let timers = aObj
-                 ? objectTimers.get(aObj, {})
+                 ? objectTimers.get(aObj) || {}
                  : simpleTimers;
 
     if (timers.hasOwnProperty(aHistogram)) {
       delete timers[aHistogram];
       return true;
     }
 
     return false;
@@ -105,17 +105,17 @@ this.TelemetryStopwatch = {
    * @return true if the timer was succesfully stopped and the data was
    *         added to the histogram, false otherwise.
    */
   finish: function(aHistogram, aObj) {
     if (!validTypes(aHistogram, aObj))
       return false;
 
     let timers = aObj
-                 ? objectTimers.get(aObj, {})
+                 ? objectTimers.get(aObj) || {}
                  : simpleTimers;
 
     let start = timers[aHistogram];
     delete timers[aHistogram];
 
     if (start) {
       let delta = Date.now() - start;
       let histogram = Telemetry.getHistogramById(aHistogram);