diff --git a/Cargo.lock b/Cargo.lock index 8d8548591a4..f162070384d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -274,6 +274,7 @@ dependencies = [ "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "offscreen_gl_context 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_bytes 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "servo_config 0.0.1", "webrender 0.57.0 (git+https://github.com/servo/webrender)", "webrender_api 0.57.0 (git+https://github.com/servo/webrender)", @@ -292,6 +293,7 @@ dependencies = [ "nonzero 0.0.1", "offscreen_gl_context 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_bytes 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "servo_config 0.0.1", "webrender_api 0.57.0 (git+https://github.com/servo/webrender)", ] @@ -1633,6 +1635,7 @@ dependencies = [ "hashglobe 0.1.0", "mozjs 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.19.0", + "serde_bytes 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "servo_arc 0.1.1", "smallbitvec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2514,6 +2517,7 @@ dependencies = [ "script_traits 0.0.1", "selectors 0.19.0", "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_bytes 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "servo_allocator 0.0.1", "servo_arc 0.1.1", diff --git a/components/canvas/Cargo.toml b/components/canvas/Cargo.toml index 576f948e4bd..d99b799cea4 100644 --- a/components/canvas/Cargo.toml +++ b/components/canvas/Cargo.toml @@ -21,6 +21,7 @@ ipc-channel = "0.10" log = "0.3.5" num-traits = "0.1.32" offscreen_gl_context = { version = "0.15", features = ["serde", "osmesa"] } +serde_bytes = "0.10" servo_config = {path = "../config"} webrender = {git = "https://github.com/servo/webrender"} webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]} diff --git a/components/canvas/canvas_paint_thread.rs b/components/canvas/canvas_paint_thread.rs index b3e6093f6f0..d464f6488e5 100644 --- a/components/canvas/canvas_paint_thread.rs +++ b/components/canvas/canvas_paint_thread.rs @@ -13,6 +13,7 @@ use cssparser::RGBA; use euclid::{Transform2D, Point2D, Vector2D, Rect, Size2D}; use ipc_channel::ipc::{self, IpcSender}; use num_traits::ToPrimitive; +use serde_bytes::ByteBuf; use std::borrow::ToOwned; use std::mem; use std::sync::Arc; @@ -145,9 +146,20 @@ impl<'a> CanvasPaintThread<'a> { Canvas2dMsg::IsPointInPath(x, y, fill_rule, chan) => { painter.is_point_in_path(x, y, fill_rule, chan) }, - Canvas2dMsg::DrawImage(imagedata, image_size, dest_rect, source_rect, - smoothing_enabled) => { - painter.draw_image(imagedata, image_size, dest_rect, source_rect, smoothing_enabled) + Canvas2dMsg::DrawImage( + imagedata, + image_size, + dest_rect, + source_rect, + smoothing_enabled, + ) => { + painter.draw_image( + imagedata.into(), + image_size, + dest_rect, + source_rect, + smoothing_enabled, + ) } Canvas2dMsg::DrawImageSelf(image_size, dest_rect, source_rect, smoothing_enabled) => { painter.draw_image_self(image_size, dest_rect, source_rect, smoothing_enabled) @@ -189,8 +201,19 @@ impl<'a> CanvasPaintThread<'a> { Canvas2dMsg::SetGlobalComposition(op) => painter.set_global_composition(op), Canvas2dMsg::GetImageData(dest_rect, canvas_size, chan) => painter.image_data(dest_rect, canvas_size, chan), - Canvas2dMsg::PutImageData(imagedata, offset, image_data_size, dirty_rect) - => painter.put_image_data(imagedata, offset, image_data_size, dirty_rect), + Canvas2dMsg::PutImageData( + imagedata, + offset, + image_data_size, + dirty_rect, + ) => { + painter.put_image_data( + imagedata.into(), + offset, + image_data_size, + dirty_rect, + ) + } Canvas2dMsg::SetShadowOffsetX(value) => painter.set_shadow_offset_x(value), Canvas2dMsg::SetShadowOffsetY(value) => painter.set_shadow_offset_y(value), Canvas2dMsg::SetShadowBlur(value) => painter.set_shadow_blur(value), @@ -402,7 +425,12 @@ impl<'a> CanvasPaintThread<'a> { byte_swap(&mut image_data); let msg = CanvasMsg::Canvas2d(Canvas2dMsg::DrawImage( - image_data, source_rect.size, dest_rect, source_rect, smoothing_enabled)); + image_data.into(), + source_rect.size, + dest_rect, + source_rect, + smoothing_enabled, + )); renderer.send(msg).unwrap(); // We acknowledge to the caller here that the data was sent to the // other canvas so that if JS immediately afterwards try to get the @@ -578,9 +606,9 @@ impl<'a> CanvasPaintThread<'a> { } } - fn send_pixels(&mut self, chan: IpcSender>>) { + fn send_pixels(&mut self, chan: IpcSender>) { self.drawtarget.snapshot().get_data_surface().with_data(|element| { - chan.send(Some(element.into())).unwrap(); + chan.send(Some(Vec::from(element).into())).unwrap(); }) } @@ -632,12 +660,17 @@ impl<'a> CanvasPaintThread<'a> { }) } - fn image_data(&self, dest_rect: Rect, canvas_size: Size2D, chan: IpcSender>) { + fn image_data( + &self, + dest_rect: Rect, + canvas_size: Size2D, + chan: IpcSender, + ) { let mut dest_data = self.read_pixels(dest_rect, canvas_size); // bgra -> rgba byte_swap(&mut dest_data); - chan.send(dest_data).unwrap(); + chan.send(dest_data.into()).unwrap(); } // https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata diff --git a/components/canvas/lib.rs b/components/canvas/lib.rs index 809a69237c0..f6806f533cf 100644 --- a/components/canvas/lib.rs +++ b/components/canvas/lib.rs @@ -15,6 +15,7 @@ extern crate ipc_channel; #[macro_use] extern crate log; extern crate num_traits; extern crate offscreen_gl_context; +extern crate serde_bytes; extern crate servo_config; extern crate webrender; extern crate webrender_api; diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs index 8b6ae674825..bba93918c70 100644 --- a/components/canvas/webgl_thread.rs +++ b/components/canvas/webgl_thread.rs @@ -8,6 +8,7 @@ use euclid::Size2D; use fnv::FnvHashMap; use gleam::gl; use offscreen_gl_context::{GLContext, GLContextAttributes, GLLimits, NativeGLContextMethods}; +use serde_bytes::ByteBuf; use std::thread; use super::gl_context::{GLContextFactory, GLContextWrapper}; use webrender; @@ -904,10 +905,18 @@ impl WebGLImpl { //} } - fn read_pixels(gl: &gl::Gl, x: i32, y: i32, width: i32, height: i32, format: u32, pixel_type: u32, - chan: WebGLSender>) { + fn read_pixels( + gl: &gl::Gl, + x: i32, + y: i32, + width: i32, + height: i32, + format: u32, + pixel_type: u32, + chan: WebGLSender, + ) { let result = gl.read_pixels(x, y, width, height, format, pixel_type); - chan.send(result).unwrap() + chan.send(result.into()).unwrap() } fn active_attrib(gl: &gl::Gl, diff --git a/components/canvas_traits/Cargo.toml b/components/canvas_traits/Cargo.toml index 103b51841a0..3758e920556 100644 --- a/components/canvas_traits/Cargo.toml +++ b/components/canvas_traits/Cargo.toml @@ -19,5 +19,6 @@ malloc_size_of_derive = { path = "../malloc_size_of_derive" } nonzero = {path = "../nonzero"} offscreen_gl_context = { version = "0.15", features = ["serde"] } serde = "1.0" +serde_bytes = "0.10" servo_config = {path = "../config"} webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]} diff --git a/components/canvas_traits/canvas.rs b/components/canvas_traits/canvas.rs index 8600de36ebe..8b9feb8dff2 100644 --- a/components/canvas_traits/canvas.rs +++ b/components/canvas_traits/canvas.rs @@ -5,6 +5,7 @@ use cssparser::RGBA; use euclid::{Transform2D, Point2D, Vector2D, Rect, Size2D}; use ipc_channel::ipc::IpcSender; +use serde_bytes::ByteBuf; use std::default::Default; use std::str::FromStr; use webrender_api; @@ -33,7 +34,7 @@ pub struct CanvasImageData { pub enum Canvas2dMsg { Arc(Point2D, f32, f32, f32, bool), ArcTo(Point2D, Point2D, f32), - DrawImage(Vec, Size2D, Rect, Rect, bool), + DrawImage(ByteBuf, Size2D, Rect, Rect, bool), DrawImageSelf(Size2D, Rect, Rect, bool), DrawImageInOther( IpcSender, Size2D, Rect, Rect, bool, IpcSender<()>), @@ -46,11 +47,11 @@ pub enum Canvas2dMsg { Fill, FillText(String, f64, f64, Option), FillRect(Rect), - GetImageData(Rect, Size2D, IpcSender>), + GetImageData(Rect, Size2D, IpcSender), IsPointInPath(f64, f64, FillRule, IpcSender), LineTo(Point2D), MoveTo(Point2D), - PutImageData(Vec, Vector2D, Size2D, Rect), + PutImageData(ByteBuf, Vector2D, Size2D, Rect), QuadraticCurveTo(Point2D, Point2D), Rect(Rect), RestoreContext, @@ -79,7 +80,7 @@ pub enum FromLayoutMsg { #[derive(Clone, Deserialize, Serialize)] pub enum FromScriptMsg { - SendPixels(IpcSender>>), + SendPixels(IpcSender>), } #[derive(Clone, Deserialize, MallocSizeOf, Serialize)] @@ -138,20 +139,24 @@ impl RadialGradientStyle { #[derive(Clone, Deserialize, Serialize)] pub struct SurfaceStyle { - pub surface_data: Vec, + pub surface_data: ByteBuf, pub surface_size: Size2D, pub repeat_x: bool, pub repeat_y: bool, } impl SurfaceStyle { - pub fn new(surface_data: Vec, surface_size: Size2D, repeat_x: bool, repeat_y: bool) - -> SurfaceStyle { - SurfaceStyle { - surface_data: surface_data, - surface_size: surface_size, - repeat_x: repeat_x, - repeat_y: repeat_y, + pub fn new( + surface_data: Vec, + surface_size: Size2D, + repeat_x: bool, + repeat_y: bool, + ) -> Self { + Self { + surface_data: surface_data.into(), + surface_size, + repeat_x, + repeat_y, } } } diff --git a/components/canvas_traits/lib.rs b/components/canvas_traits/lib.rs index f05a91f596a..20423143e21 100644 --- a/components/canvas_traits/lib.rs +++ b/components/canvas_traits/lib.rs @@ -16,6 +16,7 @@ extern crate malloc_size_of; extern crate nonzero; extern crate offscreen_gl_context; #[macro_use] extern crate serde; +extern crate serde_bytes; extern crate servo_config; extern crate webrender_api; diff --git a/components/canvas_traits/webgl.rs b/components/canvas_traits/webgl.rs index 269dc42e709..1ac1156ff0d 100644 --- a/components/canvas_traits/webgl.rs +++ b/components/canvas_traits/webgl.rs @@ -5,6 +5,7 @@ use euclid::Size2D; use nonzero::NonZero; use offscreen_gl_context::{GLContextAttributes, GLLimits}; +use serde_bytes::ByteBuf; use std::fmt; use webrender_api::{DocumentId, ImageKey, PipelineId}; @@ -165,8 +166,8 @@ pub enum WebGLCommand { AttachShader(WebGLProgramId, WebGLShaderId), DetachShader(WebGLProgramId, WebGLShaderId), BindAttribLocation(WebGLProgramId, u32, String), - BufferData(u32, Vec, u32), - BufferSubData(u32, isize, Vec), + BufferData(u32, ByteBuf, u32), + BufferSubData(u32, isize, ByteBuf), Clear(u32), ClearColor(f32, f32, f32, f32), ClearDepth(f64), @@ -222,7 +223,7 @@ pub enum WebGLCommand { GetFramebufferAttachmentParameter(u32, u32, u32, WebGLSender), PolygonOffset(f32, f32), RenderbufferStorage(u32, u32, i32, i32), - ReadPixels(i32, i32, i32, i32, u32, u32, WebGLSender>), + ReadPixels(i32, i32, i32, i32, u32, u32, WebGLSender), SampleCoverage(f32, bool), Scissor(i32, i32, i32, i32), StencilFunc(u32, i32, u32), @@ -262,10 +263,10 @@ pub enum WebGLCommand { VertexAttribPointer2f(u32, i32, bool, i32, u32), GetViewport(WebGLSender<(i32, i32, i32, i32)>), SetViewport(i32, i32, i32, i32), - TexImage2D(u32, i32, i32, i32, i32, u32, u32, Vec), + TexImage2D(u32, i32, i32, i32, i32, u32, u32, ByteBuf), TexParameteri(u32, u32, i32), TexParameterf(u32, u32, f32), - TexSubImage2D(u32, i32, i32, i32, i32, i32, u32, u32, Vec), + TexSubImage2D(u32, i32, i32, i32, i32, i32, u32, u32, ByteBuf), DrawingBufferWidth(WebGLSender), DrawingBufferHeight(WebGLSender), Finish(WebGLSender<()>), @@ -401,7 +402,7 @@ pub enum WebVRCommand { /// Start presenting to a VR device. Create(WebVRDeviceId), /// Synchronize the pose information to be used in the frame. - SyncPoses(WebVRDeviceId, f64, f64, WebGLSender, ()>>), + SyncPoses(WebVRDeviceId, f64, f64, WebGLSender>), /// Submit the frame to a VR device using the specified texture coordinates. SubmitFrame(WebVRDeviceId, [f32; 4], [f32; 4]), /// Stop presenting to a VR device diff --git a/components/malloc_size_of/Cargo.toml b/components/malloc_size_of/Cargo.toml index 6f05c34f27c..41d9a9cc924 100644 --- a/components/malloc_size_of/Cargo.toml +++ b/components/malloc_size_of/Cargo.toml @@ -9,7 +9,14 @@ publish = false path = "lib.rs" [features] -servo = ["mozjs", "string_cache", "url", "webrender_api", "xml5ever"] +servo = [ + "mozjs", + "serde_bytes", + "string_cache", + "url", + "webrender_api", + "xml5ever", +] [dependencies] app_units = "0.6" @@ -18,6 +25,7 @@ euclid = "0.17" hashglobe = { path = "../hashglobe" } mozjs = { version = "0.4", features = ["promises"], optional = true } selectors = { path = "../selectors" } +serde_bytes = { version = "0.10", optional = true } servo_arc = { path = "../servo_arc" } smallbitvec = "1.0.3" smallvec = "0.6" diff --git a/components/malloc_size_of/lib.rs b/components/malloc_size_of/lib.rs index 9ed45a772e4..7a21dcece75 100644 --- a/components/malloc_size_of/lib.rs +++ b/components/malloc_size_of/lib.rs @@ -50,6 +50,8 @@ extern crate hashglobe; #[cfg(feature = "servo")] extern crate mozjs as js; extern crate selectors; +#[cfg(feature = "servo")] +extern crate serde_bytes; extern crate servo_arc; extern crate smallbitvec; extern crate smallvec; @@ -63,6 +65,8 @@ extern crate webrender_api; #[cfg(feature = "servo")] extern crate xml5ever; +#[cfg(feature = "servo")] +use serde_bytes::ByteBuf; use std::hash::{BuildHasher, Hash}; use std::mem::size_of; use std::ops::Range; @@ -300,6 +304,24 @@ impl MallocSizeOf for [T] { } } +#[cfg(feature = "servo")] +impl MallocShallowSizeOf for ByteBuf { + fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize { + unsafe { ops.malloc_size_of(self.as_ptr()) } + } +} + +#[cfg(feature = "servo")] +impl MallocSizeOf for ByteBuf { + fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize { + let mut n = self.shallow_size_of(ops); + for elem in self.iter() { + n += elem.size_of(ops); + } + n + } +} + impl MallocShallowSizeOf for Vec { fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize { unsafe { ops.malloc_size_of(self.as_ptr()) } diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index 173887dbed6..2e6a60f6dda 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -78,6 +78,7 @@ script_plugins = {path = "../script_plugins"} script_traits = {path = "../script_traits"} selectors = { path = "../selectors" } serde = "1.0" +serde_bytes = "0.10" servo_allocator = {path = "../allocator"} servo_arc = {path = "../servo_arc"} servo_atoms = {path = "../atoms"} diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index a837fc02fd7..1e95ef3836a 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -453,13 +453,13 @@ impl CanvasRenderingContext2D { } let smoothing_enabled = self.state.borrow().image_smoothing_enabled; - self.ipc_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.into(), + image_size, + dest_rect, + source_rect, + smoothing_enabled, + ))).unwrap(); self.mark_as_dirty(); Ok(()) } @@ -1127,7 +1127,7 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D { let sh = cmp::max(1, sh.to_u32().unwrap()); let sw = cmp::max(1, sw.to_u32().unwrap()); - let (sender, receiver) = ipc::channel::>(self.global().time_profiler_chan().clone()).unwrap(); + let (sender, receiver) = ipc::channel(self.global().time_profiler_chan().clone()).unwrap(); let dest_rect = Rect::new(Point2D::new(sx.to_i32().unwrap(), sy.to_i32().unwrap()), Size2D::new(sw as i32, sh as i32)); let canvas_size = self.canvas.as_ref().map(|c| c.get_size()).unwrap_or(Size2D::zero()); @@ -1135,7 +1135,7 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D { self.ipc_renderer .send(CanvasMsg::Canvas2d(Canvas2dMsg::GetImageData(dest_rect, canvas_size, sender))) .unwrap(); - let mut data = receiver.recv().unwrap(); + let mut data = Vec::from(receiver.recv().unwrap()); // Un-premultiply alpha for chunk in data.chunks_mut(4) { @@ -1174,10 +1174,12 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D { let dirty_rect = Rect::new(Point2D::new(*dirty_x, *dirty_y), Size2D::new(*dirty_width, *dirty_height)); - let msg = CanvasMsg::Canvas2d(Canvas2dMsg::PutImageData(data, - offset, - image_data_size, - dirty_rect)); + let msg = CanvasMsg::Canvas2d(Canvas2dMsg::PutImageData( + data.into(), + offset, + image_data_size, + dirty_rect, + )); self.ipc_renderer.send(msg).unwrap(); self.mark_as_dirty(); } diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index b1bea124a7b..5ebe3063f73 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -263,7 +263,7 @@ impl HTMLCanvasElement { let msg = CanvasMsg::FromScript(FromScriptMsg::SendPixels(sender)); context.get_ipc_renderer().send(msg).unwrap(); - receiver.recv().unwrap()? + receiver.recv().unwrap()?.into() }, Some(&CanvasContext::WebGL(_)) => { // TODO: add a method in WebGLRenderingContext to get the pixels. diff --git a/components/script/dom/vrdisplay.rs b/components/script/dom/vrdisplay.rs index 481f10c30b5..c9f24d04ffa 100644 --- a/components/script/dom/vrdisplay.rs +++ b/components/script/dom/vrdisplay.rs @@ -35,6 +35,7 @@ use ipc_channel::ipc::IpcSender; use profile_traits::ipc; use script_runtime::CommonScriptMsg; use script_runtime::ScriptThreadEventCategory::WebVREvent; +use serde_bytes::ByteBuf; use std::cell::Cell; use std::mem; use std::ops::Deref; @@ -68,7 +69,7 @@ pub struct VRDisplay { // Compositor VRFrameData synchonization frame_data_status: Cell, #[ignore_malloc_size_of = "closures are hard"] - frame_data_receiver: DomRefCell, ()>>>>, + frame_data_receiver: DomRefCell>>>, running_display_raf: Cell, paused: Cell, stopped_on_pause: Cell, diff --git a/components/script/dom/webglbuffer.rs b/components/script/dom/webglbuffer.rs index 68cae62429b..4bb7959f8dd 100644 --- a/components/script/dom/webglbuffer.rs +++ b/components/script/dom/webglbuffer.rs @@ -93,7 +93,11 @@ impl WebGLBuffer { } } self.capacity.set(data.len()); - self.renderer.send(WebGLCommand::BufferData(target, data.to_vec(), usage)).unwrap(); + self.renderer.send(WebGLCommand::BufferData( + target, + data.to_vec().into(), + usage, + )).unwrap(); Ok(()) } diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 436372d6c16..268a37f13f4 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -1050,12 +1050,15 @@ impl WebGLRenderingContext { let internal_format = self.extension_manager.get_effective_tex_internal_format(format, data_type); // TODO(emilio): convert colorspace if requested - let msg = WebGLCommand::TexImage2D(target.as_gl_constant(), level as i32, - internal_format as i32, - width as i32, height as i32, - format, - data_type, - pixels); + let msg = WebGLCommand::TexImage2D( + target.as_gl_constant(), + level as i32, + internal_format as i32, + width as i32, height as i32, + format, + data_type, + pixels.into(), + ); self.send_command(msg); @@ -1102,11 +1105,17 @@ impl WebGLRenderingContext { self.send_command(WebGLCommand::PixelStorei(constants::UNPACK_ALIGNMENT, unpacking_alignment as i32)); // TODO(emilio): convert colorspace if requested - let msg = WebGLCommand::TexSubImage2D(target.as_gl_constant(), - level as i32, xoffset, yoffset, - width as i32, height as i32, - format.as_gl_constant(), - data_type.as_gl_constant(), pixels); + let msg = WebGLCommand::TexSubImage2D( + target.as_gl_constant(), + level as i32, + xoffset, + yoffset, + width as i32, + height as i32, + format.as_gl_constant(), + data_type.as_gl_constant(), + pixels.into(), + ); self.send_command(msg); } @@ -1182,7 +1191,7 @@ impl WebGLRenderingContext { constants::UNSIGNED_BYTE, sender, )); - Some(receiver.recv().unwrap()) + Some(receiver.recv().unwrap().into()) } } @@ -1759,7 +1768,11 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { if (offset as usize) + data_vec.len() > bound_buffer.capacity() { return self.webgl_error(InvalidValue); } - self.send_command(WebGLCommand::BufferSubData(target, offset as isize, data_vec)); + self.send_command(WebGLCommand::BufferSubData( + target, + offset as isize, + data_vec.into(), + )); } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8 diff --git a/components/script/lib.rs b/components/script/lib.rs index bccfda96fdb..882933ac5c9 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -81,6 +81,7 @@ extern crate script_layout_interface; extern crate script_traits; extern crate selectors; extern crate serde; +extern crate serde_bytes; extern crate servo_allocator; extern crate servo_arc; #[macro_use] extern crate servo_atoms; diff --git a/components/webvr/webvr_thread.rs b/components/webvr/webvr_thread.rs index e8aa06af8be..3b1bac07409 100644 --- a/components/webvr/webvr_thread.rs +++ b/components/webvr/webvr_thread.rs @@ -344,7 +344,7 @@ impl webgl::WebVRRenderHandler for WebVRCompositorHandler { (*compositor.0).sync_poses(); (*compositor.0).synced_frame_data(near, far).to_bytes() }; - let _ = sender.send(Ok(pose)); + let _ = sender.send(Ok(pose.into())); } else { let _ = sender.send(Err(())); }