aboutsummaryrefslogtreecommitdiffstats
path: root/components/webvr_traits/webvr_traits.rs
blob: 5a9f0a2e6adef6cab5bbc401343ea1d8c053913d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* 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 http://mozilla.org/MPL/2.0/. */

use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::PipelineId;
use rust_webvr_api::*;

pub type WebVRResult<T> = Result<T, String>;

// Messages from Script thread to WebVR thread.
#[derive(Debug, Deserialize, Serialize)]
pub enum WebVRMsg {
    RegisterContext(PipelineId),
    UnregisterContext(PipelineId),
    PollEvents(IpcSender<bool>),
    GetDisplays(IpcSender<WebVRResult<Vec<VRDisplayData>>>),
    GetFrameData(
        PipelineId,
        u32,
        f64,
        f64,
        IpcSender<WebVRResult<VRFrameData>>,
    ),
    ResetPose(PipelineId, u32, IpcSender<WebVRResult<VRDisplayData>>),
    RequestPresent(PipelineId, u32, IpcSender<WebVRResult<()>>),
    ExitPresent(PipelineId, u32, Option<IpcSender<WebVRResult<()>>>),
    CreateCompositor(u32),
    GetGamepads(
        Vec<u32>,
        IpcSender<WebVRResult<Vec<(Option<VRGamepadData>, VRGamepadState)>>>,
    ),
    Exit,
}