mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Measure heap memory usage for more types. Fixes #6951
This commit is contained in:
parent
94c8dcd575
commit
45145108da
175 changed files with 669 additions and 94 deletions
|
@ -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"
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
||||
|
|
|
@ -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>),
|
||||
|
|
|
@ -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>,
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue