VRDisplayPresentation.h (1386B)
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_PRESENTATION_H 8 #define GFX_VR_DISPLAY_PRESENTATION_H 9 10 #include "mozilla/RefPtr.h" 11 #include "mozilla/dom/VRDisplayBinding.h" 12 13 namespace mozilla { 14 namespace dom { 15 class XRWebGLLayer; 16 } 17 namespace gfx { 18 class VRDisplayClient; 19 class VRLayerChild; 20 21 class VRDisplayPresentation final { 22 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRDisplayPresentation) 23 24 public: 25 VRDisplayPresentation(VRDisplayClient* aDisplayClient, 26 const nsTArray<dom::VRLayer>& aLayers, uint32_t aGroup); 27 void UpdateLayers(const nsTArray<mozilla::dom::VRLayer>& aLayers); 28 void UpdateXRWebGLLayer(dom::XRWebGLLayer* aLayer); 29 void SubmitFrame(); 30 void GetDOMLayers(nsTArray<dom::VRLayer>& result); 31 uint32_t GetGroup() const; 32 33 private: 34 ~VRDisplayPresentation(); 35 void CreateLayers(); 36 void DestroyLayers(); 37 38 RefPtr<VRDisplayClient> mDisplayClient; 39 nsTArray<dom::VRLayer> mDOMLayers; 40 nsTArray<RefPtr<VRLayerChild>> mLayers; 41 uint32_t mGroup; 42 }; 43 44 } // namespace gfx 45 } // namespace mozilla 46 47 #endif /* GFX_VR_DISPLAY_PRESENTAITON_H */