diff options
author | Manish Goregaokar <manishsmail@gmail.com> | 2018-12-21 15:49:39 -0800 |
---|---|---|
committer | Manish Goregaokar <manishsmail@gmail.com> | 2018-12-21 16:02:24 -0800 |
commit | 1b11a3063c42b67a45432a3bc5b999ac8856d5ee (patch) | |
tree | fb82ba727456a5114578178e53ab4653b7fe77e3 /components/script/dom/xrsession.rs | |
parent | 28dff81dbf3f24ae470e1a0004f0813a3247e08f (diff) | |
download | servo-1b11a3063c42b67a45432a3bc5b999ac8856d5ee.tar.gz servo-1b11a3063c42b67a45432a3bc5b999ac8856d5ee.zip |
Support attaching RAF callbacks
Diffstat (limited to 'components/script/dom/xrsession.rs')
-rw-r--r-- | components/script/dom/xrsession.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/components/script/dom/xrsession.rs b/components/script/dom/xrsession.rs index c652b80a3f9..ac19b825d4c 100644 --- a/components/script/dom/xrsession.rs +++ b/components/script/dom/xrsession.rs @@ -4,6 +4,7 @@ use crate::dom::bindings::codegen::Bindings::XRBinding::XRSessionMode; use crate::dom::bindings::codegen::Bindings::XRSessionBinding; +use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRFrameRequestCallback; use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRSessionMethods; use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding::XRWebGLLayerMethods; use crate::dom::bindings::inheritance::Castable; @@ -17,6 +18,7 @@ use crate::dom::xrlayer::XRLayer; use crate::dom::xrwebgllayer::XRWebGLLayer; use dom_struct::dom_struct; use std::cell::Cell; +use std::rc::Rc; #[dom_struct] pub struct XRSession { @@ -82,4 +84,12 @@ impl XRSessionMethods for XRSession { fn GetBaseLayer(&self) -> Option<DomRoot<XRLayer>> { self.base_layer.get() } + + fn RequestAnimationFrame(&self, callback: Rc<XRFrameRequestCallback>) -> i32 { + self.display.xr_raf(callback) as i32 + } + + fn CancelAnimationFrame(&self, frame: i32) { + self.display.xr_cancel_raf(frame) + } } |