Pass GLPlayerThreads to constellation

Create the thread only if the GL context is known.
This commit is contained in:
Víctor Manuel Jáquez Leal 2019-06-11 20:19:15 +02:00 committed by Fernando Jiménez Moreno
parent 43467b4290
commit dd01728d53
3 changed files with 28 additions and 1 deletions

View file

@ -104,6 +104,7 @@ use background_hang_monitor::HangMonitorRegister;
use backtrace::Backtrace;
use bluetooth_traits::BluetoothRequest;
use canvas::canvas_paint_thread::CanvasPaintThread;
use canvas::media_thread::GLPlayerThreads;
use canvas::webgl_thread::WebGLThreads;
use canvas_traits::canvas::CanvasId;
use canvas_traits::canvas::CanvasMsg;
@ -411,6 +412,9 @@ pub struct Constellation<Message, LTF, STF> {
/// results are required.
enable_canvas_antialiasing: bool,
/// Entry point to create and get channels to a GLPlayerThread.
glplayer_threads: Option<GLPlayerThreads>,
/// Application window's GL Context for Media player
player_context: WindowGLContext,
}
@ -461,6 +465,8 @@ pub struct InitialConstellationState {
/// The XR device registry
pub webxr_registry: webxr_api::Registry,
pub glplayer_threads: Option<GLPlayerThreads>,
/// Application window's GL Context for Media player
pub player_context: WindowGLContext,
@ -760,6 +766,7 @@ where
is_running_problem_test,
hard_fail,
enable_canvas_antialiasing,
glplayer_threads: state.glplayer_threads,
player_context: state.player_context,
};
@ -1804,6 +1811,13 @@ where
}
}
debug!("Exiting GLPlayer thread.");
if let Some(glplayer_threads) = self.glplayer_threads.as_ref() {
if let Err(e) = glplayer_threads.exit() {
warn!("Exit GLPlayer Thread failed ({})", e);
}
}
debug!("Exiting timer scheduler.");
if let Err(e) = self.scheduler_chan.send(TimerSchedulerMsg::Exit) {
warn!("Exit timer scheduler failed ({})", e);