diff options
Diffstat (limited to 'components/net_traits')
-rw-r--r-- | components/net_traits/Cargo.toml | 3 | ||||
-rw-r--r-- | components/net_traits/hosts.rs | 2 | ||||
-rw-r--r-- | components/net_traits/image/base.rs | 6 | ||||
-rw-r--r-- | components/net_traits/image_cache_task.rs | 3 | ||||
-rw-r--r-- | components/net_traits/lib.rs | 13 | ||||
-rw-r--r-- | components/net_traits/storage_task.rs | 2 |
6 files changed, 20 insertions, 9 deletions
diff --git a/components/net_traits/Cargo.toml b/components/net_traits/Cargo.toml index 9bfff8ba8b0..e2fb0c6b446 100644 --- a/components/net_traits/Cargo.toml +++ b/components/net_traits/Cargo.toml @@ -31,6 +31,9 @@ git = "https://github.com/pcwalton/ipc-channel" version = "0.2" features = [ "serde_serialization" ] +[dependencies.plugins] +path = "../plugins" + [dependencies] log = "0.3" euclid = "0.1" diff --git a/components/net_traits/hosts.rs b/components/net_traits/hosts.rs index 9895276dbc7..7a80c6e815e 100644 --- a/components/net_traits/hosts.rs +++ b/components/net_traits/hosts.rs @@ -51,7 +51,7 @@ pub fn parse_hostsfile(hostsfile_content: &str) -> Box<HashMap<String, String>> if token.as_bytes()[0] == b'#' { break; } - host_table.insert(token.to_owned().to_string(), address.clone()); + host_table.insert((*token).to_owned(), address.clone()); } } } diff --git a/components/net_traits/image/base.rs b/components/net_traits/image/base.rs index 7e0a2348b24..1b639555864 100644 --- a/components/net_traits/image/base.rs +++ b/components/net_traits/image/base.rs @@ -6,12 +6,13 @@ use ipc_channel::ipc::IpcSharedMemory; use png; use stb_image::image as stb_image2; use std::mem; +use util::mem::HeapSizeOf; use util::vec::byte_swap; // FIXME: Images must not be copied every frame. Instead we should atomically // reference count them. -#[derive(Deserialize, Serialize)] +#[derive(Deserialize, Serialize, HeapSizeOf)] pub enum PixelFormat { K8, // Luminance channel only KA8, // Luminance + alpha @@ -19,11 +20,12 @@ pub enum PixelFormat { RGBA8, // RGB + alpha, 8 bits per channel } -#[derive(Deserialize, Serialize)] +#[derive(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, } diff --git a/components/net_traits/image_cache_task.rs b/components/net_traits/image_cache_task.rs index fd0ecd59832..af675bb0f85 100644 --- a/components/net_traits/image_cache_task.rs +++ b/components/net_traits/image_cache_task.rs @@ -6,6 +6,7 @@ use image::base::Image; use ipc_channel::ipc::{self, IpcSender}; use url::Url; use std::sync::Arc; +use util::mem::HeapSizeOf; /// This is optionally passed to the image cache when requesting /// and image, and returned to the specified event loop when the @@ -37,7 +38,7 @@ pub enum ImageState { } /// The returned image. -#[derive(Clone, Deserialize, Serialize)] +#[derive(Clone, Deserialize, Serialize, HeapSizeOf)] pub enum ImageResponse { /// The requested image was loaded. Loaded(Arc<Image>), diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs index e4cdb2538f0..2ee8f160d10 100644 --- a/components/net_traits/lib.rs +++ b/components/net_traits/lib.rs @@ -9,7 +9,8 @@ #![feature(slice_patterns)] #![feature(step_by)] #![feature(vec_push_all)] -#![plugin(serde_macros)] +#![feature(custom_attribute)] +#![plugin(serde_macros, plugins)] #![plugin(regex_macros)] @@ -35,6 +36,7 @@ use msg::constellation_msg::{PipelineId}; use regex::Regex; use serde::{Deserializer, Serializer}; use url::Url; +use util::mem::HeapSizeOf; use std::thread; @@ -56,12 +58,14 @@ pub mod image { pub mod base; } -#[derive(Clone, Deserialize, Serialize)] +#[derive(Clone, Deserialize, Serialize, HeapSizeOf)] pub struct LoadData { pub url: Url, pub method: Method, + #[ignore_heap_size_of = "Defined in hyper"] /// Headers that will apply to the initial request only pub headers: Headers, + #[ignore_heap_size_of = "Defined in hyper"] /// Headers that will apply to the initial request and any redirects pub preserved_headers: Headers, pub data: Option<Vec<u8>>, @@ -231,7 +235,7 @@ pub struct LoadResponse { pub progress_port: IpcReceiver<ProgressMsg>, } -#[derive(Clone, Deserialize, Serialize)] +#[derive(Clone, Deserialize, Serialize, HeapSizeOf)] pub struct ResourceCORSData { /// CORS Preflight flag pub preflight: bool, @@ -240,7 +244,7 @@ pub struct ResourceCORSData { } /// Metadata about a loaded resource, such as is obtained from HTTP headers. -#[derive(Clone, Deserialize, Serialize)] +#[derive(Clone, Deserialize, Serialize, HeapSizeOf)] pub struct Metadata { /// Final URL after redirects. pub final_url: Url, @@ -251,6 +255,7 @@ pub struct Metadata { /// Character set. pub charset: Option<String>, + #[ignore_heap_size_of = "Defined in hyper"] /// Headers pub headers: Option<Headers>, diff --git a/components/net_traits/storage_task.rs b/components/net_traits/storage_task.rs index 028bd6d1f48..261e6cb1f7b 100644 --- a/components/net_traits/storage_task.rs +++ b/components/net_traits/storage_task.rs @@ -7,7 +7,7 @@ use url::Url; use util::str::DOMString; -#[derive(Copy, Clone, Deserialize, Serialize)] +#[derive(Copy, Clone, Deserialize, Serialize, HeapSizeOf)] pub enum StorageType { Session, Local |