Use correct timestamps

This commit is contained in:
Manish Goregaokar 2019-12-11 16:17:21 -08:00
parent f9b97fd366
commit e27687497b
2 changed files with 8 additions and 4 deletions

5
Cargo.lock generated
View file

@ -6391,7 +6391,7 @@ dependencies = [
[[package]]
name = "webxr"
version = "0.0.1"
source = "git+https://github.com/servo/webxr#29f4f1f28695553c45d6c020172048c0035c49ed"
source = "git+https://github.com/servo/webxr#b223bc02b04c8ce0905f34a58802af323457bef4"
dependencies = [
"bindgen",
"euclid",
@ -6403,6 +6403,7 @@ dependencies = [
"serde",
"surfman",
"surfman-chains",
"time",
"webxr-api",
"winapi",
"wio",
@ -6411,7 +6412,7 @@ dependencies = [
[[package]]
name = "webxr-api"
version = "0.0.1"
source = "git+https://github.com/servo/webxr#29f4f1f28695553c45d6c020172048c0035c49ed"
source = "git+https://github.com/servo/webxr#b223bc02b04c8ce0905f34a58802af323457bef4"
dependencies = [
"euclid",
"ipc-channel",

View file

@ -43,6 +43,7 @@ use dom_struct::dom_struct;
use euclid::{Rect, RigidTransform3D, Transform3D};
use ipc_channel::ipc::IpcSender;
use ipc_channel::router::ROUTER;
use metrics::ToMs;
use profile_traits::ipc;
use std::cell::Cell;
use std::mem;
@ -72,7 +73,7 @@ pub struct XRSession {
#[ignore_malloc_size_of = "closures are hard"]
raf_callback_list: DomRefCell<Vec<(i32, Option<Rc<XRFrameRequestCallback>>)>>,
#[ignore_malloc_size_of = "defined in ipc-channel"]
raf_sender: DomRefCell<Option<IpcSender<(f64, Frame)>>>,
raf_sender: DomRefCell<Option<IpcSender<Frame>>>,
input_sources: Dom<XRInputSourceArray>,
// Any promises from calling end()
#[ignore_malloc_size_of = "promises are hard"]
@ -300,7 +301,7 @@ impl XRSession {
}
/// https://immersive-web.github.io/webxr/#xr-animation-frame
fn raf_callback(&self, (time, mut frame): (f64, Frame)) {
fn raf_callback(&self, mut frame: Frame) {
debug!("WebXR RAF callback");
// Step 1
@ -333,6 +334,8 @@ impl XRSession {
// Step 4-5
let mut callbacks = mem::replace(&mut *self.raf_callback_list.borrow_mut(), vec![]);
let start = self.global().as_window().get_navigation_start();
let time = (frame.time_ns - start).to_ms();
let frame = XRFrame::new(&self.global(), self, frame);
// Step 6,7