script: Make most of 2D canvas and WebGL run over IPC.

To actually make the multiprocess communication work, we'll need to
reroute the task creation to the pipeline or the compositor. But this
works as a first step.
This commit is contained in:
Patrick Walton 2015-07-13 17:02:35 -07:00
parent 886c08c393
commit bb99b2f3c8
39 changed files with 694 additions and 365 deletions

View file

@ -30,9 +30,13 @@ features = ["texture_surface"]
[dependencies.ipc-channel]
git = "https://github.com/pcwalton/ipc-channel"
[dependencies.cssparser]
version = "0.3"
features = [ "serde-serialization" ]
[dependencies]
log = "0.3"
cssparser = "0.3.1"
num = "0.1.24"
gleam = "0.1"
euclid = "0.1"

View file

@ -11,6 +11,8 @@ use euclid::matrix2d::Matrix2D;
use euclid::point::Point2D;
use euclid::rect::Rect;
use euclid::size::Size2D;
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER;
use layers::platform::surface::NativeSurface;
use gfx_traits::color;
use ipc_channel::ipc::IpcSharedMemory;
@ -161,13 +163,19 @@ impl<'a> CanvasPaintTask<'a> {
}
}
pub fn start(size: Size2D<i32>) -> Sender<CanvasMsg> {
let (chan, port) = channel::<CanvasMsg>();
/// Creates a new `CanvasPaintTask` and returns the out-of-process sender and the in-process
/// sender for it.
pub fn start(size: Size2D<i32>) -> (IpcSender<CanvasMsg>, Sender<CanvasMsg>) {
// TODO(pcwalton): Ask the pipeline to create this for us instead of spawning it directly.
// This will be needed for multiprocess Servo.
let (out_of_process_chan, out_of_process_port) = ipc::channel::<CanvasMsg>().unwrap();
let (in_process_chan, in_process_port) = channel();
ROUTER.route_ipc_receiver_to_mpsc_sender(out_of_process_port, in_process_chan.clone());
spawn_named("CanvasTask".to_owned(), move || {
let mut painter = CanvasPaintTask::new(size);
loop {
match port.recv().unwrap() {
let msg = in_process_port.recv();
match msg.unwrap() {
CanvasMsg::Canvas2d(message) => {
match message {
Canvas2dMsg::FillRect(ref rect) => painter.fill_rect(rect),
@ -225,17 +233,28 @@ impl<'a> CanvasPaintTask<'a> {
match message {
CanvasCommonMsg::Close => break,
CanvasCommonMsg::Recreate(size) => painter.recreate(size),
CanvasCommonMsg::SendPixelContents(chan) =>
painter.send_pixel_contents(chan),
CanvasCommonMsg::SendNativeSurface(chan) =>
painter.send_native_surface(chan),
}
},
CanvasMsg::FromLayout(message) => {
match message {
FromLayoutMsg::SendPixelContents(chan) => {
painter.send_pixel_contents(chan)
}
}
}
CanvasMsg::FromPaint(message) => {
match message {
FromPaintMsg::SendNativeSurface(chan) => {
painter.send_native_surface(chan)
}
}
}
CanvasMsg::WebGL(_) => panic!("Wrong message sent to Canvas2D task"),
}
}
});
chan
(out_of_process_chan, in_process_chan)
}
fn save_context_state(&mut self) {
@ -516,7 +535,7 @@ impl<'a> CanvasPaintTask<'a> {
self.drawtarget = CanvasPaintTask::create(size);
}
fn send_pixel_contents(&mut self, chan: Sender<IpcSharedMemory>) {
fn send_pixel_contents(&mut self, chan: IpcSender<IpcSharedMemory>) {
self.drawtarget.snapshot().get_data_surface().with_data(|element| {
chan.send(IpcSharedMemory::from_bytes(element)).unwrap();
})
@ -528,7 +547,10 @@ impl<'a> CanvasPaintTask<'a> {
unimplemented!()
}
fn get_image_data(&self, mut dest_rect: Rect<f64>, canvas_size: Size2D<f64>, chan: Sender<Vec<u8>>) {
fn get_image_data(&self,
mut dest_rect: Rect<f64>,
canvas_size: Size2D<f64>,
chan: IpcSender<Vec<u8>>) {
if dest_rect.size.width < 0.0 {
dest_rect.size.width = -dest_rect.size.width;
dest_rect.origin.x -= dest_rect.size.width;

View file

@ -13,12 +13,12 @@ extern crate azure;
extern crate cssparser;
extern crate euclid;
extern crate gfx_traits;
extern crate ipc_channel;
extern crate util;
extern crate gleam;
extern crate num;
extern crate layers;
extern crate offscreen_gl_context;
extern crate ipc_channel;
#[macro_use]
extern crate log;

View file

@ -2,7 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use canvas_traits::{CanvasMsg, CanvasWebGLMsg, CanvasCommonMsg, WebGLShaderParameter, WebGLFramebufferBindingRequest};
use canvas_traits::{CanvasMsg, CanvasWebGLMsg, CanvasCommonMsg, FromLayoutMsg, FromPaintMsg};
use canvas_traits::{WebGLShaderParameter, WebGLFramebufferBindingRequest};
use euclid::size::Size2D;
use core::nonzero::NonZero;
use gleam::gl;
@ -16,7 +17,8 @@ use std::sync::mpsc::{channel, Sender};
use util::vec::byte_swap;
use layers::platform::surface::NativeSurface;
use offscreen_gl_context::{GLContext, GLContextAttributes, ColorAttachmentType};
use ipc_channel::ipc::IpcSharedMemory;
use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory};
use ipc_channel::router::ROUTER;
pub struct WebGLPaintTask {
size: Size2D<i32>,
@ -135,45 +137,58 @@ impl WebGLPaintTask {
}
}
pub fn start(size: Size2D<i32>, attrs: GLContextAttributes) -> Result<Sender<CanvasMsg>, &'static str> {
let (chan, port) = channel::<CanvasMsg>();
/// Creates a new `WebGLPaintTask` and returns the out-of-process sender and the in-process
/// sender for it.
pub fn start(size: Size2D<i32>, attrs: GLContextAttributes)
-> Result<(IpcSender<CanvasMsg>, Sender<CanvasMsg>), &'static str> {
let (out_of_process_chan, out_of_process_port) = ipc::channel::<CanvasMsg>().unwrap();
let (in_process_chan, in_process_port) = channel();
ROUTER.route_ipc_receiver_to_mpsc_sender(out_of_process_port, in_process_chan.clone());
let mut painter = try!(WebGLPaintTask::new(size, attrs));
spawn_named("WebGLTask".to_owned(), move || {
painter.init();
loop {
match port.recv().unwrap() {
match in_process_port.recv().unwrap() {
CanvasMsg::WebGL(message) => painter.handle_webgl_message(message),
CanvasMsg::Common(message) => {
match message {
CanvasCommonMsg::Close => break,
CanvasCommonMsg::SendPixelContents(chan) =>
painter.send_pixel_contents(chan),
CanvasCommonMsg::SendNativeSurface(chan) =>
painter.send_native_surface(chan),
// TODO(ecoal95): handle error nicely
CanvasCommonMsg::Recreate(size) => painter.recreate(size).unwrap(),
}
},
CanvasMsg::FromLayout(message) => {
match message {
FromLayoutMsg::SendPixelContents(chan) =>
painter.send_pixel_contents(chan),
}
}
CanvasMsg::FromPaint(message) => {
match message {
FromPaintMsg::SendNativeSurface(chan) =>
painter.send_native_surface(chan),
}
}
CanvasMsg::Canvas2d(_) => panic!("Wrong message sent to WebGLTask"),
}
}
});
Ok(chan)
Ok((out_of_process_chan, in_process_chan))
}
#[inline]
fn get_context_attributes(&self, sender: Sender<GLContextAttributes>) {
fn get_context_attributes(&self, sender: IpcSender<GLContextAttributes>) {
sender.send(*self.gl_context.borrow_attributes()).unwrap()
}
#[inline]
fn send_drawing_buffer_width(&self, sender: Sender<i32>) {
fn send_drawing_buffer_width(&self, sender: IpcSender<i32>) {
sender.send(self.size.width).unwrap()
}
#[inline]
fn send_drawing_buffer_height(&self, sender: Sender<i32>) {
fn send_drawing_buffer_height(&self, sender: IpcSender<i32>) {
sender.send(self.size.height).unwrap()
}
@ -234,7 +249,7 @@ impl WebGLPaintTask {
gl::clear_color(r, g, b, a);
}
fn create_buffer(&self, chan: Sender<Option<NonZero<u32>>>) {
fn create_buffer(&self, chan: IpcSender<Option<NonZero<u32>>>) {
let buffer = gl::gen_buffers(1)[0];
let buffer = if buffer == 0 {
None
@ -244,7 +259,7 @@ impl WebGLPaintTask {
chan.send(buffer).unwrap();
}
fn create_framebuffer(&self, chan: Sender<Option<NonZero<u32>>>) {
fn create_framebuffer(&self, chan: IpcSender<Option<NonZero<u32>>>) {
let framebuffer = gl::gen_framebuffers(1)[0];
let framebuffer = if framebuffer == 0 {
None
@ -254,7 +269,7 @@ impl WebGLPaintTask {
chan.send(framebuffer).unwrap();
}
fn create_renderbuffer(&self, chan: Sender<Option<NonZero<u32>>>) {
fn create_renderbuffer(&self, chan: IpcSender<Option<NonZero<u32>>>) {
let renderbuffer = gl::gen_renderbuffers(1)[0];
let renderbuffer = if renderbuffer == 0 {
None
@ -264,7 +279,7 @@ impl WebGLPaintTask {
chan.send(renderbuffer).unwrap();
}
fn create_texture(&self, chan: Sender<Option<NonZero<u32>>>) {
fn create_texture(&self, chan: IpcSender<Option<NonZero<u32>>>) {
let texture = gl::gen_framebuffers(1)[0];
let texture = if texture == 0 {
None
@ -274,7 +289,7 @@ impl WebGLPaintTask {
chan.send(texture).unwrap();
}
fn create_program(&self, chan: Sender<Option<NonZero<u32>>>) {
fn create_program(&self, chan: IpcSender<Option<NonZero<u32>>>) {
let program = gl::create_program();
let program = if program == 0 {
None
@ -284,7 +299,7 @@ impl WebGLPaintTask {
chan.send(program).unwrap();
}
fn create_shader(&self, shader_type: u32, chan: Sender<Option<NonZero<u32>>>) {
fn create_shader(&self, shader_type: u32, chan: IpcSender<Option<NonZero<u32>>>) {
let shader = gl::create_shader(shader_type);
let shader = if shader == 0 {
None
@ -368,7 +383,7 @@ impl WebGLPaintTask {
gl::enable_vertex_attrib_array(attrib_id);
}
fn get_attrib_location(&self, program_id: u32, name: String, chan: Sender<Option<i32>> ) {
fn get_attrib_location(&self, program_id: u32, name: String, chan: IpcSender<Option<i32>> ) {
let attrib_location = gl::get_attrib_location(program_id, &name);
let attrib_location = if attrib_location == -1 {
@ -380,14 +395,17 @@ impl WebGLPaintTask {
chan.send(attrib_location).unwrap();
}
fn get_shader_info_log(&self, shader_id: u32, chan: Sender<Option<String>>) {
fn get_shader_info_log(&self, shader_id: u32, chan: IpcSender<Option<String>>) {
// TODO(ecoal95): Right now we always return a value, we should
// check for gl errors and return None there
let info = gl::get_shader_info_log(shader_id);
chan.send(Some(info)).unwrap();
}
fn get_shader_parameter(&self, shader_id: u32, param_id: u32, chan: Sender<WebGLShaderParameter>) {
fn get_shader_parameter(&self,
shader_id: u32,
param_id: u32,
chan: IpcSender<WebGLShaderParameter>) {
let result = match param_id {
gl::SHADER_TYPE =>
WebGLShaderParameter::Int(gl::get_shader_iv(shader_id, param_id)),
@ -399,7 +417,7 @@ impl WebGLPaintTask {
chan.send(result).unwrap();
}
fn get_uniform_location(&self, program_id: u32, name: String, chan: Sender<Option<i32>>) {
fn get_uniform_location(&self, program_id: u32, name: String, chan: IpcSender<Option<i32>>) {
let location = gl::get_uniform_location(program_id, &name);
let location = if location == -1 {
None
@ -441,7 +459,7 @@ impl WebGLPaintTask {
gl::viewport(x, y, width, height);
}
fn send_pixel_contents(&mut self, chan: Sender<IpcSharedMemory>) {
fn send_pixel_contents(&mut self, chan: IpcSender<IpcSharedMemory>) {
// FIXME(#5652, dmarcos) Instead of a readback strategy we have
// to layerize the canvas.
// TODO(pcwalton): We'd save a copy if we had an `IpcSharedMemoryBuilder` abstraction that

View file

@ -22,6 +22,15 @@ git = "https://github.com/ecoal95/rust-offscreen-rendering-context"
[dependencies.ipc-channel]
git = "https://github.com/pcwalton/ipc-channel"
[dependencies.serde]
version = "0.4"
features = [ "nightly" ]
[dependencies.cssparser]
version = "0.3"
features = [ "serde-serialization" ]
[dependencies]
cssparser = "0.3.1"
euclid = "0.1"
serde_macros = "0.4"

View file

@ -5,7 +5,11 @@
#![crate_name = "canvas_traits"]
#![crate_type = "rlib"]
#![feature(core)]
#![feature(custom_derive)]
#![feature(nonzero)]
#![feature(plugin)]
#![plugin(serde_macros)]
extern crate core;
extern crate azure;
extern crate euclid;
@ -14,6 +18,7 @@ extern crate gfx_traits;
extern crate ipc_channel;
extern crate layers;
extern crate offscreen_gl_context;
extern crate serde;
use azure::azure::{AzFloat, AzColor};
use azure::azure_hl::{DrawTarget, Pattern, ColorPattern};
@ -26,28 +31,51 @@ use euclid::point::Point2D;
use euclid::rect::Rect;
use euclid::size::Size2D;
use gfx_traits::color;
use std::sync::mpsc::{Sender};
use ipc_channel::ipc::{IpcSender, IpcSharedMemory};
use std::sync::mpsc::Sender;
use layers::platform::surface::NativeSurface;
use offscreen_gl_context::GLContextAttributes;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use core::nonzero::NonZero;
use ipc_channel::ipc::IpcSharedMemory;
#[derive(Clone)]
#[derive(Clone, Deserialize, Serialize)]
pub enum CanvasMsg {
Canvas2d(Canvas2dMsg),
Common(CanvasCommonMsg),
FromLayout(FromLayoutMsg),
FromPaint(FromPaintMsg),
WebGL(CanvasWebGLMsg),
}
#[derive(Clone)]
#[derive(Clone, Deserialize, Serialize)]
pub enum CanvasCommonMsg {
Close,
Recreate(Size2D<i32>),
SendPixelContents(Sender<IpcSharedMemory>),
SendNativeSurface(Sender<NativeSurface>),
}
#[derive(Clone, Deserialize, Serialize)]
pub enum FromLayoutMsg {
SendPixelContents(IpcSender<IpcSharedMemory>),
}
#[derive(Clone)]
pub enum FromPaintMsg {
SendNativeSurface(Sender<NativeSurface>),
}
impl Serialize for FromPaintMsg {
fn serialize<S>(&self, _: &mut S) -> Result<(),S::Error> where S: Serializer {
panic!("can't serialize a `FromPaintMsg`!")
}
}
impl Deserialize for FromPaintMsg {
fn deserialize<D>(_: &mut D) -> Result<FromPaintMsg,D::Error> where D: Deserializer {
panic!("can't deserialize a `FromPaintMsg`!")
}
}
#[derive(Clone, Deserialize, Serialize)]
pub enum Canvas2dMsg {
Arc(Point2D<f32>, f32, f32, f32, bool),
ArcTo(Point2D<f32>, Point2D<f32>, f32),
@ -60,7 +88,7 @@ pub enum Canvas2dMsg {
ClosePath,
Fill,
FillRect(Rect<f32>),
GetImageData(Rect<f64>, Size2D<f64>, Sender<Vec<u8>>),
GetImageData(Rect<f64>, Size2D<f64>, IpcSender<Vec<u8>>),
LineTo(Point2D<f32>),
MoveTo(Point2D<f32>),
PutImageData(Vec<u8>, Rect<f64>, Option<Rect<f64>>),
@ -85,9 +113,9 @@ pub enum Canvas2dMsg {
SetShadowColor(RGBA),
}
#[derive(Clone)]
#[derive(Clone, Deserialize, Serialize)]
pub enum CanvasWebGLMsg {
GetContextAttributes(Sender<GLContextAttributes>),
GetContextAttributes(IpcSender<GLContextAttributes>),
ActiveTexture(u32),
BlendColor(f32, f32, f32, f32),
BlendEquation(u32),
@ -99,12 +127,12 @@ pub enum CanvasWebGLMsg {
Clear(u32),
ClearColor(f32, f32, f32, f32),
CompileShader(u32),
CreateBuffer(Sender<Option<NonZero<u32>>>),
CreateFramebuffer(Sender<Option<NonZero<u32>>>),
CreateRenderbuffer(Sender<Option<NonZero<u32>>>),
CreateTexture(Sender<Option<NonZero<u32>>>),
CreateProgram(Sender<Option<NonZero<u32>>>),
CreateShader(u32, Sender<Option<NonZero<u32>>>),
CreateBuffer(IpcSender<Option<NonZero<u32>>>),
CreateFramebuffer(IpcSender<Option<NonZero<u32>>>),
CreateRenderbuffer(IpcSender<Option<NonZero<u32>>>),
CreateTexture(IpcSender<Option<NonZero<u32>>>),
CreateProgram(IpcSender<Option<NonZero<u32>>>),
CreateShader(u32, IpcSender<Option<NonZero<u32>>>),
DeleteBuffer(u32),
DeleteFramebuffer(u32),
DeleteRenderbuffer(u32),
@ -117,21 +145,21 @@ pub enum CanvasWebGLMsg {
BindTexture(u32, u32),
DrawArrays(u32, i32, i32),
EnableVertexAttribArray(u32),
GetShaderInfoLog(u32, Sender<Option<String>>),
GetShaderParameter(u32, u32, Sender<WebGLShaderParameter>),
GetAttribLocation(u32, String, Sender<Option<i32>>),
GetUniformLocation(u32, String, Sender<Option<i32>>),
GetShaderInfoLog(u32, IpcSender<Option<String>>),
GetShaderParameter(u32, u32, IpcSender<WebGLShaderParameter>),
GetAttribLocation(u32, String, IpcSender<Option<i32>>),
GetUniformLocation(u32, String, IpcSender<Option<i32>>),
LinkProgram(u32),
ShaderSource(u32, String),
Uniform4fv(i32, Vec<f32>),
UseProgram(u32),
VertexAttribPointer2f(u32, i32, bool, i32, i64),
Viewport(i32, i32, i32, i32),
DrawingBufferWidth(Sender<i32>),
DrawingBufferHeight(Sender<i32>),
DrawingBufferWidth(IpcSender<i32>),
DrawingBufferHeight(IpcSender<i32>),
}
#[derive(Clone, Copy, PartialEq)]
#[derive(Clone, Copy, PartialEq, Deserialize, Serialize)]
pub enum WebGLError {
InvalidEnum,
InvalidOperation,
@ -142,26 +170,26 @@ pub enum WebGLError {
pub type WebGLResult<T> = Result<T, WebGLError>;
#[derive(Clone)]
#[derive(Clone, Deserialize, Serialize)]
pub enum WebGLFramebufferBindingRequest {
Explicit(u32),
Default,
}
#[derive(Clone)]
#[derive(Clone, Deserialize, Serialize)]
pub enum WebGLShaderParameter {
Int(i32),
Bool(bool),
Invalid,
}
#[derive(Clone)]
#[derive(Clone, Deserialize, Serialize)]
pub struct CanvasGradientStop {
pub offset: f64,
pub color: RGBA,
}
#[derive(Clone)]
#[derive(Clone, Deserialize, Serialize)]
pub struct LinearGradientStyle {
pub x0: f64,
pub y0: f64,
@ -183,7 +211,7 @@ impl LinearGradientStyle {
}
}
#[derive(Clone)]
#[derive(Clone, Deserialize, Serialize)]
pub struct RadialGradientStyle {
pub x0: f64,
pub y0: f64,
@ -209,7 +237,7 @@ impl RadialGradientStyle {
}
}
#[derive(Clone)]
#[derive(Clone, Deserialize, Serialize)]
pub struct SurfaceStyle {
pub surface_data: Vec<u8>,
pub surface_size: Size2D<i32>,
@ -230,7 +258,7 @@ impl SurfaceStyle {
}
#[derive(Clone)]
#[derive(Clone, Deserialize, Serialize)]
pub enum FillOrStrokeStyle {
Color(RGBA),
LinearGradient(LinearGradientStyle),
@ -293,7 +321,7 @@ impl FillOrStrokeStyle {
}
}
#[derive(Copy, Clone, PartialEq)]
#[derive(Copy, Clone, PartialEq, Deserialize, Serialize)]
pub enum LineCapStyle {
Butt = 0,
Round = 1,
@ -319,7 +347,7 @@ impl LineCapStyle {
}
}
#[derive(Copy, Clone, PartialEq)]
#[derive(Copy, Clone, PartialEq, Deserialize, Serialize)]
pub enum LineJoinStyle {
Round = 0,
Bevel = 1,
@ -345,7 +373,7 @@ impl LineJoinStyle {
}
}
#[derive(Copy, Clone, PartialEq)]
#[derive(Copy, Clone, PartialEq, Deserialize, Serialize)]
pub enum RepetitionStyle {
Repeat,
RepeatX,
@ -365,7 +393,7 @@ impl RepetitionStyle {
}
}
#[derive(Copy, Clone, PartialEq)]
#[derive(Copy, Clone, PartialEq, Deserialize, Serialize)]
pub enum CompositionStyle {
SrcIn,
SrcOut,
@ -431,7 +459,7 @@ impl CompositionStyle {
}
}
#[derive(Copy, Clone, PartialEq)]
#[derive(Copy, Clone, PartialEq, Deserialize, Serialize)]
pub enum BlendingStyle {
Multiply,
Screen,
@ -513,7 +541,7 @@ impl BlendingStyle {
}
}
#[derive(Copy, Clone, PartialEq)]
#[derive(Copy, Clone, PartialEq, Deserialize, Serialize)]
pub enum CompositionOrBlending {
Composition(CompositionStyle),
Blending(BlendingStyle),

View file

@ -40,6 +40,12 @@ path = "../util"
[dependencies.devtools_traits]
path = "../devtools_traits"
[dependencies.canvas_traits]
path = "../canvas_traits"
[dependencies.canvas]
path = "../canvas"
[dependencies.azure]
git = "https://github.com/servo/rust-azure"
@ -56,6 +62,10 @@ git = "https://github.com/aweinstock314/rust-clipboard"
[dependencies.ipc-channel]
git = "https://github.com/pcwalton/ipc-channel"
[dependencies.offscreen_gl_context]
git = "https://github.com/ecoal95/rust-offscreen-rendering-context"
features = ["texture_surface"]
[dependencies]
log = "0.3"
num = "0.1.24"

View file

@ -11,6 +11,9 @@
use pipeline::{Pipeline, CompositionPipeline};
use canvas::canvas_paint_task::CanvasPaintTask;
use canvas::webgl_paint_task::WebGLPaintTask;
use canvas_traits::CanvasMsg;
use compositor_task::CompositorProxy;
use compositor_task::Msg as CompositorMsg;
use devtools_traits::{DevtoolsControlChan, DevtoolsControlMsg};
@ -35,6 +38,7 @@ use msg::webdriver_msg;
use net_traits::{self, ResourceTask};
use net_traits::image_cache_task::ImageCacheTask;
use net_traits::storage_task::{StorageTask, StorageTaskMsg};
use offscreen_gl_context::GLContextAttributes;
use profile_traits::mem;
use profile_traits::time;
use script_traits::{CompositorEvent, ConstellationControlMsg, LayoutControlMsg};
@ -44,7 +48,7 @@ use std::collections::HashMap;
use std::io::{self, Write};
use std::marker::PhantomData;
use std::mem::replace;
use std::sync::mpsc::{Receiver, channel};
use std::sync::mpsc::{Receiver, Sender, channel};
use style::viewport::ViewportConstraints;
use url::Url;
use util::cursor::Cursor;
@ -126,7 +130,13 @@ pub struct Constellation<LTF, STF> {
clipboard_ctx: Option<ClipboardContext>,
/// Bits of state used to interact with the webdriver implementation
webdriver: WebDriverData
webdriver: WebDriverData,
/// A list of in-process senders to `CanvasPaintTask`s.
canvas_paint_tasks: Vec<Sender<CanvasMsg>>,
/// A list of in-process senders to `WebGLPaintTask`s.
webgl_paint_tasks: Vec<Sender<CanvasMsg>>,
}
/// Stores the navigation context for a single frame in the frame tree.
@ -255,7 +265,9 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
} else {
None
},
webdriver: WebDriverData::new()
webdriver: WebDriverData::new(),
canvas_paint_tasks: Vec::new(),
webgl_paint_tasks: Vec::new(),
};
constellation.run();
});
@ -487,6 +499,14 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
debug!("constellation got head parsed message");
self.compositor_proxy.send(CompositorMsg::HeadParsed);
}
ConstellationMsg::CreateCanvasPaintTask(size, sender) => {
debug!("constellation got create-canvas-paint-task message");
self.handle_create_canvas_paint_task_msg(&size, sender)
}
ConstellationMsg::CreateWebGLPaintTask(size, attributes, sender) => {
debug!("constellation got create-WebGL-paint-task message");
self.handle_create_webgl_paint_task_msg(&size, attributes, sender)
}
}
true
}
@ -907,6 +927,28 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
}
}
fn handle_create_canvas_paint_task_msg(
&mut self,
size: &Size2D<i32>,
response_sender: IpcSender<(IpcSender<CanvasMsg>, usize)>) {
let id = self.canvas_paint_tasks.len();
let (out_of_process_sender, in_process_sender) = CanvasPaintTask::start(*size);
self.canvas_paint_tasks.push(in_process_sender);
response_sender.send((out_of_process_sender, id)).unwrap()
}
fn handle_create_webgl_paint_task_msg(
&mut self,
size: &Size2D<i32>,
attributes: GLContextAttributes,
response_sender: IpcSender<(IpcSender<CanvasMsg>, usize)>) {
let id = self.webgl_paint_tasks.len();
let (out_of_process_sender, in_process_sender) =
WebGLPaintTask::start(*size, attributes).unwrap();
self.webgl_paint_tasks.push(in_process_sender);
response_sender.send((out_of_process_sender, id)).unwrap()
}
fn handle_webdriver_msg(&mut self, msg: WebDriverCommandMsg) {
// Find the script channel for the given parent pipeline,
// and pass the event to that script task.

View file

@ -11,12 +11,15 @@
extern crate log;
extern crate azure;
extern crate canvas;
extern crate canvas_traits;
extern crate devtools_traits;
extern crate euclid;
extern crate gfx;
extern crate ipc_channel;
extern crate layers;
extern crate layout_traits;
extern crate offscreen_gl_context;
extern crate png;
extern crate script_traits;
extern crate msg;

View file

@ -11,15 +11,15 @@ use paint_context::PaintContext;
use azure::azure_hl::{SurfaceFormat, Color, DrawTarget, BackendType};
use azure::AzFloat;
use canvas_traits::CanvasMsg;
use euclid::Matrix4;
use euclid::point::Point2D;
use euclid::rect::Rect;
use euclid::size::Size2D;
use ipc_channel::ipc;
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER;
use layers::platform::surface::{NativeDisplay, NativeSurface};
use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet};
use canvas_traits::CanvasMsg;
use msg::compositor_msg::{Epoch, FrameTreeId, LayerId, LayerKind};
use msg::compositor_msg::{LayerProperties, PaintListener, ScrollPolicy};
use msg::constellation_msg::Msg as ConstellationMsg;
@ -30,7 +30,7 @@ use profile_traits::time::{self, profile};
use rand::{self, Rng};
use std::borrow::ToOwned;
use std::mem as std_mem;
use std::sync::{Arc, Mutex};
use std::sync::Arc;
use std::sync::mpsc::{Receiver, Sender, channel};
use std::collections::HashMap;
use url::Url;
@ -72,7 +72,7 @@ pub struct PaintRequest {
pub enum Msg {
PaintInit(Epoch, Arc<StackingContext>),
CanvasLayer(LayerId, Arc<Mutex<Sender<CanvasMsg>>>),
CanvasLayer(LayerId, IpcSender<CanvasMsg>),
Paint(Vec<PaintRequest>, FrameTreeId),
PaintPermissionGranted,
PaintPermissionRevoked,
@ -122,7 +122,7 @@ pub struct PaintTask<C> {
worker_threads: Vec<WorkerThreadProxy>,
/// A map to track the canvas specific layers
canvas_map: HashMap<LayerId, Arc<Mutex<Sender<CanvasMsg>>>>,
canvas_map: HashMap<LayerId, IpcSender<CanvasMsg>>,
}
// If we implement this as a function, we get borrowck errors from borrowing

View file

@ -55,6 +55,10 @@ git = "https://github.com/servo/rust-selectors"
[dependencies.clock_ticks]
git = "https://github.com/tomaka/clock_ticks"
[dependencies.cssparser]
version = "0.3"
features = [ "serde-serialization" ]
[dependencies.ipc-channel]
git = "https://github.com/pcwalton/ipc-channel"
@ -66,7 +70,6 @@ url = "0.2.36"
bitflags = "0.3"
rustc-serialize = "0.3"
libc = "0.1"
cssparser = "0.3.1"
smallvec = "0.1"
string_cache = "0.1"
string_cache_plugin = "0.1"

View file

@ -15,6 +15,7 @@ use euclid::{Rect, Size2D};
use gfx::display_list::OpaqueNode;
use gfx::font_cache_task::FontCacheTask;
use gfx::font_context::FontContext;
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::ConstellationChan;
use net_traits::image::base::Image;
use net_traits::image_cache_task::{ImageCacheChan, ImageCacheTask, ImageResponse, ImageState};
@ -24,7 +25,7 @@ use std::cell::{RefCell, RefMut};
use std::collections::HashMap;
use std::collections::hash_state::DefaultState;
use std::rc::Rc;
use std::sync::{Arc, Mutex};
use std::sync::Arc;
use std::sync::mpsc::{channel, Sender};
use style::selector_matching::Stylist;
use url::Url;
@ -120,7 +121,7 @@ pub struct SharedLayoutContext {
pub new_animations_sender: Sender<Animation>,
/// A channel to send canvas renderers to paint task, in order to correctly paint the layers
pub canvas_layers_sender: Sender<(LayerId, Option<Arc<Mutex<Sender<CanvasMsg>>>>)>,
pub canvas_layers_sender: Sender<(LayerId, IpcSender<CanvasMsg>)>,
/// The visible rects for each layer, as reported to us by the compositor.
pub visible_rects: Arc<HashMap<LayerId, Rect<Au>, DefaultState<FnvHasher>>>,

View file

@ -21,6 +21,7 @@ use list_item::ListItemFlow;
use model::{self, MaybeAuto, ToGfxMatrix, ToAu};
use table_cell::CollapsedBordersForCell;
use canvas_traits::{CanvasMsg, FromLayoutMsg};
use euclid::{Point2D, Point3D, Rect, Size2D, SideOffsets2D};
use euclid::Matrix4;
use gfx_traits::color;
@ -32,7 +33,7 @@ use gfx::display_list::{GradientStop, ImageDisplayItem, LineDisplayItem};
use gfx::display_list::{OpaqueNode, SolidColorDisplayItem};
use gfx::display_list::{StackingContext, TextDisplayItem, TextOrientation};
use gfx::paint_task::{PaintLayer, THREAD_TINT_COLORS};
use ipc_channel::ipc::IpcSharedMemory;
use ipc_channel::ipc::{self, IpcSharedMemory};
use msg::compositor_msg::{ScrollPolicy, LayerId};
use msg::constellation_msg::ConstellationChan;
use msg::constellation_msg::Msg as ConstellationMsg;
@ -41,6 +42,7 @@ use net_traits::image::base::{Image, PixelFormat};
use std::cmp;
use std::default::Default;
use std::sync::Arc;
use std::sync::mpsc::channel;
use std::f32;
use style::computed_values::filter::Filter;
use style::computed_values::{background_attachment, background_clip, background_origin,
@ -60,9 +62,6 @@ use util::geometry::{Au, ZERO_POINT};
use util::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode};
use util::opts;
use canvas_traits::{CanvasMsg, CanvasCommonMsg};
use std::sync::mpsc::channel;
/// A possible `PaintLayer` for an stacking context
pub enum StackingContextLayer {
Existing(PaintLayer),
@ -1099,11 +1098,11 @@ impl FragmentDisplayListBuilding for Fragment {
.computed_inline_size.map_or(0, |w| w.to_px() as usize);
let height = canvas_fragment_info.replaced_image_fragment_info
.computed_block_size.map_or(0, |h| h.to_px() as usize);
let (sender, receiver) = channel::<IpcSharedMemory>();
let canvas_data = match canvas_fragment_info.renderer {
Some(ref renderer) => {
renderer.lock().unwrap().send(CanvasMsg::Common(
CanvasCommonMsg::SendPixelContents(sender))).unwrap();
let (sender, receiver) = ipc::channel::<IpcSharedMemory>().unwrap();
let canvas_data = match canvas_fragment_info.ipc_renderer {
Some(ref ipc_renderer) => {
ipc_renderer.lock().unwrap().send(CanvasMsg::FromLayout(
FromLayoutMsg::SendPixelContents(sender))).unwrap();
receiver.recv().unwrap()
},
None => IpcSharedMemory::from_byte(0xFFu8, width * height * 4),
@ -1248,8 +1247,11 @@ impl FragmentDisplayListBuilding for Fragment {
// task
if let SpecificFragmentInfo::Canvas(ref fragment_info) = self.specific {
let layer_id = layer.as_ref().unwrap().id;
layout_context.shared.canvas_layers_sender
.send((layer_id, fragment_info.renderer.clone())).unwrap();
if let Some(ref ipc_renderer) = fragment_info.ipc_renderer {
layout_context.shared
.canvas_layers_sender
.send((layer_id, (*ipc_renderer.lock().unwrap()).clone())).unwrap();
}
}
let transform_style = self.style().get_used_transform_style();

View file

@ -24,6 +24,7 @@ use euclid::{Point2D, Rect, Size2D};
use gfx::display_list::{BLUR_INFLATION_FACTOR, OpaqueNode};
use gfx::text::glyph::CharIndex;
use gfx::text::text_run::{TextRun, TextRunSlice};
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::{ConstellationChan, Msg, PipelineId, SubpageId};
use net_traits::image::base::Image;
use net_traits::image_cache_task::UsePlaceholder;
@ -32,7 +33,6 @@ use std::borrow::ToOwned;
use std::cmp::{max, min};
use std::collections::LinkedList;
use std::fmt;
use std::sync::mpsc::Sender;
use std::sync::{Arc, Mutex};
use string_cache::Atom;
use style::computed_values::content::ContentItem;
@ -291,7 +291,8 @@ impl InlineAbsoluteFragmentInfo {
#[derive(Clone)]
pub struct CanvasFragmentInfo {
pub replaced_image_fragment_info: ReplacedImageFragmentInfo,
pub renderer: Option<Arc<Mutex<Sender<CanvasMsg>>>>,
pub renderer_id: Option<usize>,
pub ipc_renderer: Option<Arc<Mutex<IpcSender<CanvasMsg>>>>,
}
impl CanvasFragmentInfo {
@ -300,7 +301,9 @@ impl CanvasFragmentInfo {
replaced_image_fragment_info: ReplacedImageFragmentInfo::new(node,
Some(Au::from_px(node.canvas_width() as i32)),
Some(Au::from_px(node.canvas_height() as i32))),
renderer: node.renderer().map(|rec| Arc::new(Mutex::new(rec))),
renderer_id: node.canvas_renderer_id(),
ipc_renderer: node.canvas_ipc_renderer()
.map(|renderer| Arc::new(Mutex::new(renderer))),
}
}

View file

@ -39,7 +39,7 @@ use gfx::display_list::StackingContext;
use gfx::font_cache_task::FontCacheTask;
use gfx::paint_task::Msg as PaintMsg;
use gfx::paint_task::{PaintChan, PaintLayer};
use ipc_channel::ipc::{self, IpcReceiver};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use layout_traits::LayoutTaskFactory;
use log;
@ -197,8 +197,8 @@ pub struct LayoutTask {
/// To receive a canvas renderer associated to a layer, this message is propagated
/// to the paint chan
pub canvas_layers_receiver: Receiver<(LayerId, Option<Arc<Mutex<Sender<CanvasMsg>>>>)>,
pub canvas_layers_sender: Sender<(LayerId, Option<Arc<Mutex<Sender<CanvasMsg>>>>)>,
pub canvas_layers_receiver: Receiver<(LayerId, IpcSender<CanvasMsg>)>,
pub canvas_layers_sender: Sender<(LayerId, IpcSender<CanvasMsg>)>,
/// A mutex to allow for fast, read-only RPC of layout's internal data
/// structures, while still letting the LayoutTask modify them.
@ -1030,9 +1030,7 @@ impl LayoutTask {
// Send new canvas renderers to the paint task
while let Ok((layer_id, renderer)) = self.canvas_layers_receiver.try_recv() {
// Just send if there's an actual renderer
if let Some(renderer) = renderer {
self.paint_chan.send(PaintMsg::CanvasLayer(layer_id, renderer));
}
self.paint_chan.send(PaintMsg::CanvasLayer(layer_id, renderer));
}
// Perform post-style recalculation layout passes.

View file

@ -38,6 +38,7 @@ use data::{LayoutDataFlags, LayoutDataWrapper, PrivateLayoutData};
use opaque_node::OpaqueNodeMethods;
use gfx::display_list::OpaqueNode;
use ipc_channel::ipc::IpcSender;
use script::dom::attr::AttrValue;
use script::dom::bindings::codegen::InheritTypes::{CharacterDataCast, ElementCast};
use script::dom::bindings::codegen::InheritTypes::{HTMLIFrameElementCast, HTMLCanvasElementCast};
@ -63,7 +64,6 @@ use std::borrow::ToOwned;
use std::cell::{Ref, RefMut};
use std::marker::PhantomData;
use std::mem;
use std::sync::mpsc::Sender;
use string_cache::{Atom, Namespace};
use style::computed_values::content::ContentItem;
use style::computed_values::{content, display, white_space};
@ -904,10 +904,17 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
}
}
pub fn renderer(&self) -> Option<Sender<CanvasMsg>> {
pub fn canvas_renderer_id(&self) -> Option<usize> {
unsafe {
let canvas_element = HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged());
canvas_element.and_then(|elem| elem.get_renderer())
canvas_element.and_then(|elem| elem.get_renderer_id())
}
}
pub fn canvas_ipc_renderer(&self) -> Option<IpcSender<CanvasMsg>> {
unsafe {
let canvas_element = HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged());
canvas_element.and_then(|elem| elem.get_ipc_renderer())
}
}

View file

@ -13,6 +13,9 @@ path = "../style"
[dependencies.util]
path = "../util"
[dependencies.canvas_traits]
path = "../canvas_traits"
[dependencies.azure]
git = "https://github.com/servo/rust-azure"
@ -34,6 +37,10 @@ features = [ "serde_serialization" ]
[dependencies.ipc-channel]
git = "https://github.com/pcwalton/ipc-channel"
[dependencies.offscreen_gl_context]
git = "https://github.com/ecoal95/rust-offscreen-rendering-context"
features = ["texture_surface"]
[dependencies]
bitflags = "0.3"
rustc-serialize = "0.3.4"

View file

@ -7,13 +7,15 @@
use compositor_msg::Epoch;
use canvas_traits::CanvasMsg;
use euclid::rect::Rect;
use euclid::size::TypedSize2D;
use euclid::size::{Size2D, TypedSize2D};
use euclid::scale_factor::ScaleFactor;
use hyper::header::Headers;
use hyper::method::Method;
use ipc_channel::ipc::IpcSender;
use layers::geometry::DevicePixel;
use offscreen_gl_context::GLContextAttributes;
use png::Image;
use util::cursor::Cursor;
use util::geometry::{PagePx, ViewportPx};
@ -257,6 +259,14 @@ pub enum Msg {
NewFavicon(Url),
/// <head> tag finished parsing
HeadParsed,
/// Requests that a new 2D canvas thread be created. (This is done in the constellation because
/// 2D canvases may use the GPU and we don't want to give untrusted content access to the GPU.)
CreateCanvasPaintTask(Size2D<i32>, IpcSender<(IpcSender<CanvasMsg>, usize)>),
/// Requests that a new WebGL thread be created. (This is done in the constellation because
/// WebGL uses the GPU and we don't want to give untrusted content access to the GPU.)
CreateWebGLPaintTask(Size2D<i32>,
GLContextAttributes,
IpcSender<(IpcSender<CanvasMsg>, usize)>),
}
#[derive(Clone, Eq, PartialEq, Deserialize, Serialize)]

View file

@ -7,10 +7,12 @@
extern crate azure;
#[macro_use] extern crate bitflags;
extern crate canvas_traits;
extern crate euclid;
extern crate hyper;
extern crate ipc_channel;
extern crate layers;
extern crate offscreen_gl_context;
extern crate png;
extern crate rustc_serialize;
extern crate serde;

View file

@ -58,6 +58,10 @@ features = ["query_encoding", "serde_serialization"]
[dependencies.offscreen_gl_context]
git = "https://github.com/ecoal95/rust-offscreen-rendering-context"
[dependencies.cssparser]
version = "0.3"
features = [ "serde-serialization" ]
[dependencies.ipc-channel]
git = "https://github.com/pcwalton/ipc-channel"
@ -73,7 +77,6 @@ time = "0.1.12"
bitflags = "0.3"
rustc-serialize = "0.3"
libc = "0.1"
cssparser = "0.3.1"
unicase = "0.1"
num = "0.1.24"
websocket = "0.12"

View file

@ -17,7 +17,7 @@ use dom::window::{self, WindowHelpers};
use devtools_traits::DevtoolsControlChan;
use script_task::{ScriptChan, ScriptPort, ScriptMsg, ScriptTask};
use msg::constellation_msg::{PipelineId, WorkerId};
use msg::constellation_msg::{ConstellationChan, PipelineId, WorkerId};
use net_traits::ResourceTask;
use profile_traits::mem;
@ -91,6 +91,14 @@ impl<'a> GlobalRef<'a> {
}
}
/// Get a `ConstellationChan` to send messages to the constellation channel when available.
pub fn constellation_chan(&self) -> ConstellationChan {
match *self {
GlobalRef::Window(window) => window.constellation_chan(),
GlobalRef::Worker(worker) => worker.constellation_chan(),
}
}
/// Get a `DevtoolsControlChan` to send messages to Devtools
/// task when available.
pub fn devtools_chan(&self) -> Option<DevtoolsControlChan> {

View file

@ -62,8 +62,8 @@ use msg::compositor_msg::ScriptListener;
use msg::constellation_msg::ConstellationChan;
use net_traits::image::base::Image;
use profile_traits::mem::ProfilerChan;
use serde::Serialize;
use util::str::{LengthOrPercentageOrAuto};
use serde::{Deserialize, Serialize};
use std::cell::{Cell, UnsafeCell, RefCell};
use std::collections::{HashMap, HashSet};
use std::collections::hash_state::HashState;
@ -332,6 +332,13 @@ impl<A,B> JSTraceable for fn(A) -> B {
}
}
impl<T> JSTraceable for IpcSender<T> where T: Deserialize + Serialize {
#[inline]
fn trace(&self, _: *mut JSTracer) {
// Do nothing
}
}
impl JSTraceable for ScriptListener {
#[inline]
fn trace(&self, _: *mut JSTracer) {
@ -346,13 +353,6 @@ impl JSTraceable for Box<LayoutRPC+'static> {
}
}
impl<T> JSTraceable for IpcSender<T> where T: Serialize {
#[inline]
fn trace(&self, _: *mut JSTracer) {
// Do nothing
}
}
impl JSTraceable for () {
#[inline]
fn trace(&self, _trc: *mut JSTracer) {

View file

@ -28,20 +28,22 @@ use euclid::matrix2d::Matrix2D;
use euclid::point::Point2D;
use euclid::rect::Rect;
use euclid::size::Size2D;
use ipc_channel::ipc;
use canvas_traits::{CanvasMsg, Canvas2dMsg, CanvasCommonMsg};
use canvas_traits::{FillOrStrokeStyle, LinearGradientStyle, RadialGradientStyle, RepetitionStyle};
use canvas_traits::{LineCapStyle, LineJoinStyle, CompositionOrBlending};
use canvas::canvas_paint_task::CanvasPaintTask;
use msg::constellation_msg::Msg as ConstellationMsg;
use net_traits::image_cache_task::{ImageCacheChan, ImageResponse};
use net_traits::image::base::PixelFormat;
use ipc_channel::ipc::IpcSender;
use num::{Float, ToPrimitive};
use std::borrow::ToOwned;
use std::cell::RefCell;
use std::fmt;
use std::sync::mpsc::{channel, Sender};
use std::sync::mpsc::channel;
use util::str::DOMString;
use url::Url;
@ -60,7 +62,8 @@ pub enum CanvasFillOrStrokeStyle {
pub struct CanvasRenderingContext2D {
reflector_: Reflector,
global: GlobalField,
renderer: Sender<CanvasMsg>,
renderer_id: usize,
ipc_renderer: IpcSender<CanvasMsg>,
canvas: JS<HTMLCanvasElement>,
state: RefCell<CanvasContextState>,
saved_states: RefCell<Vec<CanvasContextState>>,
@ -115,10 +118,15 @@ impl CanvasContextState {
impl CanvasRenderingContext2D {
fn new_inherited(global: GlobalRef, canvas: &HTMLCanvasElement, size: Size2D<i32>)
-> CanvasRenderingContext2D {
let (sender, receiver) = ipc::channel().unwrap();
let constellation_chan = global.constellation_chan();
constellation_chan.0.send(ConstellationMsg::CreateCanvasPaintTask(size, sender)).unwrap();
let (ipc_renderer, renderer_id) = receiver.recv().unwrap();
CanvasRenderingContext2D {
reflector_: Reflector::new(),
global: GlobalField::from_rooted(&global),
renderer: CanvasPaintTask::start(size),
renderer_id: renderer_id,
ipc_renderer: ipc_renderer,
canvas: JS::from_ref(canvas),
state: RefCell::new(CanvasContextState::new()),
saved_states: RefCell::new(Vec::new()),
@ -132,7 +140,9 @@ impl CanvasRenderingContext2D {
}
pub fn recreate(&self, size: Size2D<i32>) {
self.renderer.send(CanvasMsg::Common(CanvasCommonMsg::Recreate(size))).unwrap();
self.ipc_renderer
.send(CanvasMsg::Common(CanvasCommonMsg::Recreate(size)))
.unwrap();
}
fn mark_as_dirty(&self) {
@ -142,7 +152,9 @@ impl CanvasRenderingContext2D {
}
fn update_transform(&self) {
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetTransform(self.state.borrow().transform))).unwrap()
self.ipc_renderer
.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetTransform(self.state.borrow().transform)))
.unwrap()
}
// It is used by DrawImage to calculate the size of the source and destination rectangles based
@ -237,17 +249,19 @@ impl CanvasRenderingContext2D {
None => return Err(InvalidState),
};
let renderer = context.r().get_renderer();
let (sender, receiver) = channel::<Vec<u8>>();
let renderer = context.r().get_ipc_renderer();
let (sender, receiver) = ipc::channel::<Vec<u8>>().unwrap();
// Reads pixels from source image
renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::GetImageData(source_rect, image_size, sender))).unwrap();
renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::GetImageData(source_rect,
image_size,
sender))).unwrap();
let imagedata = receiver.recv().unwrap();
// Writes pixels to destination canvas
CanvasMsg::Canvas2d(
Canvas2dMsg::DrawImage(imagedata, source_rect.size, dest_rect, source_rect, smoothing_enabled))
};
self.renderer.send(msg).unwrap();
self.ipc_renderer.send(msg).unwrap();
self.mark_as_dirty();
Ok(())
}
@ -265,9 +279,13 @@ impl CanvasRenderingContext2D {
}
let smoothing_enabled = self.state.borrow().image_smoothing_enabled;
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::DrawImage(
image_data, image_size, dest_rect,
source_rect, smoothing_enabled))).unwrap();
self.ipc_renderer
.send(CanvasMsg::Canvas2d(Canvas2dMsg::DrawImage(image_data,
image_size,
dest_rect,
source_rect,
smoothing_enabled)))
.unwrap();
self.mark_as_dirty();
Ok(())
}
@ -282,7 +300,9 @@ impl CanvasRenderingContext2D {
let img = match self.request_image_from_cache(url) {
ImageResponse::Loaded(img) => img,
ImageResponse::PlaceholderLoaded(_) | ImageResponse::None => return None,
ImageResponse::PlaceholderLoaded(_) | ImageResponse::None => {
return None
}
};
let image_size = Size2D::new(img.width as f64, img.height as f64);
@ -308,8 +328,8 @@ impl CanvasRenderingContext2D {
let canvas_size = canvas_element.get_size();
let image_size = Size2D::new(canvas_size.width as f64, canvas_size.height as f64);
let renderer = context.r().get_renderer();
let (sender, receiver) = channel::<Vec<u8>>();
let renderer = context.r().get_ipc_renderer();
let (sender, receiver) = ipc::channel::<Vec<u8>>().unwrap();
// Reads pixels from source canvas
renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::GetImageData(source_rect, image_size, sender))).unwrap();
@ -341,24 +361,34 @@ impl CanvasRenderingContext2D {
}
pub trait CanvasRenderingContext2DHelpers {
fn get_renderer(self) -> Sender<CanvasMsg>;
fn get_renderer_id(self) -> usize;
fn get_ipc_renderer(self) -> IpcSender<CanvasMsg>;
}
impl<'a> CanvasRenderingContext2DHelpers for &'a CanvasRenderingContext2D {
fn get_renderer(self) -> Sender<CanvasMsg> {
self.renderer.clone()
fn get_renderer_id(self) -> usize {
self.renderer_id
}
fn get_ipc_renderer(self) -> IpcSender<CanvasMsg> {
self.ipc_renderer.clone()
}
}
pub trait LayoutCanvasRenderingContext2DHelpers {
#[allow(unsafe_code)]
unsafe fn get_renderer(&self) -> Sender<CanvasMsg>;
unsafe fn get_renderer_id(&self) -> usize;
#[allow(unsafe_code)]
unsafe fn get_ipc_renderer(&self) -> IpcSender<CanvasMsg>;
}
impl LayoutCanvasRenderingContext2DHelpers for LayoutJS<CanvasRenderingContext2D> {
#[allow(unsafe_code)]
unsafe fn get_renderer(&self) -> Sender<CanvasMsg> {
(*self.unsafe_get()).renderer.clone()
unsafe fn get_renderer_id(&self) -> usize {
(*self.unsafe_get()).renderer_id
}
#[allow(unsafe_code)]
unsafe fn get_ipc_renderer(&self) -> IpcSender<CanvasMsg> {
(*self.unsafe_get()).ipc_renderer.clone()
}
}
@ -380,7 +410,7 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
// https://html.spec.whatwg.org/multipage/#dom-context-2d-save
fn Save(self) {
self.saved_states.borrow_mut().push(self.state.borrow().clone());
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SaveContext)).unwrap();
self.ipc_renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SaveContext)).unwrap();
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-restore
@ -388,7 +418,7 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
let mut saved_states = self.saved_states.borrow_mut();
if let Some(state) = saved_states.pop() {
self.state.borrow_mut().clone_from(&state);
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::RestoreContext)).unwrap();
self.ipc_renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::RestoreContext)).unwrap();
}
}
@ -480,7 +510,9 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
}
self.state.borrow_mut().global_alpha = alpha;
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetGlobalAlpha(alpha as f32))).unwrap()
self.ipc_renderer
.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetGlobalAlpha(alpha as f32)))
.unwrap()
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-globalcompositeoperation
@ -496,14 +528,16 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
fn SetGlobalCompositeOperation(self, op_str: DOMString) {
if let Some(op) = CompositionOrBlending::from_str(&op_str) {
self.state.borrow_mut().global_composition = op;
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetGlobalComposition(op))).unwrap()
self.ipc_renderer
.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetGlobalComposition(op)))
.unwrap()
}
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-fillrect
fn FillRect(self, x: f64, y: f64, width: f64, height: f64) {
if let Some(rect) = self.create_drawable_rect(x, y, width, height) {
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::FillRect(rect))).unwrap();
self.ipc_renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::FillRect(rect))).unwrap();
self.mark_as_dirty();
}
}
@ -511,7 +545,9 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
// https://html.spec.whatwg.org/multipage/#dom-context-2d-clearrect
fn ClearRect(self, x: f64, y: f64, width: f64, height: f64) {
if let Some(rect) = self.create_drawable_rect(x, y, width, height) {
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::ClearRect(rect))).unwrap();
self.ipc_renderer
.send(CanvasMsg::Canvas2d(Canvas2dMsg::ClearRect(rect)))
.unwrap();
self.mark_as_dirty();
}
}
@ -519,38 +555,40 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
// https://html.spec.whatwg.org/multipage/#dom-context-2d-strokerect
fn StrokeRect(self, x: f64, y: f64, width: f64, height: f64) {
if let Some(rect) = self.create_drawable_rect(x, y, width, height) {
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::StrokeRect(rect))).unwrap();
self.ipc_renderer
.send(CanvasMsg::Canvas2d(Canvas2dMsg::StrokeRect(rect)))
.unwrap();
self.mark_as_dirty();
}
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-beginpath
fn BeginPath(self) {
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::BeginPath)).unwrap();
self.ipc_renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::BeginPath)).unwrap();
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-closepath
fn ClosePath(self) {
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::ClosePath)).unwrap();
self.ipc_renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::ClosePath)).unwrap();
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-fill
fn Fill(self, _: CanvasWindingRule) {
// TODO: Process winding rule
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::Fill)).unwrap();
self.ipc_renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::Fill)).unwrap();
self.mark_as_dirty();
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-stroke
fn Stroke(self) {
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::Stroke)).unwrap();
self.ipc_renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::Stroke)).unwrap();
self.mark_as_dirty();
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-clip
fn Clip(self, _: CanvasWindingRule) {
// TODO: Process winding rule
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::Clip)).unwrap();
self.ipc_renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::Clip)).unwrap();
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
@ -728,7 +766,7 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
let msg = CanvasMsg::Canvas2d(
Canvas2dMsg::MoveTo(
Point2D::new(x as f32, y as f32)));
self.renderer.send(msg).unwrap();
self.ipc_renderer.send(msg).unwrap();
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-lineto
@ -740,7 +778,7 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
let msg = CanvasMsg::Canvas2d(
Canvas2dMsg::LineTo(
Point2D::new(x as f32, y as f32)));
self.renderer.send(msg).unwrap();
self.ipc_renderer.send(msg).unwrap();
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-rect
@ -749,7 +787,7 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
let rect = Rect::new(Point2D::new(x as f32, y as f32),
Size2D::new(width as f32, height as f32));
let msg = CanvasMsg::Canvas2d(Canvas2dMsg::Rect(rect));
self.renderer.send(msg).unwrap();
self.ipc_renderer.send(msg).unwrap();
}
}
@ -764,7 +802,7 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
Canvas2dMsg::QuadraticCurveTo(
Point2D::new(cpx as f32, cpy as f32),
Point2D::new(x as f32, y as f32)));
self.renderer.send(msg).unwrap();
self.ipc_renderer.send(msg).unwrap();
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-beziercurveto
@ -779,7 +817,7 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
Point2D::new(cp1x as f32, cp1y as f32),
Point2D::new(cp2x as f32, cp2y as f32),
Point2D::new(x as f32, y as f32)));
self.renderer.send(msg).unwrap();
self.ipc_renderer.send(msg).unwrap();
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-arc
@ -800,7 +838,7 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
Point2D::new(x as f32, y as f32), r as f32,
start as f32, end as f32, ccw));
self.renderer.send(msg).unwrap();
self.ipc_renderer.send(msg).unwrap();
Ok(())
}
@ -818,7 +856,7 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
Point2D::new(cp1x as f32, cp1y as f32),
Point2D::new(cp2x as f32, cp2y as f32),
r as f32));
self.renderer.send(msg).unwrap();
self.ipc_renderer.send(msg).unwrap();
Ok(())
}
@ -854,8 +892,9 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
match parse_color(&string) {
Ok(rgba) => {
self.state.borrow_mut().stroke_style = CanvasFillOrStrokeStyle::Color(rgba);
self.renderer
.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetStrokeStyle(FillOrStrokeStyle::Color(rgba))))
self.ipc_renderer
.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetStrokeStyle(
FillOrStrokeStyle::Color(rgba))))
.unwrap();
}
_ => {}
@ -866,7 +905,7 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
JS::from_ref(gradient.r()));
let msg = CanvasMsg::Canvas2d(
Canvas2dMsg::SetStrokeStyle(gradient.r().to_fill_or_stroke_style()));
self.renderer.send(msg).unwrap();
self.ipc_renderer.send(msg).unwrap();
},
_ => {}
}
@ -893,8 +932,9 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
match parse_color(&string) {
Ok(rgba) => {
self.state.borrow_mut().fill_style = CanvasFillOrStrokeStyle::Color(rgba);
self.renderer
.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetFillStyle(FillOrStrokeStyle::Color(rgba))))
self.ipc_renderer
.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetFillStyle(
FillOrStrokeStyle::Color(rgba))))
.unwrap()
}
_ => {}
@ -905,10 +945,10 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
JS::from_rooted(&gradient));
let msg = CanvasMsg::Canvas2d(
Canvas2dMsg::SetFillStyle(gradient.r().to_fill_or_stroke_style()));
self.renderer.send(msg).unwrap();
self.ipc_renderer.send(msg).unwrap();
}
StringOrCanvasGradientOrCanvasPattern::eCanvasPattern(pattern) => {
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetFillStyle(
self.ipc_renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetFillStyle(
pattern.r().to_fill_or_stroke_style()))).unwrap();
}
}
@ -947,12 +987,14 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
return Err(IndexSize)
}
let (sender, receiver) = channel::<Vec<u8>>();
let (sender, receiver) = ipc::channel::<Vec<u8>>().unwrap();
let dest_rect = Rect::new(Point2D::new(sx as f64, sy as f64),
Size2D::new(sw as f64, sh as f64));
let canvas_size = self.canvas.root().r().get_size();
let canvas_size = Size2D::new(canvas_size.width as f64, canvas_size.height as f64);
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::GetImageData(dest_rect, canvas_size, sender))).unwrap();
self.ipc_renderer
.send(CanvasMsg::Canvas2d(Canvas2dMsg::GetImageData(dest_rect, canvas_size, sender)))
.unwrap();
let data = receiver.recv().unwrap();
Ok(ImageData::new(self.global.root().r(), sw.abs().to_u32().unwrap(), sh.abs().to_u32().unwrap(), Some(data)))
}
@ -975,7 +1017,7 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
let image_data_rect = Rect::new(Point2D::new(dx, dy), image_data_size);
let dirty_rect = None;
let msg = CanvasMsg::Canvas2d(Canvas2dMsg::PutImageData(data, image_data_rect, dirty_rect));
self.renderer.send(msg).unwrap();
self.ipc_renderer.send(msg).unwrap();
self.mark_as_dirty();
}
@ -1003,7 +1045,7 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
let dirty_rect = Some(Rect::new(Point2D::new(dirtyX, dirtyY),
Size2D::new(dirtyWidth, dirtyHeight)));
let msg = CanvasMsg::Canvas2d(Canvas2dMsg::PutImageData(data, image_data_rect, dirty_rect));
self.renderer.send(msg).unwrap();
self.ipc_renderer.send(msg).unwrap();
self.mark_as_dirty();
}
@ -1106,7 +1148,9 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
}
self.state.borrow_mut().line_width = width;
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetLineWidth(width as f32))).unwrap()
self.ipc_renderer
.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetLineWidth(width as f32)))
.unwrap()
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-linecap
@ -1123,7 +1167,7 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
fn SetLineCap(self, cap_str: DOMString) {
if let Some(cap) = LineCapStyle::from_str(&cap_str) {
self.state.borrow_mut().line_cap = cap;
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetLineCap(cap))).unwrap()
self.ipc_renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetLineCap(cap))).unwrap()
}
}
@ -1141,7 +1185,7 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
fn SetLineJoin(self, join_str: DOMString) {
if let Some(join) = LineJoinStyle::from_str(&join_str) {
self.state.borrow_mut().line_join = join;
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetLineJoin(join))).unwrap()
self.ipc_renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetLineJoin(join))).unwrap()
}
}
@ -1158,7 +1202,9 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
}
self.state.borrow_mut().miter_limit = limit;
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetMiterLimit(limit as f32))).unwrap()
self.ipc_renderer
.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetMiterLimit(limit as f32)))
.unwrap()
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-shadowoffsetx
@ -1172,7 +1218,7 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
return;
}
self.state.borrow_mut().shadow_offset_x = value;
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetShadowOffsetX(value))).unwrap()
self.ipc_renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetShadowOffsetX(value))).unwrap()
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-shadowoffsety
@ -1186,7 +1232,7 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
return;
}
self.state.borrow_mut().shadow_offset_y = value;
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetShadowOffsetY(value))).unwrap()
self.ipc_renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetShadowOffsetY(value))).unwrap()
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-shadowblur
@ -1200,7 +1246,7 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
return;
}
self.state.borrow_mut().shadow_blur = value;
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetShadowBlur(value))).unwrap()
self.ipc_renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetShadowBlur(value))).unwrap()
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-shadowcolor
@ -1214,14 +1260,16 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
fn SetShadowColor(self, value: DOMString) {
if let Ok(color) = parse_color(&value) {
self.state.borrow_mut().shadow_color = color;
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetShadowColor(color))).unwrap()
self.ipc_renderer
.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetShadowColor(color)))
.unwrap()
}
}
}
impl Drop for CanvasRenderingContext2D {
fn drop(&mut self) {
self.renderer.send(CanvasMsg::Common(CanvasCommonMsg::Close)).unwrap();
self.ipc_renderer.send(CanvasMsg::Common(CanvasCommonMsg::Close)).unwrap();
}
}

View file

@ -24,7 +24,7 @@ use dom::workerglobalscope::WorkerGlobalScopeTypeId;
use script_task::{ScriptTask, ScriptChan, ScriptMsg, TimerSource, ScriptPort};
use script_task::StackRootTLS;
use msg::constellation_msg::PipelineId;
use msg::constellation_msg::{ConstellationChan, PipelineId};
use devtools_traits::DevtoolsControlChan;
@ -113,6 +113,7 @@ impl DedicatedWorkerGlobalScope {
devtools_chan: Option<DevtoolsControlChan>,
runtime: Rc<Runtime>,
resource_task: ResourceTask,
constellation_chan: ConstellationChan,
parent_sender: Box<ScriptChan+Send>,
own_sender: Sender<(TrustedWorkerAddress, ScriptMsg)>,
receiver: Receiver<(TrustedWorkerAddress, ScriptMsg)>)
@ -120,7 +121,7 @@ impl DedicatedWorkerGlobalScope {
DedicatedWorkerGlobalScope {
workerglobalscope: WorkerGlobalScope::new_inherited(
WorkerGlobalScopeTypeId::DedicatedGlobalScope, worker_url,
runtime, resource_task, mem_profiler_chan, devtools_chan),
runtime, resource_task, mem_profiler_chan, devtools_chan, constellation_chan),
id: id,
receiver: receiver,
own_sender: own_sender,
@ -135,13 +136,14 @@ impl DedicatedWorkerGlobalScope {
devtools_chan: Option<DevtoolsControlChan>,
runtime: Rc<Runtime>,
resource_task: ResourceTask,
constellation_chan: ConstellationChan,
parent_sender: Box<ScriptChan+Send>,
own_sender: Sender<(TrustedWorkerAddress, ScriptMsg)>,
receiver: Receiver<(TrustedWorkerAddress, ScriptMsg)>)
-> Root<DedicatedWorkerGlobalScope> {
let scope = box DedicatedWorkerGlobalScope::new_inherited(
worker_url, id, mem_profiler_chan, devtools_chan, runtime.clone(), resource_task,
parent_sender, own_sender, receiver);
constellation_chan, parent_sender, own_sender, receiver);
DedicatedWorkerGlobalScopeBinding::Wrap(runtime.cx(), scope)
}
}
@ -153,6 +155,7 @@ impl DedicatedWorkerGlobalScope {
devtools_chan: Option<DevtoolsControlChan>,
worker: TrustedWorkerAddress,
resource_task: ResourceTask,
constellation_chan: ConstellationChan,
parent_sender: Box<ScriptChan+Send>,
own_sender: Sender<(TrustedWorkerAddress, ScriptMsg)>,
receiver: Receiver<(TrustedWorkerAddress, ScriptMsg)>) {
@ -180,7 +183,7 @@ impl DedicatedWorkerGlobalScope {
let parent_sender_for_reporter = parent_sender.clone();
let global = DedicatedWorkerGlobalScope::new(
url, id, mem_profiler_chan.clone(), devtools_chan, runtime.clone(), resource_task,
parent_sender, own_sender, receiver);
constellation_chan, parent_sender, own_sender, receiver);
// FIXME(njn): workers currently don't have a unique ID suitable for using in reporter
// registration (#6631), so we instead use a random number and cross our fingers.
let reporter_name = format!("worker-reporter-{}", random::<u64>());

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use canvas_traits::CanvasMsg;
use dom::attr::Attr;
use dom::attr::AttrHelpers;
use dom::bindings::codegen::Bindings::HTMLCanvasElementBinding;
@ -27,12 +26,13 @@ use dom::webglrenderingcontext::{WebGLRenderingContext, LayoutCanvasWebGLRenderi
use util::str::{DOMString, parse_unsigned_integer};
use js::jsapi::{JSContext, HandleValue};
use offscreen_gl_context::GLContextAttributes;
use canvas_traits::CanvasMsg;
use ipc_channel::ipc::IpcSender;
use euclid::size::Size2D;
use std::cell::Cell;
use std::default::Default;
use std::sync::mpsc::Sender;
const DEFAULT_WIDTH: u32 = 300;
const DEFAULT_HEIGHT: u32 = 150;
@ -106,7 +106,9 @@ impl HTMLCanvasElement {
pub trait LayoutHTMLCanvasElementHelpers {
#[allow(unsafe_code)]
unsafe fn get_renderer(&self) -> Option<Sender<CanvasMsg>>;
unsafe fn get_renderer_id(&self) -> Option<usize>;
#[allow(unsafe_code)]
unsafe fn get_ipc_renderer(&self) -> Option<IpcSender<CanvasMsg>>;
#[allow(unsafe_code)]
unsafe fn get_canvas_width(&self) -> u32;
#[allow(unsafe_code)]
@ -115,14 +117,25 @@ pub trait LayoutHTMLCanvasElementHelpers {
impl LayoutHTMLCanvasElementHelpers for LayoutJS<HTMLCanvasElement> {
#[allow(unsafe_code)]
unsafe fn get_renderer(&self) -> Option<Sender<CanvasMsg>> {
unsafe fn get_renderer_id(&self) -> Option<usize> {
let ref canvas = *self.unsafe_get();
if let Some(context) = canvas.context.get() {
match context {
CanvasContext::Context2d(context)
=> Some(context.to_layout().get_renderer()),
CanvasContext::WebGL(context)
=> Some(context.to_layout().get_renderer()),
CanvasContext::Context2d(context) => Some(context.to_layout().get_renderer_id()),
CanvasContext::WebGL(context) => Some(context.to_layout().get_renderer_id()),
}
} else {
None
}
}
#[allow(unsafe_code)]
unsafe fn get_ipc_renderer(&self) -> Option<IpcSender<CanvasMsg>> {
let ref canvas = *self.unsafe_get();
if let Some(context) = canvas.context.get() {
match context {
CanvasContext::Context2d(context) => Some(context.to_layout().get_ipc_renderer()),
CanvasContext::WebGL(context) => Some(context.to_layout().get_ipc_renderer()),
}
} else {
None

View file

@ -10,7 +10,7 @@ use dom::bindings::utils::reflect_dom_object;
use dom::webglobject::WebGLObject;
use canvas_traits::{CanvasMsg, CanvasWebGLMsg};
use std::sync::mpsc::{channel, Sender};
use ipc_channel::ipc::{self, IpcSender};
use std::cell::Cell;
#[dom_struct]
@ -18,11 +18,11 @@ pub struct WebGLBuffer {
webgl_object: WebGLObject,
id: u32,
is_deleted: Cell<bool>,
renderer: Sender<CanvasMsg>,
renderer: IpcSender<CanvasMsg>,
}
impl WebGLBuffer {
fn new_inherited(renderer: Sender<CanvasMsg>, id: u32) -> WebGLBuffer {
fn new_inherited(renderer: IpcSender<CanvasMsg>, id: u32) -> WebGLBuffer {
WebGLBuffer {
webgl_object: WebGLObject::new_inherited(),
id: id,
@ -31,15 +31,16 @@ impl WebGLBuffer {
}
}
pub fn maybe_new(global: GlobalRef, renderer: Sender<CanvasMsg>) -> Option<Root<WebGLBuffer>> {
let (sender, receiver) = channel();
pub fn maybe_new(global: GlobalRef, renderer: IpcSender<CanvasMsg>)
-> Option<Root<WebGLBuffer>> {
let (sender, receiver) = ipc::channel().unwrap();
renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::CreateBuffer(sender))).unwrap();
let result = receiver.recv().unwrap();
result.map(|buffer_id| WebGLBuffer::new(global, renderer, *buffer_id))
}
pub fn new(global: GlobalRef, renderer: Sender<CanvasMsg>, id: u32) -> Root<WebGLBuffer> {
pub fn new(global: GlobalRef, renderer: IpcSender<CanvasMsg>, id: u32) -> Root<WebGLBuffer> {
reflect_dom_object(box WebGLBuffer::new_inherited(renderer, id), global, WebGLBufferBinding::Wrap)
}
}

View file

@ -10,7 +10,7 @@ use dom::bindings::utils::reflect_dom_object;
use dom::webglobject::WebGLObject;
use canvas_traits::{CanvasMsg, CanvasWebGLMsg, WebGLFramebufferBindingRequest};
use std::sync::mpsc::{channel, Sender};
use ipc_channel::ipc::{self, IpcSender};
use std::cell::Cell;
#[dom_struct]
@ -18,11 +18,11 @@ pub struct WebGLFramebuffer {
webgl_object: WebGLObject,
id: u32,
is_deleted: Cell<bool>,
renderer: Sender<CanvasMsg>,
renderer: IpcSender<CanvasMsg>,
}
impl WebGLFramebuffer {
fn new_inherited(renderer: Sender<CanvasMsg>, id: u32) -> WebGLFramebuffer {
fn new_inherited(renderer: IpcSender<CanvasMsg>, id: u32) -> WebGLFramebuffer {
WebGLFramebuffer {
webgl_object: WebGLObject::new_inherited(),
id: id,
@ -31,15 +31,17 @@ impl WebGLFramebuffer {
}
}
pub fn maybe_new(global: GlobalRef, renderer: Sender<CanvasMsg>) -> Option<Root<WebGLFramebuffer>> {
let (sender, receiver) = channel();
pub fn maybe_new(global: GlobalRef, renderer: IpcSender<CanvasMsg>)
-> Option<Root<WebGLFramebuffer>> {
let (sender, receiver) = ipc::channel().unwrap();
renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::CreateFramebuffer(sender))).unwrap();
let result = receiver.recv().unwrap();
result.map(|fb_id| WebGLFramebuffer::new(global, renderer, *fb_id))
}
pub fn new(global: GlobalRef, renderer: Sender<CanvasMsg>, id: u32) -> Root<WebGLFramebuffer> {
pub fn new(global: GlobalRef, renderer: IpcSender<CanvasMsg>, id: u32)
-> Root<WebGLFramebuffer> {
reflect_dom_object(box WebGLFramebuffer::new_inherited(renderer, id), global, WebGLFramebufferBinding::Wrap)
}
}

View file

@ -14,7 +14,7 @@ use dom::webglrenderingcontext::MAX_UNIFORM_AND_ATTRIBUTE_LEN;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
use canvas_traits::{CanvasMsg, CanvasWebGLMsg, WebGLResult, WebGLError};
use std::sync::mpsc::{channel, Sender};
use ipc_channel::ipc::{self, IpcSender};
use std::cell::Cell;
#[dom_struct]
@ -24,11 +24,11 @@ pub struct WebGLProgram {
is_deleted: Cell<bool>,
fragment_shader: MutNullableHeap<JS<WebGLShader>>,
vertex_shader: MutNullableHeap<JS<WebGLShader>>,
renderer: Sender<CanvasMsg>,
renderer: IpcSender<CanvasMsg>,
}
impl WebGLProgram {
fn new_inherited(renderer: Sender<CanvasMsg>, id: u32) -> WebGLProgram {
fn new_inherited(renderer: IpcSender<CanvasMsg>, id: u32) -> WebGLProgram {
WebGLProgram {
webgl_object: WebGLObject::new_inherited(),
id: id,
@ -39,15 +39,16 @@ impl WebGLProgram {
}
}
pub fn maybe_new(global: GlobalRef, renderer: Sender<CanvasMsg>) -> Option<Root<WebGLProgram>> {
let (sender, receiver) = channel();
pub fn maybe_new(global: GlobalRef, renderer: IpcSender<CanvasMsg>)
-> Option<Root<WebGLProgram>> {
let (sender, receiver) = ipc::channel().unwrap();
renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::CreateProgram(sender))).unwrap();
let result = receiver.recv().unwrap();
result.map(|program_id| WebGLProgram::new(global, renderer, *program_id))
}
pub fn new(global: GlobalRef, renderer: Sender<CanvasMsg>, id: u32) -> Root<WebGLProgram> {
pub fn new(global: GlobalRef, renderer: IpcSender<CanvasMsg>, id: u32) -> Root<WebGLProgram> {
reflect_dom_object(box WebGLProgram::new_inherited(renderer, id), global, WebGLProgramBinding::Wrap)
}
}
@ -112,7 +113,7 @@ impl<'a> WebGLProgramHelpers for &'a WebGLProgram {
return Ok(None);
}
let (sender, receiver) = channel();
let (sender, receiver) = ipc::channel().unwrap();
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::GetAttribLocation(self.id, name, sender))).unwrap();
Ok(receiver.recv().unwrap())
}
@ -128,7 +129,7 @@ impl<'a> WebGLProgramHelpers for &'a WebGLProgram {
return Ok(None);
}
let (sender, receiver) = channel();
let (sender, receiver) = ipc::channel().unwrap();
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::GetUniformLocation(self.id, name, sender))).unwrap();
Ok(receiver.recv().unwrap())
}

View file

@ -10,7 +10,7 @@ use dom::bindings::utils::reflect_dom_object;
use dom::webglobject::WebGLObject;
use canvas_traits::{CanvasMsg, CanvasWebGLMsg};
use std::sync::mpsc::{channel, Sender};
use ipc_channel::ipc::{self, IpcSender};
use std::cell::Cell;
#[dom_struct]
@ -18,11 +18,11 @@ pub struct WebGLRenderbuffer {
webgl_object: WebGLObject,
id: u32,
is_deleted: Cell<bool>,
renderer: Sender<CanvasMsg>,
renderer: IpcSender<CanvasMsg>,
}
impl WebGLRenderbuffer {
fn new_inherited(renderer: Sender<CanvasMsg>, id: u32) -> WebGLRenderbuffer {
fn new_inherited(renderer: IpcSender<CanvasMsg>, id: u32) -> WebGLRenderbuffer {
WebGLRenderbuffer {
webgl_object: WebGLObject::new_inherited(),
id: id,
@ -31,15 +31,17 @@ impl WebGLRenderbuffer {
}
}
pub fn maybe_new(global: GlobalRef, renderer: Sender<CanvasMsg>) -> Option<Root<WebGLRenderbuffer>> {
let (sender, receiver) = channel();
pub fn maybe_new(global: GlobalRef, renderer: IpcSender<CanvasMsg>)
-> Option<Root<WebGLRenderbuffer>> {
let (sender, receiver) = ipc::channel().unwrap();
renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::CreateRenderbuffer(sender))).unwrap();
let result = receiver.recv().unwrap();
result.map(|renderbuffer_id| WebGLRenderbuffer::new(global, renderer, *renderbuffer_id))
}
pub fn new(global: GlobalRef, renderer: Sender<CanvasMsg>, id: u32) -> Root<WebGLRenderbuffer> {
pub fn new(global: GlobalRef, renderer: IpcSender<CanvasMsg>, id: u32)
-> Root<WebGLRenderbuffer> {
reflect_dom_object(box WebGLRenderbuffer::new_inherited(renderer, id), global, WebGLRenderbufferBinding::Wrap)
}
}

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use canvas::webgl_paint_task::WebGLPaintTask;
use canvas_traits::
{CanvasMsg, CanvasWebGLMsg, CanvasCommonMsg, WebGLError,
WebGLShaderParameter, WebGLFramebufferBindingRequest};
@ -23,14 +22,16 @@ use dom::webglshader::{WebGLShader, WebGLShaderHelpers};
use dom::webglprogram::{WebGLProgram, WebGLProgramHelpers};
use dom::webgluniformlocation::{WebGLUniformLocation, WebGLUniformLocationHelpers};
use euclid::size::Size2D;
use ipc_channel::ipc::{self, IpcSender};
use js::jsapi::{JSContext, JSObject, RootedValue};
use js::jsapi::{JS_GetFloat32ArrayData, JS_GetObjectAsArrayBufferView};
use js::jsval::{JSVal, UndefinedValue, NullValue, Int32Value, BooleanValue};
use msg::constellation_msg::Msg as ConstellationMsg;
use std::cell::Cell;
use std::mem;
use std::ptr;
use std::slice;
use std::sync::mpsc::{channel, Sender};
use std::sync::mpsc::channel;
use util::str::DOMString;
use offscreen_gl_context::GLContextAttributes;
@ -52,7 +53,8 @@ macro_rules! handle_potential_webgl_error {
pub struct WebGLRenderingContext {
reflector_: Reflector,
global: GlobalField,
renderer: Sender<CanvasMsg>,
renderer_id: usize,
ipc_renderer: IpcSender<CanvasMsg>,
canvas: JS<HTMLCanvasElement>,
last_error: Cell<Option<WebGLError>>,
}
@ -63,12 +65,17 @@ impl WebGLRenderingContext {
size: Size2D<i32>,
attrs: GLContextAttributes)
-> Result<WebGLRenderingContext, &'static str> {
let chan = try!(WebGLPaintTask::start(size, attrs));
let (sender, receiver) = ipc::channel().unwrap();
let constellation_chan = global.constellation_chan();
constellation_chan.0
.send(ConstellationMsg::CreateWebGLPaintTask(size, attrs, sender))
.unwrap();
let (ipc_renderer, renderer_id) = receiver.recv().unwrap();
Ok(WebGLRenderingContext {
reflector_: Reflector::new(),
global: GlobalField::from_rooted(&global),
renderer: chan,
renderer_id: renderer_id,
ipc_renderer: ipc_renderer,
last_error: Cell::new(None),
canvas: JS::from_ref(canvas),
})
@ -87,13 +94,13 @@ impl WebGLRenderingContext {
}
pub fn recreate(&self, size: Size2D<i32>) {
self.renderer.send(CanvasMsg::Common(CanvasCommonMsg::Recreate(size))).unwrap();
self.ipc_renderer.send(CanvasMsg::Common(CanvasCommonMsg::Recreate(size))).unwrap();
}
}
impl Drop for WebGLRenderingContext {
fn drop(&mut self) {
self.renderer.send(CanvasMsg::Common(CanvasCommonMsg::Close)).unwrap();
self.ipc_renderer.send(CanvasMsg::Common(CanvasCommonMsg::Close)).unwrap();
}
}
@ -105,15 +112,19 @@ impl<'a> WebGLRenderingContextMethods for &'a WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.1
fn DrawingBufferWidth(self) -> i32 {
let (sender, receiver) = channel();
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::DrawingBufferWidth(sender))).unwrap();
let (sender, receiver) = ipc::channel().unwrap();
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::DrawingBufferWidth(sender)))
.unwrap();
receiver.recv().unwrap()
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.1
fn DrawingBufferHeight(self) -> i32 {
let (sender, receiver) = channel();
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::DrawingBufferHeight(sender))).unwrap();
let (sender, receiver) = ipc::channel().unwrap();
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::DrawingBufferHeight(sender)))
.unwrap();
receiver.recv().unwrap()
}
@ -151,10 +162,11 @@ impl<'a> WebGLRenderingContextMethods for &'a WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.2
fn GetContextAttributes(self) -> Option<WebGLContextAttributes> {
let (sender, receiver) = channel();
let (sender, receiver) = ipc::channel().unwrap();
// If the send does not succeed, assume context lost
if let Err(_) = self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::GetContextAttributes(sender))) {
if let Err(_) = self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::GetContextAttributes(sender))) {
return None;
}
let attrs = receiver.recv().unwrap();
@ -180,32 +192,36 @@ impl<'a> WebGLRenderingContextMethods for &'a WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
fn ActiveTexture(self, texture: u32) {
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::ActiveTexture(texture))).unwrap();
self.ipc_renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::ActiveTexture(texture))).unwrap();
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
fn BlendColor(self, r: f32, g: f32, b: f32, a: f32) {
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::BlendColor(r, g, b, a))).unwrap();
self.ipc_renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::BlendColor(r, g, b, a))).unwrap();
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
fn BlendEquation(self, mode: u32) {
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::BlendEquation(mode))).unwrap();
self.ipc_renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::BlendEquation(mode))).unwrap();
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
fn BlendEquationSeparate(self, mode_rgb: u32, mode_alpha: u32) {
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::BlendEquationSeparate(mode_rgb, mode_alpha))).unwrap();
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::BlendEquationSeparate(mode_rgb, mode_alpha)))
.unwrap();
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
fn BlendFunc(self, src_factor: u32, dest_factor: u32) {
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::BlendFunc(src_factor, dest_factor))).unwrap();
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::BlendFunc(src_factor, dest_factor)))
.unwrap();
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
fn BlendFuncSeparate(self, src_rgb: u32, dest_rgb: u32, src_alpha: u32, dest_alpha: u32) {
self.renderer.send(
self.ipc_renderer.send(
CanvasMsg::WebGL(CanvasWebGLMsg::BlendFuncSeparate(src_rgb, dest_rgb, src_alpha, dest_alpha))).unwrap();
}
@ -224,7 +240,9 @@ impl<'a> WebGLRenderingContextMethods for &'a WebGLRenderingContext {
buffer.bind(target)
} else {
// Unbind the current buffer
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::BindBuffer(target, 0))).unwrap()
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::BindBuffer(target, 0)))
.unwrap()
}
}
@ -235,7 +253,7 @@ impl<'a> WebGLRenderingContextMethods for &'a WebGLRenderingContext {
} else {
// Bind the default framebuffer
let cmd = CanvasWebGLMsg::BindFramebuffer(target, WebGLFramebufferBindingRequest::Default);
self.renderer.send(CanvasMsg::WebGL(cmd)).unwrap();
self.ipc_renderer.send(CanvasMsg::WebGL(cmd)).unwrap();
}
}
@ -245,7 +263,9 @@ impl<'a> WebGLRenderingContextMethods for &'a WebGLRenderingContext {
renderbuffer.bind(target)
} else {
// Unbind the currently bound renderbuffer
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::BindRenderbuffer(target, 0))).unwrap()
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::BindRenderbuffer(target, 0)))
.unwrap()
}
}
@ -274,17 +294,21 @@ impl<'a> WebGLRenderingContextMethods for &'a WebGLRenderingContext {
let data_vec_length = length / mem::size_of::<f32>() as u32;
slice::from_raw_parts(data_f32, data_vec_length as usize).to_vec()
};
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::BufferData(target, data_vec, usage))).unwrap()
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::BufferData(target, data_vec, usage)))
.unwrap()
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11
fn Clear(self, mask: u32) {
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::Clear(mask))).unwrap()
self.ipc_renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::Clear(mask))).unwrap()
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
fn ClearColor(self, red: f32, green: f32, blue: f32, alpha: f32) {
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::ClearColor(red, green, blue, alpha))).unwrap()
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::ClearColor(red, green, blue, alpha)))
.unwrap()
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
@ -298,34 +322,34 @@ impl<'a> WebGLRenderingContextMethods for &'a WebGLRenderingContext {
// generated objects, either here or in the webgl task
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
fn CreateBuffer(self) -> Option<Root<WebGLBuffer>> {
WebGLBuffer::maybe_new(self.global.root().r(), self.renderer.clone())
WebGLBuffer::maybe_new(self.global.root().r(), self.ipc_renderer.clone())
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.6
fn CreateFramebuffer(self) -> Option<Root<WebGLFramebuffer>> {
WebGLFramebuffer::maybe_new(self.global.root().r(), self.renderer.clone())
WebGLFramebuffer::maybe_new(self.global.root().r(), self.ipc_renderer.clone())
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.7
fn CreateRenderbuffer(self) -> Option<Root<WebGLRenderbuffer>> {
WebGLRenderbuffer::maybe_new(self.global.root().r(), self.renderer.clone())
WebGLRenderbuffer::maybe_new(self.global.root().r(), self.ipc_renderer.clone())
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
fn CreateTexture(self) -> Option<Root<WebGLTexture>> {
WebGLTexture::maybe_new(self.global.root().r(), self.renderer.clone())
WebGLTexture::maybe_new(self.global.root().r(), self.ipc_renderer.clone())
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
fn CreateProgram(self) -> Option<Root<WebGLProgram>> {
WebGLProgram::maybe_new(self.global.root().r(), self.renderer.clone())
WebGLProgram::maybe_new(self.global.root().r(), self.ipc_renderer.clone())
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
// TODO(ecoal95): Check if constants are cross-platform or if we must make a translation
// between WebGL constants and native ones.
fn CreateShader(self, shader_type: u32) -> Option<Root<WebGLShader>> {
WebGLShader::maybe_new(self.global.root().r(), self.renderer.clone(), shader_type)
WebGLShader::maybe_new(self.global.root().r(), self.ipc_renderer.clone(), shader_type)
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
@ -372,12 +396,16 @@ impl<'a> WebGLRenderingContextMethods for &'a WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11
fn DrawArrays(self, mode: u32, first: i32, count: i32) {
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::DrawArrays(mode, first, count))).unwrap()
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::DrawArrays(mode, first, count)))
.unwrap()
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn EnableVertexAttribArray(self, attrib_id: u32) {
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::EnableVertexAttribArray(attrib_id))).unwrap()
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::EnableVertexAttribArray(attrib_id)))
.unwrap()
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
@ -466,7 +494,9 @@ impl<'a> WebGLRenderingContextMethods for &'a WebGLRenderingContext {
let data_f32 = JS_GetFloat32ArrayData(data, ptr::null());
slice::from_raw_parts(data_f32, 4).to_vec()
};
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::Uniform4fv(uniform_id, data_vec))).unwrap()
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::Uniform4fv(uniform_id, data_vec)))
.unwrap()
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
@ -483,7 +513,7 @@ impl<'a> WebGLRenderingContextMethods for &'a WebGLRenderingContext {
constants::FLOAT => {
let msg = CanvasMsg::WebGL(
CanvasWebGLMsg::VertexAttribPointer2f(attrib_id, size, normalized, stride, offset));
self.renderer.send(msg).unwrap()
self.ipc_renderer.send(msg).unwrap()
}
_ => panic!("VertexAttribPointer: Data Type not supported")
}
@ -492,7 +522,9 @@ impl<'a> WebGLRenderingContextMethods for &'a WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.4
fn Viewport(self, x: i32, y: i32, width: i32, height: i32) {
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::Viewport(x, y, width, height))).unwrap()
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::Viewport(x, y, width, height)))
.unwrap()
}
}
@ -512,12 +544,18 @@ impl<'a> WebGLRenderingContextHelpers for &'a WebGLRenderingContext {
pub trait LayoutCanvasWebGLRenderingContextHelpers {
#[allow(unsafe_code)]
unsafe fn get_renderer(&self) -> Sender<CanvasMsg>;
unsafe fn get_renderer_id(&self) -> usize;
#[allow(unsafe_code)]
unsafe fn get_ipc_renderer(&self) -> IpcSender<CanvasMsg>;
}
impl LayoutCanvasWebGLRenderingContextHelpers for LayoutJS<WebGLRenderingContext> {
#[allow(unsafe_code)]
unsafe fn get_renderer(&self) -> Sender<CanvasMsg> {
(*self.unsafe_get()).renderer.clone()
unsafe fn get_renderer_id(&self) -> usize {
(*self.unsafe_get()).renderer_id
}
#[allow(unsafe_code)]
unsafe fn get_ipc_renderer(&self) -> IpcSender<CanvasMsg> {
(*self.unsafe_get()).ipc_renderer.clone()
}
}

View file

@ -12,7 +12,7 @@ use dom::webglobject::WebGLObject;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
use canvas_traits::{CanvasMsg, CanvasWebGLMsg, WebGLResult, WebGLError, WebGLShaderParameter};
use std::sync::mpsc::{channel, Sender};
use ipc_channel::ipc::{self, IpcSender};
use std::cell::Cell;
use std::cell::RefCell;
@ -24,11 +24,11 @@ pub struct WebGLShader {
source: RefCell<Option<String>>,
is_deleted: Cell<bool>,
// TODO(ecoal95): Evaluate moving this to `WebGLObject`
renderer: Sender<CanvasMsg>,
renderer: IpcSender<CanvasMsg>,
}
impl WebGLShader {
fn new_inherited(renderer: Sender<CanvasMsg>, id: u32, shader_type: u32) -> WebGLShader {
fn new_inherited(renderer: IpcSender<CanvasMsg>, id: u32, shader_type: u32) -> WebGLShader {
WebGLShader {
webgl_object: WebGLObject::new_inherited(),
id: id,
@ -40,9 +40,9 @@ impl WebGLShader {
}
pub fn maybe_new(global: GlobalRef,
renderer: Sender<CanvasMsg>,
renderer: IpcSender<CanvasMsg>,
shader_type: u32) -> Option<Root<WebGLShader>> {
let (sender, receiver) = channel();
let (sender, receiver) = ipc::channel().unwrap();
renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::CreateShader(shader_type, sender))).unwrap();
let result = receiver.recv().unwrap();
@ -50,7 +50,7 @@ impl WebGLShader {
}
pub fn new(global: GlobalRef,
renderer: Sender<CanvasMsg>,
renderer: IpcSender<CanvasMsg>,
id: u32,
shader_type: u32) -> Root<WebGLShader> {
reflect_dom_object(
@ -95,7 +95,7 @@ impl<'a> WebGLShaderHelpers for &'a WebGLShader {
/// glGetShaderInfoLog
fn info_log(self) -> Option<String> {
let (sender, receiver) = channel();
let (sender, receiver) = ipc::channel().unwrap();
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::GetShaderInfoLog(self.id, sender))).unwrap();
receiver.recv().unwrap()
}
@ -107,7 +107,7 @@ impl<'a> WebGLShaderHelpers for &'a WebGLShader {
_ => return Err(WebGLError::InvalidEnum),
}
let (sender, receiver) = channel();
let (sender, receiver) = ipc::channel().unwrap();
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::GetShaderParameter(self.id, param_id, sender))).unwrap();
Ok(receiver.recv().unwrap())
}

View file

@ -10,7 +10,7 @@ use dom::bindings::utils::reflect_dom_object;
use dom::webglobject::WebGLObject;
use canvas_traits::{CanvasMsg, CanvasWebGLMsg};
use std::sync::mpsc::{channel, Sender};
use ipc_channel::ipc::{self, IpcSender};
use std::cell::Cell;
#[dom_struct]
@ -18,11 +18,11 @@ pub struct WebGLTexture {
webgl_object: WebGLObject,
id: u32,
is_deleted: Cell<bool>,
renderer: Sender<CanvasMsg>,
renderer: IpcSender<CanvasMsg>,
}
impl WebGLTexture {
fn new_inherited(renderer: Sender<CanvasMsg>, id: u32) -> WebGLTexture {
fn new_inherited(renderer: IpcSender<CanvasMsg>, id: u32) -> WebGLTexture {
WebGLTexture {
webgl_object: WebGLObject::new_inherited(),
id: id,
@ -31,15 +31,16 @@ impl WebGLTexture {
}
}
pub fn maybe_new(global: GlobalRef, renderer: Sender<CanvasMsg>) -> Option<Root<WebGLTexture>> {
let (sender, receiver) = channel();
pub fn maybe_new(global: GlobalRef, renderer: IpcSender<CanvasMsg>)
-> Option<Root<WebGLTexture>> {
let (sender, receiver) = ipc::channel().unwrap();
renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::CreateTexture(sender))).unwrap();
let result = receiver.recv().unwrap();
result.map(|texture_id| WebGLTexture::new(global, renderer, *texture_id))
}
pub fn new(global: GlobalRef, renderer: Sender<CanvasMsg>, id: u32) -> Root<WebGLTexture> {
pub fn new(global: GlobalRef, renderer: IpcSender<CanvasMsg>, id: u32) -> Root<WebGLTexture> {
reflect_dom_object(box WebGLTexture::new_inherited(renderer, id), global, WebGLTextureBinding::Wrap)
}
}

View file

@ -70,6 +70,7 @@ impl Worker {
};
let resource_task = global.resource_task();
let constellation_chan = global.constellation_chan();
let (sender, receiver) = channel();
let worker = Worker::new(global, sender.clone());
@ -91,7 +92,7 @@ impl Worker {
DedicatedWorkerGlobalScope::run_worker_scope(
worker_url, global.pipeline(), global.mem_profiler_chan(), global.devtools_chan(),
worker_ref, resource_task, global.script_chan(), sender, receiver);
worker_ref, resource_task, constellation_chan, global.script_chan(), sender, receiver);
Ok(worker)
}

View file

@ -22,7 +22,7 @@ use timers::{IsInterval, TimerId, TimerManager, TimerCallback};
use devtools_traits::DevtoolsControlChan;
use msg::constellation_msg::{PipelineId, WorkerId};
use msg::constellation_msg::{ConstellationChan, PipelineId, WorkerId};
use profile_traits::mem;
use net_traits::{load_whole_resource, ResourceTask};
use util::str::DOMString;
@ -55,6 +55,7 @@ pub struct WorkerGlobalScope {
timers: TimerManager,
mem_profiler_chan: mem::ProfilerChan,
devtools_chan: Option<DevtoolsControlChan>,
constellation_chan: ConstellationChan,
}
impl WorkerGlobalScope {
@ -63,7 +64,8 @@ impl WorkerGlobalScope {
runtime: Rc<Runtime>,
resource_task: ResourceTask,
mem_profiler_chan: mem::ProfilerChan,
devtools_chan: Option<DevtoolsControlChan>) -> WorkerGlobalScope {
devtools_chan: Option<DevtoolsControlChan>,
constellation_chan: ConstellationChan) -> WorkerGlobalScope {
WorkerGlobalScope {
eventtarget: EventTarget::new_inherited(EventTargetTypeId::WorkerGlobalScope(type_id)),
next_worker_id: Cell::new(WorkerId(0)),
@ -77,6 +79,7 @@ impl WorkerGlobalScope {
timers: TimerManager::new(),
mem_profiler_chan: mem_profiler_chan,
devtools_chan: devtools_chan,
constellation_chan: constellation_chan,
}
}
@ -88,6 +91,10 @@ impl WorkerGlobalScope {
self.devtools_chan.clone()
}
pub fn constellation_chan(&self) -> ConstellationChan {
self.constellation_chan.clone()
}
#[inline]
pub fn eventtarget<'a>(&'a self) -> &'a EventTarget {
&self.eventtarget

View file

@ -61,7 +61,7 @@ dependencies = [
"core-graphics 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-text 0.1.0 (git+https://github.com/servo/core-text-rs)",
"egl 0.1.0 (git+https://github.com/servo/rust-egl)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype)",
"freetype-sys 2.4.11 (git+https://github.com/servo/libfreetype2)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -92,8 +92,8 @@ version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"canvas_traits 0.0.1",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
@ -109,12 +109,14 @@ name = "canvas_traits"
version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
"layers 0.1.0 (git+https://github.com/servo/rust-layers)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
"serde 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -158,11 +160,13 @@ name = "compositing"
version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"canvas 0.0.1",
"canvas_traits 0.0.1",
"clipboard 0.0.1 (git+https://github.com/aweinstock314/rust-clipboard)",
"core-graphics 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-text 0.1.0 (git+https://github.com/servo/core-text-rs)",
"devtools_traits 0.0.1",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"gfx_traits 0.0.1",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -175,6 +179,7 @@ dependencies = [
"net 0.0.1",
"net_traits 0.0.1",
"num 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
"png 0.1.0 (git+https://github.com/servo/rust-png)",
"profile_traits 0.0.1",
"script_traits 0.0.1",
@ -224,11 +229,13 @@ dependencies = [
[[package]]
name = "cssparser"
version = "0.3.2"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -339,7 +346,7 @@ dependencies = [
[[package]]
name = "euclid"
version = "0.1.2"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -431,7 +438,7 @@ dependencies = [
"core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-text 0.1.0 (git+https://github.com/servo/core-text-rs)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fontconfig 0.1.0 (git+https://github.com/servo/rust-fontconfig)",
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype)",
@ -533,7 +540,7 @@ dependencies = [
"cgl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"compositing 0.0.1",
"egl 0.1.0 (git+https://github.com/servo/rust-egl)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"glutin 0.0.26 (git+https://github.com/servo/glutin?branch=servo)",
"layers 0.1.0 (git+https://github.com/servo/rust-layers)",
@ -633,7 +640,7 @@ source = "git+https://github.com/servo/io-surface-rs#f772aa79f487d1722ec6ad3d3c3
dependencies = [
"cgl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -690,7 +697,7 @@ dependencies = [
"cgl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"egl 0.1.0 (git+https://github.com/servo/rust-egl)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"glx 0.0.1 (git+https://github.com/servo/rust-glx)",
"io-surface 0.1.0 (git+https://github.com/servo/io-surface-rs)",
@ -710,9 +717,9 @@ dependencies = [
"canvas 0.0.1",
"canvas_traits 0.0.1",
"clock_ticks 0.0.6 (git+https://github.com/tomaka/clock_ticks)",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"gfx_traits 0.0.1",
@ -743,7 +750,7 @@ dependencies = [
name = "layout_traits"
version = "0.0.1"
dependencies = [
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
"msg 0.0.1",
@ -836,12 +843,14 @@ version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"canvas_traits 0.0.1",
"core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"io-surface 0.1.0 (git+https://github.com/servo/io-surface-rs)",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
"layers 0.1.0 (git+https://github.com/servo/rust-layers)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
"png 0.1.0 (git+https://github.com/servo/rust-png)",
"rustc-serialize 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -857,7 +866,7 @@ version = "0.0.1"
dependencies = [
"cookie 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"devtools_traits 0.0.1",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"flate2 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -890,7 +899,7 @@ dependencies = [
name = "net_traits"
version = "0.0.1"
dependencies = [
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
"log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -936,7 +945,7 @@ source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#724d47
dependencies = [
"cgl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gl_generator 0.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1142,10 +1151,10 @@ dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"canvas 0.0.1",
"canvas_traits 0.0.1",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"devtools_traits 0.0.1",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1191,7 +1200,7 @@ name = "script_traits"
version = "0.0.1"
dependencies = [
"devtools_traits 0.0.1",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
@ -1209,7 +1218,7 @@ version = "0.1.0"
source = "git+https://github.com/servo/rust-selectors#625734e1e8d70c012672b248adca302d0276fe08"
dependencies = [
"bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quicksort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1260,7 +1269,7 @@ source = "git+https://github.com/servo/skia#62a452b39294d94e60f279eacbb71a0b3296
dependencies = [
"cgl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"egl 0.1.0 (git+https://github.com/servo/rust-egl)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"expat-sys 2.1.0 (git+https://github.com/servo/libexpat)",
"freetype-sys 2.4.11 (git+https://github.com/servo/libfreetype2)",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1326,9 +1335,9 @@ name = "style"
version = "0.0.1"
dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1350,8 +1359,8 @@ dependencies = [
name = "style_tests"
version = "0.0.1"
dependencies = [
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)",
"string_cache 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1448,8 +1457,8 @@ version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1468,7 +1477,7 @@ dependencies = [
name = "util_tests"
version = "0.0.1"
dependencies = [
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"util 0.0.1",

View file

@ -15,10 +15,13 @@ path = "../plugins"
[dependencies.util]
path = "../util"
[dependencies.selectors]
git = "https://github.com/servo/rust-selectors"
[dependencies.cssparser]
version = "0.3"
features = [ "serde-serialization" ]
[dependencies]
log = "0.3"
encoding = "0.2"
@ -27,7 +30,6 @@ rustc-serialize = "0.3"
matches = "0.1"
url = "0.2.36"
bitflags = "0.3"
cssparser = "0.3.2"
num = "0.1.24"
lazy_static = "0.1.10"
smallvec = "0.1"

View file

@ -21,6 +21,10 @@ path = "../plugins"
[dependencies.azure]
git = "https://github.com/servo/rust-azure"
[dependencies.cssparser]
version = "0.3"
features = [ "serde-serialization" ]
[dependencies]
log = "0.3"
bitflags = "0.3"
@ -29,7 +33,6 @@ rand = "0.3"
rustc-serialize = "0.3"
smallvec = "0.1"
num_cpus = "0.2.2"
cssparser = "0.3.1"
num = "0.1.24"
url = "0.2.36"
euclid = "0.1"

67
ports/cef/Cargo.lock generated
View file

@ -10,7 +10,7 @@ dependencies = [
"core-graphics 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-text 0.1.0 (git+https://github.com/servo/core-text-rs)",
"devtools 0.0.1",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"glutin_app 0.0.1",
@ -60,7 +60,7 @@ dependencies = [
"core-graphics 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-text 0.1.0 (git+https://github.com/servo/core-text-rs)",
"egl 0.1.0 (git+https://github.com/servo/rust-egl)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype)",
"freetype-sys 2.4.11 (git+https://github.com/servo/libfreetype2)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -91,8 +91,8 @@ version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"canvas_traits 0.0.1",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
@ -108,12 +108,14 @@ name = "canvas_traits"
version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
"layers 0.1.0 (git+https://github.com/servo/rust-layers)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
"serde 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -157,11 +159,13 @@ name = "compositing"
version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"canvas 0.0.1",
"canvas_traits 0.0.1",
"clipboard 0.0.1 (git+https://github.com/aweinstock314/rust-clipboard)",
"core-graphics 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-text 0.1.0 (git+https://github.com/servo/core-text-rs)",
"devtools_traits 0.0.1",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"gfx_traits 0.0.1",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -174,6 +178,7 @@ dependencies = [
"net 0.0.1",
"net_traits 0.0.1",
"num 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
"png 0.1.0 (git+https://github.com/servo/rust-png)",
"profile_traits 0.0.1",
"script_traits 0.0.1",
@ -223,11 +228,13 @@ dependencies = [
[[package]]
name = "cssparser"
version = "0.3.2"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -338,7 +345,7 @@ dependencies = [
[[package]]
name = "euclid"
version = "0.1.2"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -430,7 +437,7 @@ dependencies = [
"core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-text 0.1.0 (git+https://github.com/servo/core-text-rs)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fontconfig 0.1.0 (git+https://github.com/servo/rust-fontconfig)",
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype)",
@ -525,7 +532,7 @@ dependencies = [
"cgl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"compositing 0.0.1",
"egl 0.1.0 (git+https://github.com/servo/rust-egl)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"glutin 0.0.26 (git+https://github.com/servo/glutin?branch=servo)",
"layers 0.1.0 (git+https://github.com/servo/rust-layers)",
@ -625,7 +632,7 @@ source = "git+https://github.com/servo/io-surface-rs#f772aa79f487d1722ec6ad3d3c3
dependencies = [
"cgl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -682,7 +689,7 @@ dependencies = [
"cgl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"egl 0.1.0 (git+https://github.com/servo/rust-egl)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"glx 0.0.1 (git+https://github.com/servo/rust-glx)",
"io-surface 0.1.0 (git+https://github.com/servo/io-surface-rs)",
@ -702,9 +709,9 @@ dependencies = [
"canvas 0.0.1",
"canvas_traits 0.0.1",
"clock_ticks 0.0.6 (git+https://github.com/tomaka/clock_ticks)",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"gfx_traits 0.0.1",
@ -735,7 +742,7 @@ dependencies = [
name = "layout_traits"
version = "0.0.1"
dependencies = [
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
"msg 0.0.1",
@ -828,12 +835,14 @@ version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"canvas_traits 0.0.1",
"core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"io-surface 0.1.0 (git+https://github.com/servo/io-surface-rs)",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
"layers 0.1.0 (git+https://github.com/servo/rust-layers)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
"png 0.1.0 (git+https://github.com/servo/rust-png)",
"rustc-serialize 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -849,7 +858,7 @@ version = "0.0.1"
dependencies = [
"cookie 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"devtools_traits 0.0.1",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"flate2 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -869,7 +878,7 @@ dependencies = [
name = "net_traits"
version = "0.0.1"
dependencies = [
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
"log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -915,7 +924,7 @@ source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#724d47
dependencies = [
"cgl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gl_generator 0.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1121,10 +1130,10 @@ dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"canvas 0.0.1",
"canvas_traits 0.0.1",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"devtools_traits 0.0.1",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1162,7 +1171,7 @@ name = "script_traits"
version = "0.0.1"
dependencies = [
"devtools_traits 0.0.1",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
@ -1180,7 +1189,7 @@ version = "0.1.0"
source = "git+https://github.com/servo/rust-selectors#625734e1e8d70c012672b248adca302d0276fe08"
dependencies = [
"bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quicksort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1257,7 +1266,7 @@ source = "git+https://github.com/servo/skia#62a452b39294d94e60f279eacbb71a0b3296
dependencies = [
"cgl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"egl 0.1.0 (git+https://github.com/servo/rust-egl)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"expat-sys 2.1.0 (git+https://github.com/servo/libexpat)",
"freetype-sys 2.4.11 (git+https://github.com/servo/libfreetype2)",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1323,9 +1332,9 @@ name = "style"
version = "0.0.1"
dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1431,8 +1440,8 @@ version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",

65
ports/gonk/Cargo.lock generated
View file

@ -7,7 +7,7 @@ dependencies = [
"egl 0.1.0 (git+https://github.com/servo/rust-egl)",
"env_logger 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"errno 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.1.0 (git+https://github.com/servo/rust-layers)",
@ -47,7 +47,7 @@ dependencies = [
"core-graphics 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-text 0.1.0 (git+https://github.com/servo/core-text-rs)",
"egl 0.1.0 (git+https://github.com/servo/rust-egl)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype)",
"freetype-sys 2.4.11 (git+https://github.com/servo/libfreetype2)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -78,8 +78,8 @@ version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"canvas_traits 0.0.1",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
@ -95,12 +95,14 @@ name = "canvas_traits"
version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
"layers 0.1.0 (git+https://github.com/servo/rust-layers)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
"serde 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -134,11 +136,13 @@ name = "compositing"
version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"canvas 0.0.1",
"canvas_traits 0.0.1",
"clipboard 0.0.1 (git+https://github.com/aweinstock314/rust-clipboard)",
"core-graphics 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-text 0.1.0 (git+https://github.com/servo/core-text-rs)",
"devtools_traits 0.0.1",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"gfx_traits 0.0.1",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -151,6 +155,7 @@ dependencies = [
"net 0.0.1",
"net_traits 0.0.1",
"num 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
"png 0.1.0 (git+https://github.com/servo/rust-png)",
"profile_traits 0.0.1",
"script_traits 0.0.1",
@ -200,11 +205,13 @@ dependencies = [
[[package]]
name = "cssparser"
version = "0.3.2"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -325,7 +332,7 @@ dependencies = [
[[package]]
name = "euclid"
version = "0.1.2"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -409,7 +416,7 @@ dependencies = [
"core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-text 0.1.0 (git+https://github.com/servo/core-text-rs)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fontconfig 0.1.0 (git+https://github.com/servo/rust-fontconfig)",
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype)",
@ -559,7 +566,7 @@ source = "git+https://github.com/servo/io-surface-rs#f772aa79f487d1722ec6ad3d3c3
dependencies = [
"cgl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -616,7 +623,7 @@ dependencies = [
"cgl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"egl 0.1.0 (git+https://github.com/servo/rust-egl)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"glx 0.0.1 (git+https://github.com/servo/rust-glx)",
"io-surface 0.1.0 (git+https://github.com/servo/io-surface-rs)",
@ -636,9 +643,9 @@ dependencies = [
"canvas 0.0.1",
"canvas_traits 0.0.1",
"clock_ticks 0.0.6 (git+https://github.com/tomaka/clock_ticks)",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"gfx_traits 0.0.1",
@ -669,7 +676,7 @@ dependencies = [
name = "layout_traits"
version = "0.0.1"
dependencies = [
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
"msg 0.0.1",
@ -754,12 +761,14 @@ version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"canvas_traits 0.0.1",
"core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"io-surface 0.1.0 (git+https://github.com/servo/io-surface-rs)",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
"layers 0.1.0 (git+https://github.com/servo/rust-layers)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
"png 0.1.0 (git+https://github.com/servo/rust-png)",
"rustc-serialize 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -775,7 +784,7 @@ version = "0.0.1"
dependencies = [
"cookie 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"devtools_traits 0.0.1",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"flate2 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -795,7 +804,7 @@ dependencies = [
name = "net_traits"
version = "0.0.1"
dependencies = [
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
"log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -832,7 +841,7 @@ source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#724d47
dependencies = [
"cgl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gl_generator 0.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1029,10 +1038,10 @@ dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"canvas 0.0.1",
"canvas_traits 0.0.1",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"devtools_traits 0.0.1",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1070,7 +1079,7 @@ name = "script_traits"
version = "0.0.1"
dependencies = [
"devtools_traits 0.0.1",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
@ -1088,7 +1097,7 @@ version = "0.1.0"
source = "git+https://github.com/servo/rust-selectors#625734e1e8d70c012672b248adca302d0276fe08"
dependencies = [
"bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quicksort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1155,7 +1164,7 @@ source = "git+https://github.com/servo/skia#62a452b39294d94e60f279eacbb71a0b3296
dependencies = [
"cgl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"egl 0.1.0 (git+https://github.com/servo/rust-egl)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"expat-sys 2.1.0 (git+https://github.com/servo/libexpat)",
"freetype-sys 2.4.11 (git+https://github.com/servo/libfreetype2)",
"gleam 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1221,9 +1230,9 @@ name = "style"
version = "0.0.1"
dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1320,8 +1329,8 @@ version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",