diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-05-25 07:12:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-25 07:12:11 -0500 |
commit | 3c267d7fddd036f6bcc9ebf000ed37665cf7496d (patch) | |
tree | 1b643c9429d03dc56196a3771b9a8f1b22ab9a4f | |
parent | 7780ef5e431b7c346c0f50ff914fbda9b5017900 (diff) | |
parent | 5ac106cbbe30054ee9440082049ccad0595937d5 (diff) | |
download | servo-3c267d7fddd036f6bcc9ebf000ed37665cf7496d.tar.gz servo-3c267d7fddd036f6bcc9ebf000ed37665cf7496d.zip |
Auto merge of #17031 - MortimerGoro:update_webvr, r=emilio
Update rust-webvr
<!-- Please describe your changes on the following line: -->
Required for https://github.com/servo/servo/issues/16556
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).
<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17031)
<!-- Reviewable:end -->
-rw-r--r-- | Cargo.lock | 17 | ||||
-rw-r--r-- | components/config/Cargo.toml | 2 | ||||
-rw-r--r-- | components/script/dom/vr.rs | 7 | ||||
-rw-r--r-- | components/script/dom/vrdisplay.rs | 34 | ||||
-rw-r--r-- | components/script/dom/vrdisplayevent.rs | 7 | ||||
-rw-r--r-- | components/webvr_traits/Cargo.toml | 2 | ||||
-rw-r--r-- | ports/servo/Cargo.toml | 2 |
7 files changed, 58 insertions, 13 deletions
diff --git a/Cargo.lock b/Cargo.lock index ee9a720f575..5daa62f0539 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = "0.0.1" dependencies = [ "ipc-channel 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", - "rust-webvr 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-webvr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -35,7 +35,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "android_injected_glue" version = "0.2.2" -source = "git+https://github.com/mmatyas/android-rs-injected-glue#1995be2c692d8d1f4c82d387c06c56451721cc38" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "angle" @@ -2268,11 +2268,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rust-webvr" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "android_injected_glue 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libloading 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libloading 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2530,7 +2531,7 @@ dependencies = [ name = "servo" version = "0.0.1" dependencies = [ - "android_injected_glue 0.2.2 (git+https://github.com/mmatyas/android-rs-injected-glue)", + "android_injected_glue 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "browserhtml 0.1.17 (git+https://github.com/browserhtml/browserhtml?branch=crate)", "compiletest_helper 0.0.1", @@ -2660,7 +2661,7 @@ dependencies = [ name = "servo_config" version = "0.0.1" dependencies = [ - "android_injected_glue 0.2.2 (git+https://github.com/mmatyas/android-rs-injected-glue)", + "android_injected_glue 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3459,7 +3460,7 @@ dependencies = [ "checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699" "checksum alloc-no-stdlib 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b21f6ad9c9957eb5d70c3dee16d31c092b3cab339628f821766b05e6833d72b8" "checksum android_glue 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d8289e9637439939cc92b1995b0972117905be88bc28116c86b64d6e589bcd38" -"checksum android_injected_glue 0.2.2 (git+https://github.com/mmatyas/android-rs-injected-glue)" = "<none>" +"checksum android_injected_glue 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7ec08bc5e100186b5223a24dcfe5655d1488aed9eafeb44fb9a0f67a4f53d0fc" "checksum angle 0.2.0 (git+https://github.com/servo/angle?branch=servo)" = "<none>" "checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6" "checksum antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34fde25430d87a9388dadbe6e34d7f72a462c8b43ac8d309b42b0a8505d7e2a5" @@ -3647,7 +3648,7 @@ dependencies = [ "checksum ref_slice 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "825740057197b7d43025e7faf6477eaabc03434e153233da02d1f44602f71527" "checksum regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4278c17d0f6d62dfef0ab00028feb45bd7d2102843f80763474eeb1be8a10c01" "checksum regex-syntax 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9191b1f57603095f105d317e375d19b1c9c5c3185ea9633a99a6dcbed04457" -"checksum rust-webvr 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "454fc4c3a786029ab82c5528c14f01bf965f60f61b3f9b1ed51b4646223eab59" +"checksum rust-webvr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "263be07c1d462798df737e4dcc6920ac92727340b05985a0328e3a86c9592b19" "checksum rustc-demangle 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3058a43ada2c2d0b92b3ae38007a2d0fa5e9db971be260e0171408a4ff471c95" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" diff --git a/components/config/Cargo.toml b/components/config/Cargo.toml index e8668a01973..5049bb8a32d 100644 --- a/components/config/Cargo.toml +++ b/components/config/Cargo.toml @@ -29,4 +29,4 @@ env_logger = "0.4" xdg = "2.0" [target.'cfg(target_os = "android")'.dependencies] -android_injected_glue = {git = "https://github.com/mmatyas/android-rs-injected-glue"} +android_injected_glue = "0.2" diff --git a/components/script/dom/vr.rs b/components/script/dom/vr.rs index 9497405e8c9..d906d0e9964 100644 --- a/components/script/dom/vr.rs +++ b/components/script/dom/vr.rs @@ -152,6 +152,13 @@ impl VR { WebVRDisplayEvent::Change(ref display) => { let display = self.sync_display(&display); display.handle_webvr_event(&event); + }, + WebVRDisplayEvent::Pause(id) | + WebVRDisplayEvent::Resume(id) | + WebVRDisplayEvent::Exit(id) => { + if let Some(display) = self.find_display(id) { + display.handle_webvr_event(&event); + } } }; } diff --git a/components/script/dom/vrdisplay.rs b/components/script/dom/vrdisplay.rs index b9b65264c44..da5c12e8c54 100644 --- a/components/script/dom/vrdisplay.rs +++ b/components/script/dom/vrdisplay.rs @@ -71,7 +71,9 @@ pub struct VRDisplay { frame_data_status: Cell<VRFrameDataStatus>, #[ignore_heap_size_of = "channels are hard"] frame_data_receiver: DOMRefCell<Option<IpcReceiver<Result<Vec<u8>, ()>>>>, - running_display_raf: Cell<bool> + running_display_raf: Cell<bool>, + paused: Cell<bool>, + stopped_on_pause: Cell<bool>, } unsafe_no_jsmanaged_fields!(WebVRDisplayData); @@ -112,6 +114,12 @@ impl VRDisplay { frame_data_status: Cell::new(VRFrameDataStatus::Waiting), frame_data_receiver: DOMRefCell::new(None), running_display_raf: Cell::new(false), + // Some VR implementations (e.g. Daydream) can be paused in some life cycle situations + // such as showing and hiding the controller pairing screen. + paused: Cell::new(false), + // This flag is set when the Display was presenting when it received a VR Pause event. + // When the VR Resume event is received and the flag is set, VR presentation automatically restarts. + stopped_on_pause: Cell::new(false) } } @@ -428,6 +436,30 @@ impl VRDisplay { // Change event doesn't exist in WebVR spec. // So we update display data but don't notify JS. self.update_display(&display); + }, + WebVRDisplayEvent::Pause(_) => { + if self.paused.get() { + return; + } + self.paused.set(true); + if self.presenting.get() { + self.stop_present(); + self.stopped_on_pause.set(true); + } + + }, + WebVRDisplayEvent::Resume(_) => { + self.paused.set(false); + if self.stopped_on_pause.get() { + self.stopped_on_pause.set(false); + self.init_present(); + } + }, + WebVRDisplayEvent::Exit(_) => { + self.stopped_on_pause.set(false); + if self.presenting.get() { + self.stop_present(); + } } }; } diff --git a/components/script/dom/vrdisplayevent.rs b/components/script/dom/vrdisplayevent.rs index 956229ead4c..4db24687dcc 100644 --- a/components/script/dom/vrdisplayevent.rs +++ b/components/script/dom/vrdisplayevent.rs @@ -66,7 +66,12 @@ impl VRDisplayEvent { WebVRDisplayEvent::Blur(_) => ("blur", None), WebVRDisplayEvent::Focus(_) => ("focus", None), WebVRDisplayEvent::PresentChange(_, _) => ("presentchange", None), - WebVRDisplayEvent::Change(_) => panic!("VRDisplayEvent:Change event not available in WebVR") + WebVRDisplayEvent::Change(_) | + WebVRDisplayEvent::Pause(_) | + WebVRDisplayEvent::Resume(_) | + WebVRDisplayEvent::Exit(_) => { + panic!("{:?} event not available in WebVR", event) + } }; // map to JS enum values diff --git a/components/webvr_traits/Cargo.toml b/components/webvr_traits/Cargo.toml index 69ff590cbc7..2d5ae152783 100644 --- a/components/webvr_traits/Cargo.toml +++ b/components/webvr_traits/Cargo.toml @@ -12,6 +12,6 @@ path = "lib.rs" [dependencies] ipc-channel = "0.7" msg = {path = "../msg"} -rust-webvr = {version = "0.3", features = ["serde-serialization"]} +rust-webvr = {version = "0.4", features = ["serde-serialization"]} serde = "0.9" serde_derive = "0.9" diff --git a/ports/servo/Cargo.toml b/ports/servo/Cargo.toml index fb0746a9674..a25833c5bf4 100644 --- a/ports/servo/Cargo.toml +++ b/ports/servo/Cargo.toml @@ -45,4 +45,4 @@ libservo = {path = "../../components/servo"} sig = "0.1" [target.'cfg(target_os = "android")'.dependencies] -android_injected_glue = {git = "https://github.com/mmatyas/android-rs-injected-glue"} +android_injected_glue = "0.2" |