Bug 1306493 - Part 4: Make timestamp to be a monotonically increasing value in VRMockDisplay; r=kip
authorDaosheng Mu <daoshengmu@gmail.com>
Wed, 15 Mar 2017 13:49:39 +0800
changeset 348065 1f6c8b941701bb07aee0702eb11ceb92cbba22ce
parent 348064 fe03299ff1eb4bb8a6c586d0b72a7d631b267ba6
child 348066 b34efbb33ad6c5b9f2950c85c399669c56fa92e2
push id31512
push usercbook@mozilla.com
push dateFri, 17 Mar 2017 13:28:24 +0000
treeherdermozilla-central@9a95ade0ec97 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskip
bugs1306493
milestone55.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 1306493 - Part 4: Make timestamp to be a monotonically increasing value in VRMockDisplay; r=kip MozReview-Commit-ID: COR9n3fQBTX
dom/vr/VRServiceTest.cpp
dom/vr/VRServiceTest.h
gfx/vr/gfxVRPuppet.cpp
--- a/dom/vr/VRServiceTest.cpp
+++ b/dom/vr/VRServiceTest.cpp
@@ -23,16 +23,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(VRMockDisplay)
 NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
 
 NS_IMPL_ADDREF_INHERITED(VRMockDisplay, DOMEventTargetHelper)
 NS_IMPL_RELEASE_INHERITED(VRMockDisplay, DOMEventTargetHelper)
 
 VRMockDisplay::VRMockDisplay(const nsCString& aID, uint32_t aDeviceID)
  : mDeviceID(aDeviceID)
+ , mTimestamp(TimeStamp::Now())
 {
   mDisplayInfo.mDisplayName = aID;
   mDisplayInfo.mType = VRDeviceType::Puppet;
   mDisplayInfo.mIsConnected = true;
   mDisplayInfo.mIsMounted = false;
   mDisplayInfo.mCapabilityFlags = VRDisplayCapabilityFlags::Cap_None |
                                   VRDisplayCapabilityFlags::Cap_Orientation |
                                   VRDisplayCapabilityFlags::Cap_AngularAcceleration |
@@ -73,17 +74,17 @@ void
 VRMockDisplay::SetPose(const Nullable<Float32Array>& aPosition,
                        const Nullable<Float32Array>& aLinearVelocity,
                        const Nullable<Float32Array>& aLinearAcceleration,
                        const Nullable<Float32Array>& aOrientation,
                        const Nullable<Float32Array>& aAngularVelocity,
                        const Nullable<Float32Array>& aAngularAcceleration)
 {
   mSensorState.Clear();
-  mSensorState.timestamp = PR_Now();
+  mSensorState.timestamp = (TimeStamp::Now() - mTimestamp).ToSeconds();
   mSensorState.flags = VRDisplayCapabilityFlags::Cap_Orientation |
                        VRDisplayCapabilityFlags::Cap_Position |
                        VRDisplayCapabilityFlags::Cap_AngularAcceleration |
                        VRDisplayCapabilityFlags::Cap_LinearAcceleration |
                        VRDisplayCapabilityFlags::Cap_External |
                        VRDisplayCapabilityFlags::Cap_MountDetection |
                        VRDisplayCapabilityFlags::Cap_Present;
 
--- a/dom/vr/VRServiceTest.h
+++ b/dom/vr/VRServiceTest.h
@@ -31,16 +31,17 @@ public:
   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 private:
   ~VRMockDisplay() = default;
 
   uint32_t mDeviceID;
   gfx::VRDisplayInfo mDisplayInfo;
   gfx::VRHMDSensorState mSensorState;
+  TimeStamp mTimestamp;
 };
 
 class VRMockController : public DOMEventTargetHelper
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(VRMockController, DOMEventTargetHelper)
 
--- a/gfx/vr/gfxVRPuppet.cpp
+++ b/gfx/vr/gfxVRPuppet.cpp
@@ -84,17 +84,16 @@ VRDisplayPuppet::VRDisplayPuppet()
   mDisplayInfo.mSittingToStandingTransform._33 = 1.0f;
   mDisplayInfo.mSittingToStandingTransform._34 = 0.0f;
 
   mDisplayInfo.mSittingToStandingTransform._41 = 0.0f;
   mDisplayInfo.mSittingToStandingTransform._42 = 0.75f;
   mDisplayInfo.mSittingToStandingTransform._43 = 0.0f;
 
   mSensorState.Clear();
-  mSensorState.timestamp = PR_Now();
 
   gfx::Quaternion rot;
 
   mSensorState.flags |= VRDisplayCapabilityFlags::Cap_Orientation;
   mSensorState.orientation[0] = rot.x;
   mSensorState.orientation[1] = rot.y;
   mSensorState.orientation[2] = rot.z;
   mSensorState.orientation[3] = rot.w;