Add media (WindowGLContext) module in canvas_trait

This module adds a structure (WindowGLContext) which holds the
OpenGL parameters that are going to be used by servo-media player
to render video frames using OpenGL.

In order to fill this structure, three new methods were added to
WindowMethods trait. In this patch only the Glutin-based
implementation provides a simple boilerplate.

The WindowGLContext is created in the entry point of libservo, when
the application window is created, and later passed to the
constellation, the pipeline and to the window element in dom, thus
htmlmediaelement has a mean to obtain these parameters via its
window.
This commit is contained in:
Víctor Manuel Jáquez Leal 2019-06-18 17:45:56 +02:00 committed by Fernando Jiménez Moreno
parent e9f46f9d72
commit 9f4f9dc750
16 changed files with 133 additions and 26 deletions

View file

@ -86,6 +86,7 @@ use crate::task_source::websocket::WebsocketTaskSource;
use crate::task_source::TaskSourceName;
use crate::webdriver_handlers;
use bluetooth_traits::BluetoothRequest;
use canvas_traits::media::WindowGLContext;
use canvas_traits::webgl::WebGLPipeline;
use crossbeam_channel::{unbounded, Receiver, Sender};
use devtools_traits::CSSError;
@ -512,6 +513,8 @@ unsafe_no_jsmanaged_fields!(TaskQueue<MainThreadScriptMsg>);
unsafe_no_jsmanaged_fields!(dyn BackgroundHangMonitorRegister);
unsafe_no_jsmanaged_fields!(dyn BackgroundHangMonitor);
unsafe_no_jsmanaged_fields!(WindowGLContext);
#[derive(JSTraceable)]
// ScriptThread instances are rooted on creation, so this is okay
#[allow(unrooted_must_root)]
@ -646,7 +649,7 @@ pub struct ScriptThread {
/// The Webrender Document ID associated with this thread.
webrender_document: DocumentId,
/// FIXME(victor):
/// Webrender API sender.
webrender_api_sender: RenderApiSender,
/// Periodically print out on which events script threads spend their processing time.
@ -678,6 +681,9 @@ pub struct ScriptThread {
/// An optional string allowing the user agent to be set for testing.
user_agent: Cow<'static, str>,
/// Application window's GL Context for Media player
player_context: WindowGLContext,
}
/// In the event of thread panic, all data on the stack runs its destructor. However, there
@ -1239,6 +1245,7 @@ impl ScriptThread {
headless,
replace_surrogates,
user_agent,
player_context: state.player_context,
}
}
@ -2981,6 +2988,7 @@ impl ScriptThread {
self.headless,
self.replace_surrogates,
self.user_agent.clone(),
self.player_context.clone(),
);
// Initialize the browsing context for the window.