diff options
author | Alan Jeffrey <ajeffrey@mozilla.com> | 2020-04-08 17:35:20 -0500 |
---|---|---|
committer | Alan Jeffrey <ajeffrey@mozilla.com> | 2020-04-13 13:57:58 -0500 |
commit | fda8da0e9dcb575205fd29e566ece1d72fe1ab11 (patch) | |
tree | a51a14cb21db8989ab019ec748ed4658f2ca6a08 /components/script/dom/xrmediabinding.rs | |
parent | 7ae11588dc36e644750008d1224a6d93c9e49d08 (diff) | |
download | servo-fda8da0e9dcb575205fd29e566ece1d72fe1ab11.tar.gz servo-fda8da0e9dcb575205fd29e566ece1d72fe1ab11.zip |
Added first-cut implementation of XR layers
Diffstat (limited to 'components/script/dom/xrmediabinding.rs')
-rw-r--r-- | components/script/dom/xrmediabinding.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/components/script/dom/xrmediabinding.rs b/components/script/dom/xrmediabinding.rs new file mode 100644 index 00000000000..b0b6a0ac69c --- /dev/null +++ b/components/script/dom/xrmediabinding.rs @@ -0,0 +1,35 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +use crate::dom::bindings::reflector::reflect_dom_object; +use crate::dom::bindings::reflector::Reflector; +use crate::dom::bindings::root::Dom; +use crate::dom::bindings::root::DomRoot; +use crate::dom::window::Window; +use crate::dom::xrsession::XRSession; +use dom_struct::dom_struct; + +#[dom_struct] +pub struct XRMediaBinding { + reflector: Reflector, + session: Dom<XRSession>, +} + +impl XRMediaBinding { + pub fn new_inherited(session: &XRSession) -> XRMediaBinding { + XRMediaBinding { + reflector: Reflector::new(), + session: Dom::from_ref(session), + } + } + + pub fn new(global: &Window, session: &XRSession) -> DomRoot<XRMediaBinding> { + reflect_dom_object(Box::new(XRMediaBinding::new_inherited(session)), global) + } + + #[allow(non_snake_case)] + pub fn Constructor(global: &Window, session: &XRSession) -> DomRoot<XRMediaBinding> { + XRMediaBinding::new(global, session) + } +} |