Bug 1852740: add tests for the `fetchpriority` attribute in Link headers. r=necko...
[gecko.git] / dom / vr / XRViewerPose.cpp
blobaf11306c088364e381fa5e0740165ef60db8102b
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 #include "mozilla/dom/XRViewerPose.h"
8 #include "mozilla/dom/XRView.h"
10 namespace mozilla::dom {
12 NS_IMPL_CYCLE_COLLECTION_CLASS(XRViewerPose)
14 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(XRViewerPose, XRPose)
15 NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mViews)
16 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
18 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(XRViewerPose, XRPose)
19 NS_IMPL_CYCLE_COLLECTION_UNLINK(mViews)
20 // Don't need NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER because
21 // XRPose does it for us.
22 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
24 NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(XRViewerPose, XRPose)
26 XRViewerPose::XRViewerPose(nsISupports* aParent, XRRigidTransform* aTransform,
27 bool aEmulatedPosition,
28 const nsTArray<RefPtr<XRView>>& aViews)
29 : XRPose(aParent, aTransform, aEmulatedPosition), mViews(aViews.Clone()) {}
31 JSObject* XRViewerPose::WrapObject(JSContext* aCx,
32 JS::Handle<JSObject*> aGivenProto) {
33 return XRViewerPose_Binding::Wrap(aCx, this, aGivenProto);
36 RefPtr<XRView>& XRViewerPose::GetEye(int32_t aIndex) {
37 return mViews.ElementAt(aIndex);
40 void XRViewerPose::GetViews(nsTArray<RefPtr<XRView>>& aResult) {
41 aResult = mViews.Clone();
44 } // namespace mozilla::dom