1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef GFX_VR_DISPLAY_CLIENT_H 8 #define GFX_VR_DISPLAY_CLIENT_H 9 10 #include "nsIScreen.h" 11 #include "nsCOMPtr.h" 12 #include "mozilla/RefPtr.h" 13 #include "mozilla/dom/VRDisplayBinding.h" 14 15 #include "gfxVR.h" 16 17 namespace mozilla { 18 namespace gfx { 19 class VRDisplayPresentation; 20 class VRManagerChild; 21 22 class VRDisplayClient { 23 public: 24 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRDisplayClient) 25 26 explicit VRDisplayClient(const VRDisplayInfo& aDisplayInfo); 27 28 void UpdateDisplayInfo(const VRDisplayInfo& aDisplayInfo); 29 void UpdateSubmitFrameResult(const VRSubmitFrameResultInfo& aResult); 30 GetDisplayInfo()31 const VRDisplayInfo& GetDisplayInfo() const { return mDisplayInfo; } 32 virtual VRHMDSensorState GetSensorState(); 33 void GetSubmitFrameResult(VRSubmitFrameResultInfo& aResult); 34 35 virtual void ZeroSensor(); 36 37 already_AddRefed<VRDisplayPresentation> BeginPresentation( 38 const nsTArray<dom::VRLayer>& aLayers, uint32_t aGroup); 39 void PresentationDestroyed(); 40 41 bool GetIsConnected() const; 42 43 void NotifyDisconnected(); 44 void SetGroupMask(uint32_t aGroupMask); 45 46 bool IsPresentationGenerationCurrent() const; 47 void MakePresentationGenerationCurrent(); 48 49 protected: 50 virtual ~VRDisplayClient(); 51 52 void FireEvents(); 53 54 VRDisplayInfo mDisplayInfo; 55 56 bool bLastEventWasMounted; 57 bool bLastEventWasPresenting; 58 59 int mPresentationCount; 60 uint64_t mLastEventFrameId; 61 uint32_t mLastPresentingGeneration; 62 63 private: 64 VRSubmitFrameResultInfo mSubmitFrameResult; 65 }; 66 67 } // namespace gfx 68 } // namespace mozilla 69 70 #endif /* GFX_VR_DISPLAY_CLIENT_H */ 71