Bug 1829125 - Add a PHCExhaustion test r=glandium
[gecko.git] / dom / vr / XRRenderState.h
blob60049495005140ac2868285ee238e4bd01f5cdab
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/. */
7 #ifndef mozilla_dom_XRRenderState_h_
8 #define mozilla_dom_XRRenderState_h_
10 #include "mozilla/DOMEventTargetHelper.h"
11 #include "mozilla/dom/WebXRBinding.h"
13 #include "gfxVR.h"
15 namespace mozilla::dom {
16 class XRWebGLLayer;
18 class XRRenderState final : public nsWrapperCache {
19 public:
20 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(XRRenderState)
21 NS_DECL_CYCLE_COLLECTION_NATIVE_WRAPPERCACHE_CLASS(XRRenderState)
23 explicit XRRenderState(nsISupports* aParent, XRSession* aSession);
24 explicit XRRenderState(const XRRenderState& aOther);
26 void SetDepthNear(double aDepthNear);
27 void SetDepthFar(double aDepthFar);
28 void SetInlineVerticalFieldOfView(double aInlineVerticalFieldOfView);
29 void SetBaseLayer(XRWebGLLayer* aBaseLayer);
31 // WebIDL Boilerplate
32 nsISupports* GetParentObject() const { return mParent; }
33 JSObject* WrapObject(JSContext* aCx,
34 JS::Handle<JSObject*> aGivenProto) override;
36 // WebIDL Members
37 double DepthNear();
38 double DepthFar();
39 Nullable<double> GetInlineVerticalFieldOfView();
40 XRWebGLLayer* GetBaseLayer();
42 // Non-WebIDL Members
43 void SetOutputCanvas(HTMLCanvasElement* aCanvas);
44 HTMLCanvasElement* GetOutputCanvas() const;
45 void SetCompositionDisabled(bool aCompositionDisabled);
46 bool IsCompositionDisabled() const;
47 void SessionEnded();
49 protected:
50 virtual ~XRRenderState() = default;
51 nsCOMPtr<nsISupports> mParent;
52 RefPtr<XRSession> mSession;
53 RefPtr<XRWebGLLayer> mBaseLayer;
54 double mDepthNear;
55 double mDepthFar;
56 Nullable<double> mInlineVerticalFieldOfView;
57 // https://immersive-web.github.io/webxr/#xrrenderstate-output-canvas
58 RefPtr<HTMLCanvasElement> mOutputCanvas;
59 // https://immersive-web.github.io/webxr/#xrrenderstate-composition-disabled
60 bool mCompositionDisabled;
63 } // namespace mozilla::dom
65 #endif // mozilla_dom_XRRenderState_h_