Bug 1311802 - Part1 - Add SetMountState interface for VRMockDisplay; r=baku,daoshengmu
authorChih-Yi Leu <cleu@mozilla.com>
Mon, 27 Mar 2017 11:26:19 +0800
changeset 352348 e007a9be3fa61e8fb4669d7e4c10837e491b7ca9
parent 352347 09f3e1bbb8707aa950bf20a175e9d2fe56be4568
child 352349 8802bed9ee8332d135dd186ca72fcd14cef8326c
push id31639
push userihsiao@mozilla.com
push dateWed, 12 Apr 2017 03:09:17 +0000
treeherdermozilla-central@b050e9d52468 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku, daoshengmu
bugs1311802
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 1311802 - Part1 - Add SetMountState interface for VRMockDisplay; r=baku,daoshengmu MozReview-Commit-ID: 7MFHIri2Bq7
dom/vr/VRServiceTest.h
dom/vr/test/VRSimulationDriver.js
dom/webidl/VRServiceTest.webidl
gfx/vr/gfxVRPuppet.cpp
--- a/dom/vr/VRServiceTest.h
+++ b/dom/vr/VRServiceTest.h
@@ -22,16 +22,17 @@ public:
   VRMockDisplay(const nsCString& aID, uint32_t aDeviceID);
   void SetEyeParameter(VREye aEye, double aOffsetX, double aOffsetY, double aOffsetZ,
                        double aUpDegree, double aRightDegree,
                        double aDownDegree, double aLeftDegree);
   void SetEyeResolution(unsigned long aRenderWidth, unsigned long aRenderHeight);
   void 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);
+  void SetMountState(bool aIsMounted) { mDisplayInfo.mIsMounted = aIsMounted; }
   void Update();
   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 private:
   ~VRMockDisplay() = default;
 
   uint32_t mDeviceID;
   gfx::VRDisplayInfo mDisplayInfo;
@@ -79,9 +80,9 @@ private:
 
   nsCOMPtr<nsPIDOMWindowInner> mWindow;
   bool mShuttingDown;
 };
 
 } // namespace dom
 } // namespace mozilla
 
-#endif // mozilla_dom_VRServiceTest_h_
\ No newline at end of file
+#endif // mozilla_dom_VRServiceTest_h_
--- a/dom/vr/test/VRSimulationDriver.js
+++ b/dom/vr/test/VRSimulationDriver.js
@@ -28,25 +28,30 @@ var SetEyeResolution = function(width, h
 }
 
 var SetEyeParameter = function(eye, offsetX, offsetY, offsetZ,
                                upDegree, rightDegree, downDegree, leftDegree) {
   vrMockDisplay.setEyeParameter(eye, offsetX, offsetY, offsetZ, upDegree, rightDegree,
                                 downDegree, leftDegree);
 }
 
+var SetMountState = function(isMounted) {
+  vrMockDisplay.setMountState(isMounted);
+}
+
 var UpdateVRDisplay = function() {
   vrMockDisplay.update();
 }
 
 var API = {
   AttachWebVRDisplay: AttachWebVRDisplay,
   SetVRDisplayPose: SetVRDisplayPose,
   SetEyeResolution: SetEyeResolution,
   SetEyeParameter: SetEyeParameter,
+  SetMountState: SetMountState,
   UpdateVRDisplay: UpdateVRDisplay,
 
   none: false
 };
 
 return API;
 
 }());
\ No newline at end of file
--- a/dom/webidl/VRServiceTest.webidl
+++ b/dom/webidl/VRServiceTest.webidl
@@ -10,16 +10,17 @@
 interface VRMockDisplay {
   void setEyeResolution(unsigned long aRenderWidth, unsigned long aRenderHeight);
   void setEyeParameter(VREye eye, double offsetX, double offsetY, double offsetZ,
                        double upDegree, double rightDegree,
                        double downDegree, double leftDegree);
   void setPose(Float32Array? position, Float32Array? linearVelocity,
                Float32Array? linearAcceleration, Float32Array? orientation,
                Float32Array? angularVelocity, Float32Array? angularAcceleration);
+  void setMountState(boolean isMounted);
   void update();
 };
 
 [Pref="dom.vr.test.enabled",
  HeaderFile="mozilla/dom/VRServiceTest.h"]
 interface VRMockController {
   void newButtonEvent(unsigned long button, boolean pressed);
   void newAxisMoveEvent(unsigned long axis, double value);
--- a/gfx/vr/gfxVRPuppet.cpp
+++ b/gfx/vr/gfxVRPuppet.cpp
@@ -115,18 +115,19 @@ VRDisplayPuppet::VRDisplayPuppet()
 VRDisplayPuppet::~VRDisplayPuppet()
 {
   MOZ_COUNT_DTOR_INHERITED(VRDisplayPuppet, VRDisplayHost);
 }
 
 void
 VRDisplayPuppet::SetDisplayInfo(const VRDisplayInfo& aDisplayInfo)
 {
-  // We are only interested in the eye info of the display info.
+  // We are only interested in the eye and mount info of the display info.
   mDisplayInfo.mEyeResolution = aDisplayInfo.mEyeResolution;
+  mDisplayInfo.mIsMounted = aDisplayInfo.mIsMounted;
   memcpy(&mDisplayInfo.mEyeFOV, &aDisplayInfo.mEyeFOV,
          sizeof(mDisplayInfo.mEyeFOV[0]) * VRDisplayInfo::NumEyes);
   memcpy(&mDisplayInfo.mEyeTranslation, &aDisplayInfo.mEyeTranslation,
          sizeof(mDisplayInfo.mEyeTranslation[0]) * VRDisplayInfo::NumEyes);
 }
 
 void
 VRDisplayPuppet::Destroy()