Add session parameter to XRSpace

This commit is contained in:
Manish Goregaokar 2019-03-14 15:18:47 -07:00
parent ffacb1179e
commit 8f14007979
3 changed files with 22 additions and 11 deletions

View file

@ -4,27 +4,30 @@
use crate::dom::bindings::codegen::Bindings::XRSpaceBinding;
use crate::dom::bindings::reflector::reflect_dom_object;
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::dom::xrsession::XRSession;
use dom_struct::dom_struct;
#[dom_struct]
pub struct XRSpace {
eventtarget: EventTarget,
session: Dom<XRSession>,
}
impl XRSpace {
pub fn new_inherited() -> XRSpace {
pub fn new_inherited(session: &XRSession) -> XRSpace {
XRSpace {
eventtarget: EventTarget::new_inherited(),
session: Dom::from_ref(session),
}
}
#[allow(unused)]
pub fn new(global: &GlobalScope) -> DomRoot<XRSpace> {
pub fn new(global: &GlobalScope, session: &XRSession) -> DomRoot<XRSpace> {
reflect_dom_object(
Box::new(XRSpace::new_inherited()),
Box::new(XRSpace::new_inherited(session)),
global,
XRSpaceBinding::Wrap,
)