aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando Jiménez Moreno <ferjmoreno@gmail.com>2019-06-24 18:45:31 +0200
committerFernando Jiménez Moreno <ferjmoreno@gmail.com>2019-07-04 10:25:49 +0200
commit7d589ed4f5762ee185b60a34a76bb59cdf05a536 (patch)
tree150f559657e456b8c2b87213e8f606363618213d
parent2b3a8bf4909a5705e62ff2872253e89f2975f666 (diff)
downloadservo-7d589ed4f5762ee185b60a34a76bb59cdf05a536.tar.gz
servo-7d589ed4f5762ee185b60a34a76bb59cdf05a536.zip
Media crate
-rw-r--r--Cargo.lock21
-rw-r--r--components/canvas/lib.rs2
-rw-r--r--components/canvas/media_mode/mod.rs6
-rw-r--r--components/canvas_traits/Cargo.toml1
-rw-r--r--components/canvas_traits/lib.rs2
-rw-r--r--components/canvas_traits/media.rs94
-rw-r--r--components/constellation/Cargo.toml1
-rw-r--r--components/constellation/constellation.rs3
-rw-r--r--components/constellation/pipeline.rs2
-rw-r--r--components/media/Cargo.toml23
-rw-r--r--components/media/lib.rs (renamed from components/canvas/media_mode/inprocess.rs)97
-rw-r--r--components/media/media_channel/ipc.rs (renamed from components/canvas_traits/media_channel/ipc.rs)0
-rw-r--r--components/media/media_channel/mod.rs (renamed from components/canvas_traits/media_channel/mod.rs)2
-rw-r--r--components/media/media_channel/mpsc.rs (renamed from components/canvas_traits/media_channel/mpsc.rs)0
-rw-r--r--components/media/media_thread.rs (renamed from components/canvas/media_thread.rs)11
-rw-r--r--components/script/Cargo.toml1
-rw-r--r--components/script/dom/htmlmediaelement.rs2
-rw-r--r--components/script/dom/window.rs2
-rw-r--r--components/script/script_thread.rs2
-rw-r--r--components/script_traits/Cargo.toml1
-rw-r--r--components/script_traits/lib.rs2
-rw-r--r--components/servo/Cargo.toml1
-rw-r--r--components/servo/lib.rs4
23 files changed, 152 insertions, 128 deletions
diff --git a/Cargo.lock b/Cargo.lock
index e6f4452f7c7..864ca86d567 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -426,7 +426,6 @@ dependencies = [
"pixels 0.0.1",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "servo-media 0.1.0 (git+https://github.com/servo/media)",
"servo_config 0.0.1",
"typetag 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)",
@@ -648,6 +647,7 @@ dependencies = [
"keyboard-types 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"layout_traits 0.0.1",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "media 0.0.1",
"metrics 0.0.1",
"msg 0.0.1",
"net 0.0.1",
@@ -2518,6 +2518,7 @@ dependencies = [
"keyboard-types 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"layout_thread 0.0.1",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "media 0.0.1",
"mozangle 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
"net 0.0.1",
@@ -2711,6 +2712,22 @@ version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "media"
+version = "0.0.1"
+dependencies = [
+ "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "ipc-channel 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
+ "servo-media 0.1.0 (git+https://github.com/servo/media)",
+ "servo_config 0.0.1",
+ "webrender 0.60.0 (git+https://github.com/servo/webrender)",
+ "webrender_api 0.60.0 (git+https://github.com/servo/webrender)",
+]
+
+[[package]]
name = "memchr"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3804,6 +3821,7 @@ dependencies = [
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "media 0.0.1",
"metrics 0.0.1",
"mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
"mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3929,6 +3947,7 @@ dependencies = [
"libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "media 0.0.1",
"msg 0.0.1",
"net_traits 0.0.1",
"pixels 0.0.1",
diff --git a/components/canvas/lib.rs b/components/canvas/lib.rs
index 47628d57fbf..ba10f02636c 100644
--- a/components/canvas/lib.rs
+++ b/components/canvas/lib.rs
@@ -16,7 +16,5 @@ mod raqote_backend;
pub mod canvas_data;
pub mod canvas_paint_thread;
pub mod gl_context;
-mod media_mode;
-pub mod media_thread;
mod webgl_mode;
pub mod webgl_thread;
diff --git a/components/canvas/media_mode/mod.rs b/components/canvas/media_mode/mod.rs
deleted file mode 100644
index 7541463b2bb..00000000000
--- a/components/canvas/media_mode/mod.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-
-mod inprocess;
-pub use self::inprocess::GLPlayerThreads;
diff --git a/components/canvas_traits/Cargo.toml b/components/canvas_traits/Cargo.toml
index fabe074409c..52388be8863 100644
--- a/components/canvas_traits/Cargo.toml
+++ b/components/canvas_traits/Cargo.toml
@@ -25,7 +25,6 @@ pixels = {path = "../pixels"}
serde = "1.0"
serde_bytes = "0.10"
servo_config = {path = "../config"}
-servo-media = {git = "https://github.com/servo/media"}
typetag = "0.1"
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
webvr_traits = {path = "../webvr_traits"}
diff --git a/components/canvas_traits/lib.rs b/components/canvas_traits/lib.rs
index 15d15a6ea68..c19ca073658 100644
--- a/components/canvas_traits/lib.rs
+++ b/components/canvas_traits/lib.rs
@@ -14,8 +14,6 @@ extern crate malloc_size_of_derive;
extern crate serde;
pub mod canvas;
-pub mod media;
-mod media_channel;
#[macro_use]
pub mod webgl;
mod webgl_channel;
diff --git a/components/canvas_traits/media.rs b/components/canvas_traits/media.rs
deleted file mode 100644
index 4eac95c6290..00000000000
--- a/components/canvas_traits/media.rs
+++ /dev/null
@@ -1,94 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-
-use euclid::Size2D;
-use servo_media::player::context::{GlApi, GlContext, NativeDisplay, PlayerGLContext};
-
-/// Helper function that creates a GLPlayer channel (GLPlayerSender,
-/// GLPlayerReceiver) to be used in GLPlayerMsg.
-pub use crate::media_channel::glplayer_channel;
-/// Entry point channel type used for sending GLPlayerMsg messages to
-/// the GLPlayer thread.
-pub use crate::media_channel::GLPlayerChan;
-/// Entry point type used in a Script Pipeline to get the GLPlayerChan
-/// to be used in that thread.
-pub use crate::media_channel::GLPlayerPipeline;
-/// Receiver type used in GLPlayerMsg.
-pub use crate::media_channel::GLPlayerReceiver;
-/// Result type for send()/recv() calls in in GLPlayerMsg.
-pub use crate::media_channel::GLPlayerSendResult;
-/// Sender type used in GLPlayerMsg.
-pub use crate::media_channel::GLPlayerSender;
-
-/// These are the messages that the GLPlayer thread will forward to
-/// the video player which lives in htmlmediaelement
-#[derive(Debug, Deserialize, Serialize)]
-pub enum GLPlayerMsgForward {
- PlayerId(u64),
- Lock(GLPlayerSender<(u32, Size2D<i32>, usize)>),
- Unlock(),
-}
-
-/// GLPlayer thread Message API
-///
-/// These are the message that the thread will receive from the
-/// constellation, the webrender::ExternalImageHandle multiplexor
-/// implementation, or a htmlmediaelement
-#[derive(Debug, Deserialize, Serialize)]
-pub enum GLPlayerMsg {
- /// Registers an instantiated player in DOM
- RegisterPlayer(GLPlayerSender<GLPlayerMsgForward>),
- /// Unregisters a player's ID
- UnregisterPlayer(u64),
- /// Locks a specific texture from a player. Lock messages are used
- /// for a correct synchronization with WebRender external image
- /// API.
- ///
- /// WR locks a external texture when it wants to use the shared
- /// texture contents.
- ///
- /// The WR client should not change the shared texture content
- /// until the Unlock call.
- ///
- /// Currently OpenGL Sync Objects are used to implement the
- /// synchronization mechanism.
- Lock(u64, GLPlayerSender<(u32, Size2D<i32>, usize)>),
- /// Unlocks a specific texture from a player. Unlock messages are
- /// used for a correct synchronization with WebRender external
- /// image API.
- ///
- /// The WR unlocks a context when it finished reading the shared
- /// texture contents.
- ///
- /// Unlock messages are always sent after a Lock message.
- Unlock(u64),
- /// Frees all resources and closes the thread.
- Exit,
-}
-
-#[derive(Clone, Debug, Deserialize, Serialize)]
-pub struct WindowGLContext {
- /// Application's GL Context
- pub gl_context: GlContext,
- /// Application's GL Api
- pub gl_api: GlApi,
- /// Application's native display
- pub native_display: NativeDisplay,
- /// A channel to the GLPlayer thread.
- pub glplayer_chan: Option<GLPlayerPipeline>,
-}
-
-impl PlayerGLContext for WindowGLContext {
- fn get_gl_context(&self) -> GlContext {
- self.gl_context.clone()
- }
-
- fn get_native_display(&self) -> NativeDisplay {
- self.native_display.clone()
- }
-
- fn get_gl_api(&self) -> GlApi {
- self.gl_api.clone()
- }
-}
diff --git a/components/constellation/Cargo.toml b/components/constellation/Cargo.toml
index f91396343d8..f5270aa2d90 100644
--- a/components/constellation/Cargo.toml
+++ b/components/constellation/Cargo.toml
@@ -35,6 +35,7 @@ ipc-channel = "0.11"
layout_traits = {path = "../layout_traits"}
keyboard-types = "0.4.3"
log = "0.4"
+media = {path = "../media"}
metrics = {path = "../metrics"}
msg = {path = "../msg"}
net = {path = "../net"}
diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs
index b2a6729e681..1d6bef75b4e 100644
--- a/components/constellation/constellation.rs
+++ b/components/constellation/constellation.rs
@@ -104,11 +104,9 @@ 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;
-use canvas_traits::media::WindowGLContext;
use compositing::compositor_thread::CompositorProxy;
use compositing::compositor_thread::Msg as ToCompositorMsg;
use compositing::SendableFrameTree;
@@ -125,6 +123,7 @@ use keyboard_types::webdriver::Event as WebDriverInputEvent;
use keyboard_types::KeyboardEvent;
use layout_traits::LayoutThreadFactory;
use log::{Level, LevelFilter, Log, Metadata, Record};
+use media::{GLPlayerThreads, WindowGLContext};
use msg::constellation_msg::{BackgroundHangMonitorRegister, HangMonitorAlert, SamplerControlMsg};
use msg::constellation_msg::{
BrowsingContextGroupId, BrowsingContextId, HistoryStateId, PipelineId,
diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs
index 049ac82b035..07df7a4b2c9 100644
--- a/components/constellation/pipeline.rs
+++ b/components/constellation/pipeline.rs
@@ -5,7 +5,6 @@
use crate::event_loop::EventLoop;
use background_hang_monitor::HangMonitorRegister;
use bluetooth_traits::BluetoothRequest;
-use canvas_traits::media::WindowGLContext;
use canvas_traits::webgl::WebGLPipeline;
use compositing::compositor_thread::Msg as CompositorMsg;
use compositing::CompositionPipeline;
@@ -18,6 +17,7 @@ use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use ipc_channel::Error;
use layout_traits::LayoutThreadFactory;
+use media::WindowGLContext;
use metrics::PaintTimeMetrics;
use msg::constellation_msg::TopLevelBrowsingContextId;
use msg::constellation_msg::{BackgroundHangMonitorRegister, HangMonitorAlert, SamplerControlMsg};
diff --git a/components/media/Cargo.toml b/components/media/Cargo.toml
new file mode 100644
index 00000000000..53f531a26cf
--- /dev/null
+++ b/components/media/Cargo.toml
@@ -0,0 +1,23 @@
+[package]
+name = "media"
+version = "0.0.1"
+authors = ["The Servo Project Developers"]
+license = "MPL-2.0"
+edition = "2018"
+publish = false
+
+[lib]
+name = "media"
+path = "lib.rs"
+
+[dependencies]
+euclid = "0.19"
+fnv = "1.0"
+ipc-channel = "0.11"
+lazy_static = "1"
+log = "0.4"
+serde = "1.0"
+servo_config = {path = "../config"}
+servo-media = {git = "https://github.com/servo/media"}
+webrender = {git = "https://github.com/servo/webrender"}
+webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
diff --git a/components/canvas/media_mode/inprocess.rs b/components/media/lib.rs
index 86ce201020b..c98d97df597 100644
--- a/components/canvas/media_mode/inprocess.rs
+++ b/components/media/lib.rs
@@ -2,12 +2,99 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::media_thread::{GLPlayerExternalImageApi, GLPlayerExternalImageHandler, GLPlayerThread};
-use canvas_traits::media::glplayer_channel;
-use canvas_traits::media::{
- GLPlayerChan, GLPlayerMsg, GLPlayerPipeline, GLPlayerReceiver, GLPlayerSender,
-};
+#![crate_name = "media"]
+#![crate_type = "rlib"]
+#![deny(unsafe_code)]
+
+#[macro_use]
+extern crate lazy_static;
+#[macro_use]
+extern crate log;
+#[macro_use]
+extern crate serde;
+
use euclid::Size2D;
+use servo_media::player::context::{GlApi, GlContext, NativeDisplay, PlayerGLContext};
+
+mod media_channel;
+mod media_thread;
+
+pub use crate::media_channel::glplayer_channel;
+
+use crate::media_channel::{GLPlayerChan, GLPlayerPipeline, GLPlayerReceiver, GLPlayerSender};
+use crate::media_thread::{GLPlayerExternalImageApi, GLPlayerExternalImageHandler, GLPlayerThread};
+
+/// These are the messages that the GLPlayer thread will forward to
+/// the video player which lives in htmlmediaelement
+#[derive(Debug, Deserialize, Serialize)]
+pub enum GLPlayerMsgForward {
+ PlayerId(u64),
+ Lock(GLPlayerSender<(u32, Size2D<i32>, usize)>),
+ Unlock(),
+}
+
+/// GLPlayer thread Message API
+///
+/// These are the message that the thread will receive from the
+/// constellation, the webrender::ExternalImageHandle multiplexor
+/// implementation, or a htmlmediaelement
+#[derive(Debug, Deserialize, Serialize)]
+pub enum GLPlayerMsg {
+ /// Registers an instantiated player in DOM
+ RegisterPlayer(GLPlayerSender<GLPlayerMsgForward>),
+ /// Unregisters a player's ID
+ UnregisterPlayer(u64),
+ /// Locks a specific texture from a player. Lock messages are used
+ /// for a correct synchronization with WebRender external image
+ /// API.
+ ///
+ /// WR locks a external texture when it wants to use the shared
+ /// texture contents.
+ ///
+ /// The WR client should not change the shared texture content
+ /// until the Unlock call.
+ ///
+ /// Currently OpenGL Sync Objects are used to implement the
+ /// synchronization mechanism.
+ Lock(u64, GLPlayerSender<(u32, Size2D<i32>, usize)>),
+ /// Unlocks a specific texture from a player. Unlock messages are
+ /// used for a correct synchronization with WebRender external
+ /// image API.
+ ///
+ /// The WR unlocks a context when it finished reading the shared
+ /// texture contents.
+ ///
+ /// Unlock messages are always sent after a Lock message.
+ Unlock(u64),
+ /// Frees all resources and closes the thread.
+ Exit,
+}
+
+#[derive(Clone, Debug, Deserialize, Serialize)]
+pub struct WindowGLContext {
+ /// Application's GL Context
+ pub gl_context: GlContext,
+ /// Application's GL Api
+ pub gl_api: GlApi,
+ /// Application's native display
+ pub native_display: NativeDisplay,
+ /// A channel to the GLPlayer thread.
+ pub glplayer_chan: Option<GLPlayerPipeline>,
+}
+
+impl PlayerGLContext for WindowGLContext {
+ fn get_gl_context(&self) -> GlContext {
+ self.gl_context.clone()
+ }
+
+ fn get_native_display(&self) -> NativeDisplay {
+ self.native_display.clone()
+ }
+
+ fn get_gl_api(&self) -> GlApi {
+ self.gl_api.clone()
+ }
+}
/// GLPlayer Threading API entry point that lives in the constellation.
pub struct GLPlayerThreads(GLPlayerSender<GLPlayerMsg>);
diff --git a/components/canvas_traits/media_channel/ipc.rs b/components/media/media_channel/ipc.rs
index 67548a8ddce..67548a8ddce 100644
--- a/components/canvas_traits/media_channel/ipc.rs
+++ b/components/media/media_channel/ipc.rs
diff --git a/components/canvas_traits/media_channel/mod.rs b/components/media/media_channel/mod.rs
index 6ce9a867598..5616a8479fd 100644
--- a/components/canvas_traits/media_channel/mod.rs
+++ b/components/media/media_channel/mod.rs
@@ -7,7 +7,7 @@
mod ipc;
mod mpsc;
-use crate::media::GLPlayerMsg;
+use crate::GLPlayerMsg;
use serde::{Deserialize, Serialize};
use servo_config::opts;
use std::fmt;
diff --git a/components/canvas_traits/media_channel/mpsc.rs b/components/media/media_channel/mpsc.rs
index 7d6a396185a..7d6a396185a 100644
--- a/components/canvas_traits/media_channel/mpsc.rs
+++ b/components/media/media_channel/mpsc.rs
diff --git a/components/canvas/media_thread.rs b/components/media/media_thread.rs
index c8a104a4658..e47e7c799f9 100644
--- a/components/canvas/media_thread.rs
+++ b/components/media/media_thread.rs
@@ -2,17 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use canvas_traits::media::*;
+use crate::media_channel::{glplayer_channel, GLPlayerSender};
+/// GL player threading API entry point that lives in the
+/// constellation.
+use crate::{GLPlayerMsg, GLPlayerMsgForward};
use euclid::Size2D;
use fnv::FnvHashMap;
use std::thread;
-/// GL player threading API entry point that lives in the
-/// constellation.
-///
-/// It allows to get a GLPlayerThead handle for each script pipeline.
-pub use crate::media_mode::GLPlayerThreads;
-
/// A GLPlayerThrx1ead manages the life cycle and message multiplexign of
/// a set of video players with GL render.
pub struct GLPlayerThread {
diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml
index fd270a74fc8..e0f11c85434 100644
--- a/components/script/Cargo.toml
+++ b/components/script/Cargo.toml
@@ -70,6 +70,7 @@ libc = "0.2"
log = "0.4"
malloc_size_of = { path = "../malloc_size_of" }
malloc_size_of_derive = "0.1"
+media = {path = "../media"}
metrics = {path = "../metrics"}
mitochondria = "1.1.2"
mime = "0.3.13"
diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs
index abd6613f340..6b1191d6373 100644
--- a/components/script/dom/htmlmediaelement.rs
+++ b/components/script/dom/htmlmediaelement.rs
@@ -58,7 +58,6 @@ use crate::microtask::{Microtask, MicrotaskRunnable};
use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener};
use crate::script_thread::ScriptThread;
use crate::task_source::TaskSource;
-use canvas_traits::media::*;
use dom_struct::dom_struct;
use euclid::Size2D;
use headers::{ContentLength, ContentRange, HeaderMapExt};
@@ -66,6 +65,7 @@ use html5ever::{LocalName, Prefix};
use http::header::{self, HeaderMap, HeaderValue};
use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
+use media::{glplayer_channel, GLPlayerMsg, GLPlayerMsgForward};
use net_traits::image::base::Image;
use net_traits::image_cache::ImageResponse;
use net_traits::request::{CredentialsMode, Destination, Referrer, RequestBuilder, RequestMode};
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index b834ebc8d6e..c5866bc5e6b 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -68,7 +68,6 @@ use crate::webdriver_handlers::jsval_to_webdriver;
use app_units::Au;
use base64;
use bluetooth_traits::BluetoothRequest;
-use canvas_traits::media::WindowGLContext;
use canvas_traits::webgl::WebGLChan;
use crossbeam_channel::{unbounded, Sender, TryRecvError};
use cssparser::{Parser, ParserInput, SourceLocation};
@@ -86,6 +85,7 @@ use js::jsval::JSVal;
use js::jsval::UndefinedValue;
use js::rust::wrappers::JS_DefineProperty;
use js::rust::HandleValue;
+use media::WindowGLContext;
use msg::constellation_msg::PipelineId;
use net_traits::image_cache::{ImageCache, ImageResponder, ImageResponse};
use net_traits::image_cache::{PendingImageId, PendingImageResponse};
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 6e72e8f0e9e..fc9498a8ebb 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -86,7 +86,6 @@ 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;
@@ -104,6 +103,7 @@ use js::jsapi::{JSContext, JS_SetWrapObjectCallbacks};
use js::jsapi::{JSTracer, SetWindowProxyClass};
use js::jsval::UndefinedValue;
use js::rust::ParentRuntime;
+use media::WindowGLContext;
use metrics::{PaintTimeMetrics, MAX_TASK_NS};
use mime::{self, Mime};
use msg::constellation_msg::{
diff --git a/components/script_traits/Cargo.toml b/components/script_traits/Cargo.toml
index 20f58e6bb27..5cc35639ae0 100644
--- a/components/script_traits/Cargo.toml
+++ b/components/script_traits/Cargo.toml
@@ -27,6 +27,7 @@ keyboard-types = "0.4.3"
libc = "0.2"
malloc_size_of = { path = "../malloc_size_of" }
malloc_size_of_derive = "0.1"
+media = {path = "../media"}
msg = {path = "../msg"}
net_traits = {path = "../net_traits"}
pixels = {path = "../pixels"}
diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs
index 8a7dd06e025..4b87a104a4d 100644
--- a/components/script_traits/lib.rs
+++ b/components/script_traits/lib.rs
@@ -21,7 +21,6 @@ pub mod webdriver_msg;
use crate::webdriver_msg::{LoadStatus, WebDriverScriptCommand};
use bluetooth_traits::BluetoothRequest;
-use canvas_traits::media::WindowGLContext;
use canvas_traits::webgl::WebGLPipeline;
use crossbeam_channel::{Receiver, RecvTimeoutError, Sender};
use devtools_traits::{DevtoolScriptControlMsg, ScriptToDevtoolsControlMsg, WorkerId};
@@ -35,6 +34,7 @@ use ipc_channel::Error as IpcError;
use keyboard_types::webdriver::Event as WebDriverInputEvent;
use keyboard_types::{CompositionEvent, KeyboardEvent};
use libc::c_void;
+use media::WindowGLContext;
use msg::constellation_msg::BackgroundHangMonitorRegister;
use msg::constellation_msg::{BrowsingContextId, HistoryStateId, PipelineId};
use msg::constellation_msg::{PipelineNamespaceId, TopLevelBrowsingContextId, TraversalDirection};
diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml
index d64ab06149a..10ad4319651 100644
--- a/components/servo/Cargo.toml
+++ b/components/servo/Cargo.toml
@@ -55,6 +55,7 @@ ipc-channel = "0.11"
keyboard-types = "0.4"
layout_thread = {path = "../layout_thread"}
log = "0.4"
+media = {path = "../media"}
msg = {path = "../msg"}
net = {path = "../net"}
net_traits = {path = "../net_traits"}
diff --git a/components/servo/lib.rs b/components/servo/lib.rs
index 9917c8bea9a..1496e1ce054 100644
--- a/components/servo/lib.rs
+++ b/components/servo/lib.rs
@@ -35,6 +35,7 @@ pub use euclid;
pub use gfx;
pub use ipc_channel;
pub use layout_thread;
+pub use media;
pub use msg;
pub use net;
pub use net_traits;
@@ -63,9 +64,7 @@ fn webdriver(_port: u16, _constellation: Sender<ConstellationMsg>) {}
use bluetooth::BluetoothThreadFactory;
use bluetooth_traits::BluetoothRequest;
use canvas::gl_context::GLContextFactory;
-use canvas::media_thread::GLPlayerThreads;
use canvas::webgl_thread::WebGLThreads;
-use canvas_traits::media::WindowGLContext;
use compositing::compositor_thread::{
CompositorProxy, CompositorReceiver, InitialCompositorState, Msg,
};
@@ -95,6 +94,7 @@ use gaol::sandbox::{ChildSandbox, ChildSandboxMethods};
use gfx::font_cache_thread::FontCacheThread;
use ipc_channel::ipc::{self, IpcSender};
use log::{Log, Metadata, Record};
+use media::{GLPlayerThreads, WindowGLContext};
use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId};
use net::resource_thread::new_resource_threads;
use net_traits::IpcSend;