Bug 1146237 - FramerateActor should use docShell.now() rather than performance.now so that page refreshes do not break it. r=vp
authorJordan Santell <jsantell@mozilla.com>
Tue, 26 May 2015 15:43:17 -0700
changeset 245992 4e7838090e0328eeccea46ae0d35c6ae089c60e1
parent 245991 d455e4d9198d2437b415d634ee04f14d604cdabb
child 245993 2f0c78320bd5bbee68904f2f5f63932305bcfc04
push id60333
push userryanvm@gmail.com
push dateThu, 28 May 2015 14:20:47 +0000
treeherdermozilla-inbound@8225a3b75df6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvp
bugs1146237
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1146237 - FramerateActor should use docShell.now() rather than performance.now so that page refreshes do not break it. r=vp
toolkit/devtools/server/actors/framerate.js
--- a/toolkit/devtools/server/actors/framerate.js
+++ b/toolkit/devtools/server/actors/framerate.js
@@ -35,18 +35,17 @@ let FramerateActor = exports.FramerateAc
    * Starts monitoring framerate, storing the frames per second.
    */
   startRecording: method(function() {
     if (this._recording) {
       return;
     }
     this._recording = true;
     this._ticks = [];
-
-    this._startTime = this._contentWin.performance.now();
+    this._startTime = this.tabActor.docShell.now();
     this._rafID = this._contentWin.requestAnimationFrame(this._onRefreshDriverTick);
   }, {
   }),
 
   /**
    * Stops monitoring framerate, returning the recorded values.
    */
   stopRecording: method(function(beginAt = 0, endAt = Number.MAX_SAFE_INTEGER) {
@@ -103,34 +102,24 @@ let FramerateActor = exports.FramerateAc
   /**
    * Function invoked along with the refresh driver.
    */
   _onRefreshDriverTick: function() {
     if (!this._recording) {
       return;
     }
     this._rafID = this._contentWin.requestAnimationFrame(this._onRefreshDriverTick);
-
-    // Store the amount of time passed since the recording started.
-    let currentTime = this._contentWin.performance.now();
-
-    // Store _elapsedTime so we can use this as a new starting time on a page refresh
-    // to normalize times.
-    this._elapsedTime = currentTime - this._startTime;
-    this._ticks.push(this._elapsedTime);
+    this._ticks.push(this.tabActor.docShell.now() - this._startTime);
   },
 
   /**
    * When the content window for the tab actor is created.
    */
   _onGlobalCreated: function (win) {
     if (this._recording) {
-      // Set _startTime to the currently elapsed time so we can get a wholistic
-      // elapsed time in _onRefreshDriverTick.
-      this._startTime = -this._elapsedTime;
       this._rafID = this._contentWin.requestAnimationFrame(this._onRefreshDriverTick);
     }
   }
 });
 
 /**
  * The corresponding Front object for the FramerateActor.
  */