Bug 1189162 - Clamp gamepad.timestamp and VideoPlaybackQuality.creationTime. r=bz, a=ritu
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Thu, 30 Jul 2015 01:41:00 -0400
changeset 281811 c05f7ddf3df68b0c7f529652e98c2276fc73a7d5
parent 281810 9f9255fa45c0f9a1b68167913254134159f65bce
child 281812 ef164895b70844b190589895cecebe0706daebb8
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, ritu
bugs1189162
milestone41.0a2
Bug 1189162 - Clamp gamepad.timestamp and VideoPlaybackQuality.creationTime. r=bz, a=ritu
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
@@ -204,17 +204,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();