Backed out changeset e4bf227a6224 (bug 1801501) for causing mochitest plain failures...
[gecko.git] / dom / vr / XRInputSourceArray.h
blob424e0062959c56ae6a4b0e4ecc43c899635fc2ad
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_XRInputSourceArray_h_
8 #define mozilla_dom_XRInputSourceArray_h_
10 #include "mozilla/DOMEventTargetHelper.h"
11 #include "mozilla/dom/WebXRBinding.h"
13 #include "gfxVR.h"
15 namespace mozilla {
16 namespace gfx {
17 struct VRControllerState;
19 namespace dom {
20 class XRInputSource;
22 class XRInputSourceArray final : public nsISupports, public nsWrapperCache {
23 public:
24 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
25 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(XRInputSourceArray)
27 explicit XRInputSourceArray(nsISupports* aParent);
29 // WebIDL Boilerplate
30 nsISupports* GetParentObject() const { return mParent; }
31 JSObject* WrapObject(JSContext* aCx,
32 JS::Handle<JSObject*> aGivenProto) override;
34 // WebIDL Members
35 XRInputSource* IndexedGetter(uint32_t aIndex, bool& aFound);
36 uint32_t Length();
37 void Setup(XRSession* aSession, RefPtr<gfx::VRDisplayClient> aDisplayClient);
38 void Update(XRSession* aSession);
39 void Clear(XRSession* aSession);
41 protected:
42 virtual ~XRInputSourceArray() = default;
44 private:
45 void DispatchInputSourceRemovedEvent(
46 const nsTArray<RefPtr<XRInputSource>>& aInputs, XRSession* aSession);
48 nsCOMPtr<nsISupports> mParent;
49 nsTArray<RefPtr<XRInputSource>> mInputSources;
52 } // namespace dom
53 } // namespace mozilla
55 #endif // mozilla_dom_XRInputSourceArray_h_