diff options
author | Manish Goregaokar <manishsmail@gmail.com> | 2020-01-08 16:10:29 +0530 |
---|---|---|
committer | Manish Goregaokar <manishsmail@gmail.com> | 2020-01-09 08:16:25 +0530 |
commit | bf30bf26a4754e21d4ae14ec0699cb3ca713c98c (patch) | |
tree | 9970ce962dea2fedb673dc9974c65ecdf3bef6d6 /components/script/dom/fakexrinputcontroller.rs | |
parent | 9ecb13d83f2c83c27f2e50f98dcda0a5ef0a886d (diff) | |
download | servo-bf30bf26a4754e21d4ae14ec0699cb3ca713c98c.tar.gz servo-bf30bf26a4754e21d4ae14ec0699cb3ca713c98c.zip |
Add blank FakeXRInputController interface
Diffstat (limited to 'components/script/dom/fakexrinputcontroller.rs')
-rw-r--r-- | components/script/dom/fakexrinputcontroller.rs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/components/script/dom/fakexrinputcontroller.rs b/components/script/dom/fakexrinputcontroller.rs new file mode 100644 index 00000000000..274039c2fd2 --- /dev/null +++ b/components/script/dom/fakexrinputcontroller.rs @@ -0,0 +1,42 @@ +/* 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::codegen::Bindings::FakeXRInputControllerBinding::{self}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::root::DomRoot; +use crate::dom::globalscope::GlobalScope; +use dom_struct::dom_struct; +use ipc_channel::ipc::IpcSender; +use webxr_api::{InputId, MockDeviceMsg}; + +#[dom_struct] +pub struct FakeXRInputController { + reflector: Reflector, + #[ignore_malloc_size_of = "defined in ipc-channel"] + sender: IpcSender<MockDeviceMsg>, + #[ignore_malloc_size_of = "defined in webxr-api"] + id: InputId, +} + +impl FakeXRInputController { + pub fn new_inherited(sender: IpcSender<MockDeviceMsg>, id: InputId) -> FakeXRInputController { + FakeXRInputController { + reflector: Reflector::new(), + sender, + id, + } + } + + pub fn new( + global: &GlobalScope, + sender: IpcSender<MockDeviceMsg>, + id: InputId, + ) -> DomRoot<FakeXRInputController> { + reflect_dom_object( + Box::new(FakeXRInputController::new_inherited(sender, id)), + global, + FakeXRInputControllerBinding::Wrap, + ) + } +} |