diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 0ef8d2ec07b5..da30b887b0a0 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -18,9 +18,10 @@ use gleam::gl::types::{GLint, GLsizei}; use image::{DynamicImage, ImageFormat, RgbImage}; use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory}; use ipc_channel::router::ROUTER; -use msg::constellation_msg::{Image, PixelFormat, Key, KeyModifiers, KeyState}; +use msg::constellation_msg::{Key, KeyModifiers, KeyState}; use msg::constellation_msg::{PipelineId, PipelineIndex, PipelineNamespaceId}; use msg::constellation_msg::{TraversalDirection, WindowSizeType}; +use net_traits::image::base::{Image, PixelFormat}; use profile_traits::mem::{self, Reporter, ReporterRequest}; use profile_traits::time::{self, ProfilerCategory, profile}; use script_traits::{AnimationState, AnimationTickType, ConstellationControlMsg}; diff --git a/components/compositing/compositor_thread.rs b/components/compositing/compositor_thread.rs index 79fc074da77e..4796cd502f24 100644 --- a/components/compositing/compositor_thread.rs +++ b/components/compositing/compositor_thread.rs @@ -9,7 +9,8 @@ use compositor::CompositingReason; use euclid::point::Point2D; use euclid::size::Size2D; use ipc_channel::ipc::IpcSender; -use msg::constellation_msg::{Image, Key, KeyModifiers, KeyState, PipelineId}; +use msg::constellation_msg::{Key, KeyModifiers, KeyState, PipelineId}; +use net_traits::image::base::Image; use profile_traits::mem; use profile_traits::time; use script_traits::{AnimationState, ConstellationMsg, EventResult}; diff --git a/components/msg/Cargo.toml b/components/msg/Cargo.toml index cf283ea6e73f..ddc0b3e3f85f 100644 --- a/components/msg/Cargo.toml +++ b/components/msg/Cargo.toml @@ -14,7 +14,6 @@ bitflags = "0.7" cssparser = {version = "0.7", features = ["heap_size", "serde-serialization"]} heapsize = "0.3.0" heapsize_plugin = "0.1.2" -ipc-channel = "0.5" plugins = {path = "../plugins"} serde = "0.8" serde_derive = "0.8" diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index 2aa8d19c8d2b..63904e2440c6 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -5,7 +5,6 @@ //! The high-level interface from script to constellation. Using this abstract interface helps //! reduce coupling between these two components. -use ipc_channel::ipc::IpcSharedMemory; use std::cell::Cell; use std::fmt; use webrender_traits; @@ -163,25 +162,6 @@ bitflags! { } } -#[derive(Clone, Copy, Deserialize, Eq, PartialEq, Serialize, HeapSizeOf)] -pub enum PixelFormat { - K8, // Luminance channel only - KA8, // Luminance + alpha - RGB8, // RGB, 8 bits per channel - RGBA8, // RGB + alpha, 8 bits per channel -} - -#[derive(Clone, Deserialize, Serialize, HeapSizeOf)] -pub struct Image { - pub width: u32, - pub height: u32, - pub format: PixelFormat, - #[ignore_heap_size_of = "Defined in ipc-channel"] - pub bytes: IpcSharedMemory, - #[ignore_heap_size_of = "Defined in webrender_traits"] - pub id: Option, -} - #[derive(Clone, PartialEq, Eq, Copy, Hash, Debug, Deserialize, Serialize)] pub enum TraversalDirection { Forward(usize), diff --git a/components/msg/lib.rs b/components/msg/lib.rs index 3918a7ada77a..a2cc4bbab714 100644 --- a/components/msg/lib.rs +++ b/components/msg/lib.rs @@ -11,7 +11,6 @@ #[macro_use] extern crate bitflags; extern crate heapsize; -extern crate ipc_channel; extern crate serde; #[macro_use] extern crate serde_derive; diff --git a/components/net_traits/Cargo.toml b/components/net_traits/Cargo.toml index e3eba97c27dc..851b115a4c81 100644 --- a/components/net_traits/Cargo.toml +++ b/components/net_traits/Cargo.toml @@ -27,3 +27,8 @@ url = {version = "1.2", features = ["heap_size"]} websocket = "0.17" uuid = { version = "0.3.1", features = ["v4", "serde"] } cookie = {version = "0.2.5", features = ["serialize-rustc"]} + +[dependencies.webrender_traits] +git = "https://github.com/servo/webrender" +default_features = false +features = ["serde_derive"] diff --git a/components/net_traits/image/base.rs b/components/net_traits/image/base.rs index cc604a1dc62d..78e896977142 100644 --- a/components/net_traits/image/base.rs +++ b/components/net_traits/image/base.rs @@ -4,8 +4,26 @@ use ipc_channel::ipc::IpcSharedMemory; use piston_image::{self, DynamicImage, ImageFormat}; +use webrender_traits; + +#[derive(Clone, Copy, Deserialize, Eq, PartialEq, Serialize, HeapSizeOf)] +pub enum PixelFormat { + K8, // Luminance channel only + KA8, // Luminance + alpha + RGB8, // RGB, 8 bits per channel + RGBA8, // RGB + alpha, 8 bits per channel +} -pub use msg::constellation_msg::{Image, PixelFormat}; +#[derive(Clone, Deserialize, Serialize, HeapSizeOf)] +pub struct Image { + pub width: u32, + pub height: u32, + pub format: PixelFormat, + #[ignore_heap_size_of = "Defined in ipc-channel"] + pub bytes: IpcSharedMemory, + #[ignore_heap_size_of = "Defined in webrender_traits"] + pub id: Option, +} #[derive(Clone, Deserialize, Eq, PartialEq, Serialize, HeapSizeOf)] pub struct ImageMetadata { diff --git a/components/net_traits/image_cache_thread.rs b/components/net_traits/image_cache_thread.rs index 7a6359e84b02..713ba52c1791 100644 --- a/components/net_traits/image_cache_thread.rs +++ b/components/net_traits/image_cache_thread.rs @@ -2,9 +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 image::base::ImageMetadata; +use image::base::{Image, ImageMetadata}; use ipc_channel::ipc::{self, IpcSender}; -use msg::constellation_msg::Image; use std::sync::Arc; use url::Url; diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs index 7459c2afb344..2908571bf843 100644 --- a/components/net_traits/lib.rs +++ b/components/net_traits/lib.rs @@ -34,6 +34,7 @@ extern crate serde_derive; extern crate url; extern crate util; extern crate uuid; +extern crate webrender_traits; extern crate websocket; use cookie_rs::Cookie; diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 38b35a075735..85281b80f7c3 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -51,11 +51,12 @@ use hyper::header::Headers; use hyper::method::Method; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use libc::c_void; -use msg::constellation_msg::{FrameId, FrameType, Image, Key, KeyModifiers, KeyState}; +use msg::constellation_msg::{FrameId, FrameType, Key, KeyModifiers, KeyState}; use msg::constellation_msg::{PipelineId, PipelineNamespaceId, ReferrerPolicy}; use msg::constellation_msg::{TraversalDirection, WindowSizeType}; use net_traits::{LoadOrigin, ResourceThreads}; use net_traits::bluetooth_thread::BluetoothMethodMsg; +use net_traits::image::base::Image; use net_traits::image_cache_thread::ImageCacheThread; use net_traits::response::HttpsState; use profile_traits::mem; diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index 1642bd389d1a..98b64943bc88 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -1385,7 +1385,6 @@ dependencies = [ "cssparser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "serde 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1485,6 +1484,7 @@ dependencies = [ "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "webrender_traits 0.6.0 (git+https://github.com/servo/webrender)", "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2647,6 +2647,7 @@ dependencies = [ "ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", + "net_traits 0.0.1", "plugins 0.0.1", "regex 0.1.76 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/components/webdriver_server/Cargo.toml b/components/webdriver_server/Cargo.toml index b2530adcd6fc..b0394b32f906 100644 --- a/components/webdriver_server/Cargo.toml +++ b/components/webdriver_server/Cargo.toml @@ -16,6 +16,7 @@ image = "0.10" ipc-channel = "0.5" log = "0.3.5" msg = {path = "../msg"} +net_traits = {path = "../net_traits"} plugins = {path = "../plugins"} regex = "0.1.55" rustc-serialize = "0.3.4" diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index 3bfdecd23681..bf0ebbaee378 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -18,6 +18,7 @@ extern crate ipc_channel; #[macro_use] extern crate log; extern crate msg; +extern crate net_traits; extern crate regex; extern crate rustc_serialize; extern crate script_traits; @@ -33,8 +34,8 @@ use hyper::method::Method::{self, Post}; use image::{DynamicImage, ImageFormat, RgbImage}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use keys::keycodes_to_keys; -use msg::constellation_msg::{FrameId, PipelineId}; -use msg::constellation_msg::{PixelFormat, TraversalDirection}; +use msg::constellation_msg::{FrameId, PipelineId, TraversalDirection}; +use net_traits::image::base::PixelFormat; use regex::Captures; use rustc_serialize::base64::{CharacterSet, Config, Newline, ToBase64}; use rustc_serialize::json::{Json, ToJson}; diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index 5b6239880898..1aa9e3d2bbf1 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -1285,7 +1285,6 @@ dependencies = [ "cssparser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "serde 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1363,6 +1362,7 @@ dependencies = [ "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "webrender_traits 0.6.0 (git+https://github.com/servo/webrender)", "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2505,6 +2505,7 @@ dependencies = [ "ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", + "net_traits 0.0.1", "plugins 0.0.1", "regex 0.1.76 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",