Bug 1189162 - Clamp gamepad.timestamp and VideoPlaybackQuality.creationTime. r=bz
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Thu, 30 Jul 2015 01:41:00 -0400
changeset 287321 2f028ee4e97cc1b96d38dc212c9dec680ecc2d61
parent 287320 82ce9a2fcd3d85c4afb124b49c0bd8e30e83d0aa
child 287322 8010e0cbd2288eb3846533febcd6d523c573d667
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1189162
milestone42.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 1189162 - Clamp gamepad.timestamp and VideoPlaybackQuality.creationTime. r=bz
dom/gamepad/Gamepad.cpp
dom/html/HTMLVideoElement.cpp
dom/tests/mochitest/gamepad/test_gamepad.html
--- a/dom/gamepad/Gamepad.cpp
+++ b/dom/gamepad/Gamepad.cpp
@@ -26,17 +26,17 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Ga
 
 void
 Gamepad::UpdateTimestamp()
 {
   nsCOMPtr<nsPIDOMWindow> newWindow(do_QueryInterface(mParent));
   if(newWindow) {
     nsPerformance* perf = newWindow->GetPerformance();
     if (perf) {
-      mTimestamp =  perf->GetDOMTiming()->TimeStampToDOMHighRes(TimeStamp::Now());
+      mTimestamp =  perf->Now();
     }
   }
 }
 
 Gamepad::Gamepad(nsISupports* aParent,
                  const nsAString& aID, uint32_t aIndex,
                  GamepadMappingType aMapping,
                  uint32_t aNumButtons, uint32_t aNumAxes)
--- a/dom/html/HTMLVideoElement.cpp
+++ b/dom/html/HTMLVideoElement.cpp
@@ -208,17 +208,17 @@ HTMLVideoElement::GetVideoPlaybackQualit
   uint64_t droppedFrames = 0;
   uint64_t corruptedFrames = 0;
 
   if (sVideoStatsEnabled) {
     nsPIDOMWindow* window = OwnerDoc()->GetInnerWindow();
     if (window) {
       nsPerformance* perf = window->GetPerformance();
       if (perf) {
-        creationTime = perf->GetDOMTiming()->TimeStampToDOMHighRes(TimeStamp::Now());
+        creationTime = perf->Now();
       }
     }
 
     if (mDecoder) {
       MediaDecoder::FrameStatistics& stats = mDecoder->GetFrameStatistics();
       totalFrames = stats.GetParsedFrames();
       droppedFrames = stats.GetDroppedFrames();
       corruptedFrames = 0;
--- a/dom/tests/mochitest/gamepad/test_gamepad.html
+++ b/dom/tests/mochitest/gamepad/test_gamepad.html
@@ -14,17 +14,18 @@ SimpleTest.waitForExplicitFinish();
 window.addEventListener("gamepadconnected", connecthandler);
 // Add a gamepad
 var index = GamepadService.addGamepad("test gamepad", // id
                                       SpecialPowers.Ci.nsIGamepadServiceTest.STANDARD_MAPPING,
                                       4, // buttons
                                       2);// axes
 GamepadService.newButtonEvent(index, 0, true);
 function connecthandler(e) {
-  ok(e.gamepad.timestamp <= performance.now());
+  ok(e.gamepad.timestamp <= performance.now(),
+     "gamepad.timestamp should less than or equal to performance.now()");
   is(e.gamepad.index, 0, "correct gamepad index");
   is(e.gamepad.id, "test gamepad", "correct gamepad name");
   is(e.gamepad.mapping, "standard", "standard mapping");
   is(e.gamepad.buttons.length, 4, "correct number of buttons");
   is(e.gamepad.axes.length, 2, "correct number of axes");
   // Press a button
   GamepadService.newButtonEvent(index, 0, true);
   gamepads = navigator.getGamepads();