constellation: Make setting up the WebGL state fallible.

This fixes a regression caused by the glutin update.

We now are creating EGL contexts in Linux Wayland, instead of X context, so the
GLContextFactory assumption of one GL back-end per platform is broken.

This just works around it, for now, but in general I think not relying on
available WebGL state is a good thing, and we do that already for WebVR anyway.
This commit is contained in:
Emilio Cobos Álvarez 2018-03-09 23:27:29 +01:00
parent 3fc5bf87d3
commit 21df4014db
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
8 changed files with 48 additions and 31 deletions

View file

@ -325,7 +325,7 @@ pub struct Constellation<Message, LTF, STF> {
phantom: PhantomData<(Message, LTF, STF)>,
/// Entry point to create and get channels to a WebGLThread.
webgl_threads: WebGLThreads,
webgl_threads: Option<WebGLThreads>,
/// A channel through which messages can be sent to the webvr thread.
webvr_chan: Option<IpcSender<WebVRMsg>>,
@ -370,7 +370,7 @@ pub struct InitialConstellationState {
pub webrender_api_sender: webrender_api::RenderApiSender,
/// Entry point to create and get channels to a WebGLThread.
pub webgl_threads: WebGLThreads,
pub webgl_threads: Option<WebGLThreads>,
/// A channel to the webgl thread.
pub webvr_chan: Option<IpcSender<WebVRMsg>>,
@ -740,7 +740,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
webrender_api_sender: self.webrender_api_sender.clone(),
webrender_document: self.webrender_document,
is_private,
webgl_chan: self.webgl_threads.pipeline(),
webgl_chan: self.webgl_threads.as_ref().map(|threads| threads.pipeline()),
webvr_chan: self.webvr_chan.clone()
});
@ -1431,9 +1431,11 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
}
debug!("Exiting WebGL thread.");
if let Err(e) = self.webgl_threads.exit() {
warn!("Exit WebGL Thread failed ({})", e);
if let Some(webgl_threads) = self.webgl_threads.as_ref() {
debug!("Exiting WebGL thread.");
if let Err(e) = webgl_threads.exit() {
warn!("Exit WebGL Thread failed ({})", e);
}
}
if let Some(chan) = self.webvr_chan.as_ref() {