Bug 1317745 - Rename 'round trip time' to 'latency' in network throttling. r=jryans
authoroschei <oliver.scheiwiller@gmail.com>
Tue, 15 Nov 2016 22:51:44 -0700
changeset 323928 8c3caa5cf8a6001113c6007090964a37ab0019bc
parent 323927 4b75d4672954a617791487fd13fc878b1b5461e0
child 323929 2bbc7be933e2cd52fb1e328119075cf9aab50c5f
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersjryans
bugs1317745
milestone53.0a1
Bug 1317745 - Rename 'round trip time' to 'latency' in network throttling. r=jryans
devtools/client/netmonitor/har/test/browser_net_har_throttle_upload.js
devtools/client/netmonitor/test/browser_net_throttle.js
devtools/server/actors/emulation.js
devtools/shared/webconsole/test/unit/test_throttle.js
devtools/shared/webconsole/throttle.js
--- a/devtools/client/netmonitor/har/test/browser_net_har_throttle_upload.js
+++ b/devtools/client/netmonitor/har/test/browser_net_har_throttle_upload.js
@@ -19,18 +19,18 @@ function* throttleUploadTest(actuallyThr
   let { NetMonitorView } = monitor.panelWin;
   let { RequestsMenu } = NetMonitorView;
 
   const size = 4096;
   const uploadSize = actuallyThrottle ? size / 3 : 0;
 
   const request = {
     "NetworkMonitor.throttleData": {
-      roundTripTimeMean: 0,
-      roundTripTimeMax: 0,
+      latencyMean: 0,
+      latencyMax: 0,
       downloadBPSMean: 200000,
       downloadBPSMax: 200000,
       uploadBPSMean: uploadSize,
       uploadBPSMax: uploadSize,
     },
   };
   let client = monitor._controller.webConsoleClient;
 
--- a/devtools/client/netmonitor/test/browser_net_throttle.js
+++ b/devtools/client/netmonitor/test/browser_net_throttle.js
@@ -19,18 +19,18 @@ function* throttleTest(actuallyThrottle)
   info("Starting test... (actuallyThrottle = " + actuallyThrottle + ")");
 
   // When throttling, must be smaller than the length of the content
   // of SIMPLE_URL in bytes.
   const size = actuallyThrottle ? 200 : 0;
 
   const request = {
     "NetworkMonitor.throttleData": {
-      roundTripTimeMean: 0,
-      roundTripTimeMax: 0,
+      latencyMean: 0,
+      latencyMax: 0,
       downloadBPSMean: size,
       downloadBPSMax: size,
       uploadBPSMean: 10000,
       uploadBPSMax: 10000,
     },
   };
   let client = monitor._controller.webConsoleClient;
 
--- a/devtools/server/actors/emulation.js
+++ b/devtools/server/actors/emulation.js
@@ -89,18 +89,18 @@ let EmulationActor = protocol.ActorClass
 
   _previousNetworkThrottling: undefined,
 
   /**
    * Transform the RDP format into the internal format and then set network throttling.
    */
   setNetworkThrottling({ downloadThroughput, uploadThroughput, latency }) {
     let throttleData = {
-      roundTripTimeMean: latency,
-      roundTripTimeMax: latency,
+      latencyMean: latency,
+      latencyMax: latency,
       downloadBPSMean: downloadThroughput,
       downloadBPSMax: downloadThroughput,
       uploadBPSMean: uploadThroughput,
       uploadBPSMax: uploadThroughput,
     };
     return this._setNetworkThrottling(throttleData);
   },
 
@@ -140,21 +140,21 @@ let EmulationActor = protocol.ActorClass
   /**
    * Get network throttling and then transform the internal format into the RDP format.
    */
   getNetworkThrottling() {
     let throttleData = this._getNetworkThrottling();
     if (!throttleData) {
       return null;
     }
-    let { downloadBPSMax, uploadBPSMax, roundTripTimeMax } = throttleData;
+    let { downloadBPSMax, uploadBPSMax, latencyMax } = throttleData;
     return {
       downloadThroughput: downloadBPSMax,
       uploadThroughput: uploadBPSMax,
-      latency: roundTripTimeMax,
+      latency: latencyMax,
     };
   },
 
   _getNetworkThrottling() {
     let consoleActor = this._consoleActor;
     if (!consoleActor) {
       return null;
     }
--- a/devtools/shared/webconsole/test/unit/test_throttle.js
+++ b/devtools/shared/webconsole/test/unit/test_throttle.js
@@ -71,18 +71,18 @@ TestChannel.prototype = {
     this.listener = listener;
     this.state = "listener";
     return this.testListener;
   },
 };
 
 add_task(function*() {
   let throttler = new NetworkThrottleManager({
-    roundTripTimeMean: 1,
-    roundTripTimeMax: 1,
+    latencyMean: 1,
+    latencyMax: 1,
     downloadBPSMean: 500,
     downloadBPSMax: 500,
     uploadBPSMean: 500,
     uploadBPSMax: 500,
   });
 
   let uploadChannel = new TestChannel();
   throttler.manageUpload(uploadChannel);
--- a/devtools/shared/webconsole/throttle.js
+++ b/devtools/shared/webconsole/throttle.js
@@ -220,25 +220,24 @@ NetworkThrottleListener.prototype = {
 };
 
 /**
  * Construct a new queue that can be used to throttle the network for
  * a group of related network requests.
  *
  * meanBPS {Number} Mean bytes per second.
  * maxBPS {Number} Maximum bytes per second.
- * roundTripTimeMean {Number} Mean round trip time in milliseconds.
- * roundTripTimeMax {Number} Maximum round trip time in milliseconds.
+ * latencyMean {Number} Mean latency in milliseconds.
+ * latencyMax {Number} Maximum latency in milliseconds.
  */
-function NetworkThrottleQueue(meanBPS, maxBPS,
-                              roundTripTimeMean, roundTripTimeMax) {
+function NetworkThrottleQueue(meanBPS, maxBPS, latencyMean, latencyMax) {
   this.meanBPS = meanBPS;
   this.maxBPS = maxBPS;
-  this.roundTripTimeMean = roundTripTimeMean;
-  this.roundTripTimeMax = roundTripTimeMax;
+  this.latencyMean = latencyMean;
+  this.latencyMax = latencyMax;
 
   this.pendingRequests = new Set();
   this.downloadQueue = [];
   this.previousReads = [];
 
   this.pumping = false;
 }
 
@@ -271,17 +270,17 @@ NetworkThrottleQueue.prototype = {
    * NetworkThrottleListener when the request has started.  Initially
    * a new listener object is put into a "pending" state, until the
    * round-trip time has elapsed.  This is used to simulate latency.
    *
    * @param {NetworkThrottleListener} throttleListener the new listener
    */
   start: function (throttleListener) {
     this.pendingRequests.add(throttleListener);
-    let delay = this.random(this.roundTripTimeMean, this.roundTripTimeMax);
+    let delay = this.random(this.latencyMean, this.latencyMax);
     if (delay > 0) {
       setTimeout(() => this.allowDataFrom(throttleListener), delay);
     } else {
       this.allowDataFrom(throttleListener);
     }
   },
 
   /**
@@ -349,36 +348,36 @@ NetworkThrottleQueue.prototype = {
   },
 };
 
 /**
  * Construct a new object that can be used to throttle the network for
  * a group of related network requests.
  *
  * @param {Object} An object with the following attributes:
- * roundTripTimeMean {Number} Mean round trip time in milliseconds.
- * roundTripTimeMax {Number} Maximum round trip time in milliseconds.
+ * latencyMean {Number} Mean latency in milliseconds.
+ * latencyMax {Number} Maximum latency in milliseconds.
  * downloadBPSMean {Number} Mean bytes per second for downloads.
  * downloadBPSMax {Number} Maximum bytes per second for downloads.
  * uploadBPSMean {Number} Mean bytes per second for uploads.
  * uploadBPSMax {Number} Maximum bytes per second for uploads.
  *
  * Download throttling will not be done if downloadBPSMean and
  * downloadBPSMax are <= 0.  Upload throttling will not be done if
  * uploadBPSMean and uploadBPSMax are <= 0.
  */
-function NetworkThrottleManager({roundTripTimeMean, roundTripTimeMax,
+function NetworkThrottleManager({latencyMean, latencyMax,
                                  downloadBPSMean, downloadBPSMax,
                                  uploadBPSMean, uploadBPSMax}) {
   if (downloadBPSMax <= 0 && downloadBPSMean <= 0) {
     this.downloadQueue = null;
   } else {
     this.downloadQueue =
       new NetworkThrottleQueue(downloadBPSMean, downloadBPSMax,
-                               roundTripTimeMean, roundTripTimeMax);
+                               latencyMean, latencyMax);
   }
   if (uploadBPSMax <= 0 && uploadBPSMean <= 0) {
     this.uploadQueue = null;
   } else {
     this.uploadQueue = Cc["@mozilla.org/network/throttlequeue;1"]
       .createInstance(Ci.nsIInputChannelThrottleQueue);
     this.uploadQueue.init(uploadBPSMean, uploadBPSMax);
   }