tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

XRFrame.h (1884B)


      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 file,
      5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef mozilla_dom_XRFrame_h_
      8 #define mozilla_dom_XRFrame_h_
      9 
     10 #include "gfxVR.h"
     11 #include "mozilla/DOMEventTargetHelper.h"
     12 #include "mozilla/dom/WebXRBinding.h"
     13 
     14 namespace mozilla::dom {
     15 
     16 class XRFrameOfReference;
     17 class XRInputPose;
     18 class XRInputSource;
     19 class XRPose;
     20 class XRReferenceSpace;
     21 class XRSession;
     22 class XRSpace;
     23 class XRViewerPose;
     24 
     25 class XRFrame final : public nsWrapperCache {
     26 public:
     27  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(XRFrame)
     28  NS_DECL_CYCLE_COLLECTION_NATIVE_WRAPPERCACHE_CLASS(XRFrame)
     29 
     30  explicit XRFrame(nsISupports* aParent, XRSession* aXRSession);
     31 
     32  void StartAnimationFrame();
     33  void EndAnimationFrame();
     34  void StartInputSourceEvent();
     35  void EndInputSourceEvent();
     36 
     37  // WebIDL Boilerplate
     38  nsISupports* GetParentObject() const { return mParent; }
     39  JSObject* WrapObject(JSContext* aCx,
     40                       JS::Handle<JSObject*> aGivenProto) override;
     41 
     42  // WebIDL Members
     43  XRSession* Session();
     44  already_AddRefed<XRViewerPose> GetViewerPose(
     45      const XRReferenceSpace& aReferenceSpace, ErrorResult& aRv);
     46  already_AddRefed<XRPose> GetPose(const XRSpace& aSpace,
     47                                   const XRSpace& aBaseSpace, ErrorResult& aRv);
     48  gfx::Matrix4x4 ConstructInlineProjection(float aFov, float aAspect,
     49                                           float aNear, float aFar);
     50 
     51 protected:
     52  virtual ~XRFrame() = default;
     53 
     54  nsCOMPtr<nsISupports> mParent;
     55  RefPtr<XRSession> mSession;
     56  bool mActive;
     57  bool mAnimationFrame;
     58 };
     59 
     60 }  // namespace mozilla::dom
     61 
     62 #endif  // mozilla_dom_XRFrame_h_