Say farewell to in-tree HeapSizeOf

This commit is contained in:
Anthony Ramine 2016-01-30 15:06:31 +01:00
parent 9932a5cf82
commit cb5cd8d881
80 changed files with 245 additions and 733 deletions

View file

@ -35,7 +35,9 @@ path = "../plugins"
path = "../util"
[dependencies]
cssparser = {version = "0.5.2", features = ["serde-serialization"]}
cssparser = {version = "0.5.2", features = ["heap_size", "serde-serialization"]}
euclid = {version = "0.6.1", features = ["plugins"]}
heapsize = "0.2.5"
heapsize_plugin = "0.1.2"
serde_macros = "0.6"

View file

@ -7,13 +7,14 @@
#![feature(custom_derive)]
#![feature(nonzero)]
#![feature(plugin)]
#![plugin(serde_macros, plugins)]
#![plugin(heapsize_plugin, plugins, serde_macros)]
extern crate azure;
extern crate core;
extern crate cssparser;
extern crate euclid;
extern crate gfx_traits;
extern crate heapsize;
extern crate ipc_channel;
extern crate layers;
extern crate offscreen_gl_context;
@ -40,7 +41,6 @@ use std::default::Default;
use std::fmt;
use std::str::FromStr;
use std::sync::mpsc::Sender;
use util::mem::HeapSizeOf;
#[derive(Clone, Deserialize, Serialize)]
pub enum FillRule {

View file

@ -91,7 +91,7 @@ gleam = "0.2"
euclid = {version = "0.6.1", features = ["plugins"]}
serde = "0.6"
serde_macros = "0.6"
url = "0.5.4"
url = {version = "0.5.4", features = ["heap_size"]}
[target.x86_64-apple-darwin.dependencies]
core-graphics = "0.2"

View file

@ -20,11 +20,13 @@ git = "https://github.com/servo/ipc-channel"
path = "../plugins"
[dependencies]
heapsize = "0.2.5"
heapsize_plugin = "0.1.2"
hyper = { version = "0.7", features = [ "serde-serialization" ] }
time = "0.1"
rustc-serialize = "0.3"
bitflags = "0.3"
serde = "0.6"
serde_macros = "0.6"
url = "0.5.4"
url = {version = "0.5.4", features = ["heap_size"]}

View file

@ -13,10 +13,11 @@
#![deny(unsafe_code)]
#![feature(custom_derive, plugin)]
#![plugin(serde_macros, plugins)]
#![plugin(heapsize_plugin, serde_macros)]
#[macro_use]
extern crate bitflags;
extern crate heapsize;
extern crate hyper;
extern crate ipc_channel;
extern crate msg;
@ -36,7 +37,6 @@ use std::net::TcpStream;
use time::Duration;
use time::Tm;
use url::Url;
use util::mem::HeapSizeOf;
// Information would be attached to NewGlobal to be received and show in devtools.
// Extend these fields if we need more information.

View file

@ -14,6 +14,8 @@ bitflags = "0.3"
euclid = {version = "0.6.1", features = ["plugins"]}
fnv = "1.0"
harfbuzz-sys = "0.1"
heapsize = "0.2.5"
heapsize_plugin = "0.1.2"
lazy_static = "0.1"
libc = "0.2"
log = "0.3"
@ -23,10 +25,10 @@ rustc-serialize = "0.3"
serde = "0.6"
serde_macros = "0.6"
smallvec = "0.1"
string_cache = "0.2.7"
string_cache = {version = "0.2.7", features = ["heap_size"]}
time = "0.1.12"
unicode-script = { version = "0.1", features = ["harfbuzz"] }
url = "0.5.4"
url = {version = "0.5.4", features = ["heap_size"]}
servo-skia = "0.20130412.0"
[dependencies.plugins]

View file

@ -22,6 +22,7 @@ use euclid::approxeq::ApproxEq;
use euclid::num::Zero;
use euclid::{Matrix2D, Matrix4, Point2D, Rect, SideOffsets2D, Size2D};
use gfx_traits::{color, LayerId, LayerKind, ScrollPolicy};
use heapsize::HeapSizeOf;
use msg::constellation_msg::PipelineId;
use net_traits::image::base::Image;
use paint_context::PaintContext;
@ -41,7 +42,6 @@ use text::glyph::CharIndex;
use util::cursor::Cursor;
use util::geometry::MAX_RECT;
use util::linked_list::prepend_from;
use util::mem::HeapSizeOf;
use util::opts;
use util::print_tree::PrintTree;
use util::range::Range;
@ -1256,8 +1256,8 @@ pub struct GradientDisplayItem {
impl HeapSizeOf for GradientDisplayItem {
fn heap_size_of_children(&self) -> usize {
use heapsize::heap_size_of;
use libc::c_void;
use util::mem::heap_size_of;
// We can't measure `stops` via Vec's HeapSizeOf implementation because GradientStop isn't
// defined in this module, and we don't want to import GradientStop into util::mem where

View file

@ -13,6 +13,7 @@ use font::SpecifiedFontStyle;
use font::{Font, FontGroup};
use font_cache_thread::FontCacheThread;
use font_template::FontTemplateDescriptor;
use heapsize::HeapSizeOf;
use platform::font::FontHandle;
use platform::font_context::FontContextHandle;
use platform::font_template::FontTemplateData;
@ -28,7 +29,6 @@ use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
use string_cache::Atom;
use style::computed_values::{font_style, font_variant};
use util::cache::HashCache;
use util::mem::HeapSizeOf;
#[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))]
fn create_scaled_font(template: &Arc<FontTemplateData>, pt_size: Au) -> ScaledFont {

View file

@ -16,6 +16,7 @@
#![feature(str_char)]
#![feature(unique)]
#![plugin(heapsize_plugin)]
#![plugin(plugins)]
#![plugin(serde_macros)]
@ -46,6 +47,7 @@ extern crate gfx_traits;
// shapers. For now, however, this is a hard dependency.
extern crate harfbuzz_sys as harfbuzz;
extern crate heapsize;
extern crate ipc_channel;
extern crate layers;
#[macro_use]

View file

@ -10,10 +10,10 @@ use freetype::freetype::FT_Library;
use freetype::freetype::FT_Memory;
use freetype::freetype::FT_New_Library;
use freetype::freetype::struct_FT_MemoryRec_;
use heapsize::{HeapSizeOf, heap_size_of};
use libc::{c_long, c_void};
use std::ptr;
use std::rc::Rc;
use util::mem::{HeapSizeOf, heap_size_of};
// We pass a |User| struct -- via an opaque |void*| -- to FreeType each time a new instance is
// created. FreeType passes it back to the ft_alloc/ft_realloc/ft_free callbacks. We use it to

View file

@ -2,7 +2,7 @@
* 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 util::mem::HeapSizeOf;
use heapsize::HeapSizeOf;
#[derive(Clone, Debug)]
pub struct FontContextHandle {

View file

@ -26,5 +26,7 @@ path = "../util"
[dependencies]
euclid = {version = "0.6.1", features = ["plugins"]}
heapsize = "0.2.5"
heapsize_plugin = "0.1.2"
serde = "0.6"
serde_macros = "0.6"

View file

@ -3,13 +3,14 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(custom_derive, plugin)]
#![plugin(plugins, serde_macros)]
#![plugin(heapsize_plugin, plugins, serde_macros)]
#![crate_name = "gfx_traits"]
#![crate_type = "rlib"]
extern crate azure;
extern crate euclid;
extern crate heapsize;
extern crate layers;
extern crate msg;
extern crate serde;

View file

@ -56,19 +56,21 @@ git = "https://github.com/servo/ipc-channel"
[dependencies]
app_units = {version = "0.2", features = ["plugins"]}
bitflags = "0.3"
cssparser = {version = "0.5.2", features = ["serde-serialization"]}
cssparser = {version = "0.5.2", features = ["heap_size", "serde-serialization"]}
euclid = {version = "0.6.1", features = ["plugins"]}
fnv = "1.0"
heapsize = "0.2.5"
heapsize_plugin = "0.1.2"
libc = "0.2"
log = "0.3"
rustc-serialize = "0.3"
selectors = "0.4.1"
selectors = {version = "0.4.1", features = ["heap_size"]}
serde = "0.6"
serde_json = "0.5"
serde_macros = "0.6"
smallvec = "0.1"
string_cache = "0.2.7"
string_cache = {version = "0.2.7", features = ["heap_size"]}
time = "0.1"
unicode-bidi = "0.2"
unicode-script = { version = "0.1", features = ["harfbuzz"] }
url = "0.5.4"
url = {version = "0.5.4", features = ["heap_size"]}

View file

@ -14,6 +14,7 @@ use fnv::FnvHasher;
use gfx::font_cache_thread::FontCacheThread;
use gfx::font_context::FontContext;
use gfx_traits::LayerId;
use heapsize::HeapSizeOf;
use ipc_channel::ipc::{self, IpcSender};
use net_traits::image::base::Image;
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread, ImageResponse, ImageState};
@ -27,7 +28,6 @@ use std::sync::{Arc, Mutex};
use style::context::{LocalStyleContext, SharedStyleContext, StyleContext};
use style::matching::{ApplicableDeclarationsCache, StyleSharingCandidateCache};
use url::Url;
use util::mem::HeapSizeOf;
use util::opts;
struct LocalLayoutContext {

View file

@ -28,6 +28,7 @@ use gfx::font_cache_thread::FontCacheThread;
use gfx::font_context;
use gfx::paint_thread::{LayoutToPaintMsg, PaintLayer};
use gfx_traits::{color, Epoch, LayerId, ScrollPolicy};
use heapsize::HeapSizeOf;
use incremental::{LayoutDamageComputation, REFLOW, REFLOW_ENTIRE_DOCUMENT, REPAINT};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
@ -73,7 +74,6 @@ use url::Url;
use util::geometry::MAX_RECT;
use util::ipc::OptionalIpcSender;
use util::logical_geometry::LogicalPoint;
use util::mem::HeapSizeOf;
use util::opts;
use util::thread;
use util::thread_state;

View file

@ -17,6 +17,7 @@
#![deny(unsafe_code)]
#![plugin(heapsize_plugin)]
#![plugin(plugins)]
extern crate app_units;
@ -30,6 +31,7 @@ extern crate euclid;
extern crate fnv;
extern crate gfx;
extern crate gfx_traits;
extern crate heapsize;
extern crate ipc_channel;
extern crate layout_traits;
extern crate libc;

View file

@ -31,4 +31,4 @@ git = "https://github.com/servo/ipc-channel"
[dependencies]
serde = "0.6"
serde_macros = "0.6"
url = "0.5.4"
url = {version = "0.5.4", features = ["heap_size"]}

View file

@ -22,10 +22,12 @@ path = "../plugins"
[dependencies]
bitflags = "0.3"
cssparser = {version = "0.5.2", features = ["serde-serialization"]}
cssparser = {version = "0.5.2", features = ["heap_size", "serde-serialization"]}
euclid = {version = "0.6.1", features = ["plugins"]}
heapsize = "0.2.5"
heapsize_plugin = "0.1.2"
hyper = { version = "0.7", features = [ "serde-serialization" ] }
rustc-serialize = "0.3.4"
serde = "0.6"
serde_macros = "0.6"
url = "0.5.4"
url = {version = "0.5.4", features = ["heap_size"]}

View file

@ -16,7 +16,6 @@ use std::cell::Cell;
use std::fmt;
use url::Url;
use util::geometry::{PagePx, ViewportPx};
use util::mem::HeapSizeOf;
use webdriver_msg::{LoadStatus, WebDriverScriptCommand};
#[derive(Deserialize, Serialize)]

View file

@ -3,11 +3,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(custom_attribute, custom_derive, plugin)]
#![plugin(serde_macros, plugins)]
#![plugin(heapsize_plugin, serde_macros, plugins)]
#[macro_use]
extern crate bitflags;
extern crate euclid;
extern crate heapsize;
extern crate hyper;
extern crate ipc_channel;
extern crate layers;

View file

@ -38,6 +38,6 @@ cookie = "0.2"
mime_guess = "1.1.1"
flate2 = "0.2.0"
uuid = "0.1.16"
url = "0.5.4"
url = {version = "0.5.4", features = ["heap_size"]}
websocket = "0.14.0"
immeta = "0.2"

View file

@ -20,11 +20,13 @@ git = "https://github.com/servo/ipc-channel"
path = "../plugins"
[dependencies]
heapsize = "0.2.5"
heapsize_plugin = "0.1.2"
hyper = { version = "0.7", features = [ "serde-serialization" ] }
image = "0.5.0"
log = "0.3"
serde = "0.6"
serde_macros = "0.6"
stb_image = "0.2"
url = "0.5.4"
url = {version = "0.5.4", features = ["heap_size"]}
websocket = "0.14.0"

View file

@ -6,7 +6,6 @@ use ipc_channel::ipc::{self, IpcSender};
use msg::constellation_msg::{Image, ImageMetadata};
use std::sync::Arc;
use url::Url;
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

View file

@ -9,8 +9,9 @@
#![feature(slice_patterns)]
#![feature(step_by)]
#![feature(custom_attribute)]
#![plugin(serde_macros, plugins)]
#![plugin(heapsize_plugin, serde_macros)]
extern crate heapsize;
extern crate hyper;
extern crate image as piston_image;
extern crate ipc_channel;
@ -32,7 +33,6 @@ use msg::constellation_msg::{PipelineId};
use serde::{Deserializer, Serializer};
use std::thread;
use url::Url;
use util::mem::HeapSizeOf;
use websocket::header;
pub mod hosts;
@ -69,6 +69,7 @@ pub enum LoadContext {
#[derive(Clone, Deserialize, Serialize, HeapSizeOf)]
pub struct LoadData {
pub url: Url,
#[ignore_heap_size_of = "Defined in hyper"]
pub method: Method,
#[ignore_heap_size_of = "Defined in hyper"]
/// Headers that will apply to the initial request only
@ -297,6 +298,7 @@ pub struct Metadata {
/// Final URL after redirects.
pub final_url: Url,
#[ignore_heap_size_of = "Defined in hyper"]
/// MIME type / subtype.
pub content_type: Option<(ContentType)>,
@ -307,6 +309,7 @@ pub struct Metadata {
/// Headers
pub headers: Option<Headers>,
#[ignore_heap_size_of = "Defined in hyper"]
/// HTTP Status
pub status: Option<RawStatus>,
}

View file

@ -17,7 +17,7 @@ rev = "9dca15de3e8ea266d3e7e868c0f358ed4fa5f195"
optional = true
[dependencies]
url = "0.5.4"
url = {version = "0.5.4", features = ["heap_size"]}
[features]
default = []

View file

@ -1,82 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
//! Handles the auto-deriving for `#[derive(HeapSizeOf)]`
//!
//! This provides the `#[derive(HeapSizeOf)]` decorator, which
//! generates a `HeapSizeOf` implementation that adds up
//! calls to heap_size_of_children() for all the fields
//! of a struct or enum variant.
//!
//! Fields marked `#[ignore_heap_size_of = "reason"]` will
//! be ignored in this calculation. Providing a reason is compulsory.
use syntax::ast::*;
use syntax::attr::AttrMetaMethods;
use syntax::codemap::Span;
use syntax::ext::base::{Annotatable, ExtCtxt};
use syntax::ext::build::AstBuilder;
use syntax::ptr::P;
use syntax_ext::deriving::generic::*;
pub fn expand_heap_size(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem,
item: &Annotatable, push: &mut FnMut(Annotatable)) {
let trait_def = TraitDef {
is_unsafe: false,
span: span,
attributes: Vec::new(),
path: ty::Path::new(vec!("util", "mem", "HeapSizeOf")),
additional_bounds: Vec::new(),
generics: ty::LifetimeBounds::empty(),
methods: vec![
MethodDef {
name: "heap_size_of_children",
generics: ty::LifetimeBounds::empty(),
explicit_self: ty::borrowed_explicit_self(),
args: vec!(),
ret_ty: ty::Literal(ty::Path::new_local("usize")),
attributes: vec!(),
is_unsafe: false,
combine_substructure: combine_substructure(Box::new(heap_size_substructure))
}
],
associated_types: vec![],
};
trait_def.expand(cx, mitem, item, push)
}
/// Defines how the implementation for `heap_size_of_children()` is to be generated.
fn heap_size_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> P<Expr> {
let fields = match *substr.fields {
Struct(ref fs) | EnumMatching(_, _, ref fs) => fs,
_ => cx.span_bug(trait_span, "impossible substructure in `#[derive(HeapSizeOf)]`")
};
fields.iter().fold(cx.expr_usize(trait_span, 0), |acc, ref item| {
if item.attrs.iter()
.find(|ref a| {
if a.check_name("ignore_heap_size_of") {
match a.node.value.node {
MetaNameValue(..) => (),
_ => cx.span_err(a.span, "#[ignore_heap_size_of] \
should have an explanation, \
e.g. #[ignore_heap_size_of = \"\"]")
}
true
} else {
false
}
})
.is_some() {
acc
} else {
cx.expr_binary(item.span, BiAdd, acc,
cx.expr_method_call(item.span,
item.self_.clone(),
substr.method_ident,
Vec::new()))
}
})
}

View file

@ -36,8 +36,6 @@ use syntax::parse::token::intern;
// Public for documentation to show up
/// Handles the auto-deriving for `#[derive(JSTraceable)]`
pub mod jstraceable;
/// Handles the auto-deriving for `#[derive(HeapSizeOf)]`
pub mod heap_size;
pub mod lints;
/// Autogenerates implementations of Reflectable on DOM structs
pub mod reflector;
@ -51,7 +49,6 @@ pub fn plugin_registrar(reg: &mut Registry) {
reg.register_syntax_extension(intern("dom_struct"), MultiModifier(box jstraceable::expand_dom_struct));
reg.register_syntax_extension(intern("derive_JSTraceable"), MultiDecorator(box jstraceable::expand_jstraceable));
reg.register_syntax_extension(intern("_generate_reflector"), MultiDecorator(box reflector::expand_reflector));
reg.register_syntax_extension(intern("derive_HeapSizeOf"), MultiDecorator(box heap_size::expand_heap_size));
reg.register_macro("to_lower", casing::expand_lower);
reg.register_macro("to_upper", casing::expand_upper);
reg.register_macro("url", url_plugin::expand_url);

View file

@ -66,11 +66,13 @@ path = "../gfx_traits"
app_units = {version = "0.2", features = ["plugins"]}
bitflags = "0.3"
caseless = "0.1.0"
cssparser = {version = "0.5.2", features = ["serde-serialization"]}
cssparser = {version = "0.5.2", features = ["heap_size", "serde-serialization"]}
encoding = "0.2"
euclid = {version = "0.6.1", features = ["plugins"]}
fnv = "1.0"
html5ever = {version = "0.4.2", features = ["unstable"]}
heapsize = "0.2.5"
heapsize_plugin = "0.1.2"
html5ever = {version = "0.4.2", features = ["heap_size", "unstable"]}
hyper = { version = "0.7", features = [ "serde-serialization" ] }
image = "0.5.0"
libc = "0.2"
@ -79,12 +81,12 @@ num = "0.1.24"
rand = "0.3"
ref_slice = "0.1.0"
rustc-serialize = "0.3"
selectors = "0.4.1"
selectors = {version = "0.4.1", features = ["heap_size"]}
serde = "0.6"
smallvec = "0.1"
string_cache = {version = "0.2.7", features = ["unstable"]}
string_cache = {version = "0.2.7", features = ["heap_size", "unstable"]}
time = "0.1.12"
unicase = "1.0"
url = "0.5.4"
url = {version = "0.5.4", features = ["heap_size"]}
uuid = "0.1.16"
websocket = "0.14.0"

View file

@ -27,7 +27,6 @@ use std::sync::{Arc, Mutex};
use time::{self, Timespec, now};
use unicase::UniCase;
use url::{SchemeData, Url};
use util::mem::HeapSizeOf;
use util::thread::spawn_named;
/// Interface for network listeners concerned with CORS checks. Proper network requests
@ -41,6 +40,7 @@ pub struct CORSRequest {
pub origin: Url,
pub destination: Url,
pub mode: RequestMode,
#[ignore_heap_size_of = "Defined in hyper"]
pub method: Method,
#[ignore_heap_size_of = "Defined in hyper"]
pub headers: Headers,

View file

@ -14,7 +14,6 @@ use js::jsapi::{JSContext, JSObject, RootedValue};
use js::jsapi::{JS_IsExceptionPending, JS_ReportPendingException, JS_SetPendingException};
use js::jsapi::{JS_RestoreFrameChain, JS_SaveFrameChain};
use js::jsval::UndefinedValue;
use util::mem::HeapSizeOf;
/// DOM exceptions that can be thrown by a native DOM method.
#[derive(Debug, Clone, HeapSizeOf)]

View file

@ -30,6 +30,7 @@ use dom::bindings::reflector::{Reflectable, Reflector};
use dom::bindings::trace::JSTraceable;
use dom::bindings::trace::trace_reflector;
use dom::node::Node;
use heapsize::HeapSizeOf;
use js::jsapi::{Heap, JSObject, JSTracer};
use js::jsval::JSVal;
use layout_interface::TrustedNodeAddress;
@ -40,7 +41,6 @@ use std::hash::{Hash, Hasher};
use std::mem;
use std::ops::Deref;
use std::ptr;
use util::mem::HeapSizeOf;
use util::thread_state;
/// A traced reference to a DOM object

View file

@ -10,7 +10,6 @@ use std::hash::{Hash, Hasher};
use std::ops;
use std::str;
use std::str::FromStr;
use util::mem::HeapSizeOf;
use util::str::is_token;
/// Encapsulates the IDL `ByteString` type.

View file

@ -13,6 +13,7 @@ use dom::bindings::inheritance::TopTypeId;
use dom::bindings::trace::trace_object;
use dom::browsingcontext;
use dom::window;
use heapsize::HeapSizeOf;
use js;
use js::error::throw_type_error;
use js::glue::{CallJitGetterOp, CallJitMethodOp, CallJitSetterOp, IsWrapper};
@ -36,7 +37,6 @@ use libc::{self, c_uint};
use std::default::Default;
use std::ffi::CString;
use std::ptr;
use util::mem::HeapSizeOf;
use util::non_geckolib::jsstring_to_str;
/// Proxy handler for a WindowProxy.

View file

@ -15,6 +15,7 @@ use core::nonzero::NonZero;
use dom::bindings::js::Root;
use dom::bindings::reflector::Reflectable;
use dom::bindings::trace::JSTraceable;
use heapsize::HeapSizeOf;
use js::jsapi::{JSTracer, JS_GetReservedSlot, JS_SetReservedSlot};
use js::jsval::PrivateValue;
use libc::c_void;
@ -22,7 +23,6 @@ use std::cell::{Cell, UnsafeCell};
use std::iter::Iterator;
use std::mem;
use std::ops::{Deref, DerefMut, Drop};
use util::mem::HeapSizeOf;
/// The index of the slot wherein a pointer to the weak holder cell is
/// stored for weak-referenceable bindings. We use slot 1 for holding it,

View file

@ -20,6 +20,7 @@ no_jsmanaged_fields!(OsRng);
#[dom_struct]
pub struct Crypto {
reflector_: Reflector,
#[ignore_heap_size_of = "Defined in rand"]
rng: DOMRefCell<OsRng>,
}

View file

@ -84,7 +84,6 @@ use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, parse_sty
use style::selector_impl::{NonTSPseudoClass, ServoSelectorImpl};
use style::values::CSSFloat;
use style::values::specified::{self, CSSColor, CSSRGBA, LengthOrPercentage};
use util::mem::HeapSizeOf;
use util::str::{DOMString, LengthOrPercentageOrAuto};
// TODO: Update focus state when the top-level browsing context gains or loses system focus,

View file

@ -21,6 +21,7 @@ use dom::eventdispatcher::dispatch_event;
use dom::virtualmethods::VirtualMethods;
use dom::window::Window;
use fnv::FnvHasher;
use heapsize::HeapSizeOf;
use js::jsapi::{CompileFunction, JS_GetFunctionObject, RootedValue};
use js::jsapi::{HandleObject, JSContext, RootedFunction};
use js::jsapi::{JSAutoCompartment, JSAutoRequest};
@ -35,7 +36,6 @@ use std::rc::Rc;
use std::{intrinsics, ptr};
use string_cache::Atom;
use url::Url;
use util::mem::HeapSizeOf;
use util::str::DOMString;
#[derive(PartialEq, Clone, JSTraceable)]

View file

@ -46,6 +46,7 @@ use dom::text::Text;
use dom::virtualmethods::{VirtualMethods, vtable_for};
use dom::window::Window;
use euclid::rect::Rect;
use heapsize::{HeapSizeOf, heap_size_of};
use js::jsapi::{JSContext, JSObject, JSRuntime};
use layout_interface::{LayoutChan, Msg};
use libc::{self, c_void, uintptr_t};
@ -63,7 +64,6 @@ use std::iter::{self, FilterMap, Peekable};
use std::mem;
use string_cache::{Atom, Namespace, QualName};
use style::selector_impl::ServoSelectorImpl;
use util::mem::{HeapSizeOf, heap_size_of};
use util::str::DOMString;
use util::thread_state;
use uuid::Uuid;

View file

@ -23,10 +23,10 @@ use dom::document::Document;
use dom::documentfragment::DocumentFragment;
use dom::node::{Node, UnbindContext};
use dom::text::Text;
use heapsize::HeapSizeOf;
use js::jsapi::JSTracer;
use std::cell::{Cell, UnsafeCell};
use std::cmp::{Ord, Ordering, PartialEq, PartialOrd};
use util::mem::HeapSizeOf;
use util::str::DOMString;
#[dom_struct]

View file

@ -62,7 +62,6 @@ use string_cache::Atom;
use time;
use timers::{ScheduledCallback, TimerHandle};
use url::Url;
use util::mem::HeapSizeOf;
use util::str::DOMString;
pub type SendParam = BlobOrStringOrURLSearchParams;
@ -127,11 +126,13 @@ pub struct XMLHttpRequest {
response_xml: MutNullableHeap<JS<Document>>,
#[ignore_heap_size_of = "Defined in hyper"]
response_headers: DOMRefCell<Headers>,
#[ignore_heap_size_of = "Defined in hyper"]
override_mime_type: DOMRefCell<Option<Mime>>,
#[ignore_heap_size_of = "Defined in rust-encoding"]
override_charset: DOMRefCell<Option<EncodingRef>>,
// Associated concepts
#[ignore_heap_size_of = "Defined in hyper"]
request_method: DOMRefCell<Method>,
request_url: DOMRefCell<Option<Url>>,
#[ignore_heap_size_of = "Defined in hyper"]

View file

@ -26,6 +26,7 @@
#![doc = "The script crate contains all matters DOM."]
#![plugin(heapsize_plugin)]
#![plugin(plugins)]
extern crate angle;
@ -42,6 +43,7 @@ extern crate encoding;
extern crate euclid;
extern crate fnv;
extern crate gfx_traits;
extern crate heapsize;
extern crate html5ever;
extern crate hyper;
extern crate image;

View file

@ -6,8 +6,8 @@
use dom::bindings::conversions::get_dom_class;
use dom::bindings::reflector::Reflectable;
use heapsize::{HeapSizeOf, heap_size_of};
use libc::c_void;
use util::mem::{HeapSizeOf, heap_size_of};
// This is equivalent to measuring a Box<T>, except that DOM objects lose their
// associated box in order to stash their pointers in a reserved slot of their

View file

@ -12,7 +12,6 @@ use std::borrow::ToOwned;
use std::cmp::{max, min};
use std::default::Default;
use std::usize;
use util::mem::HeapSizeOf;
use util::str::DOMString;
#[derive(Copy, Clone, PartialEq)]

View file

@ -9,6 +9,7 @@ use dom::bindings::reflector::Reflectable;
use dom::bindings::trace::JSTraceable;
use dom::window::ScriptHelpers;
use euclid::length::Length;
use heapsize::HeapSizeOf;
use ipc_channel::ipc::IpcSender;
use js::jsapi::{HandleValue, Heap, RootedValue};
use js::jsval::{JSVal, UndefinedValue};
@ -19,7 +20,6 @@ use std::cell::Cell;
use std::cmp::{self, Ord, Ordering};
use std::default::Default;
use std::rc::Rc;
use util::mem::HeapSizeOf;
use util::str::DOMString;
#[derive(JSTraceable, PartialEq, Eq, Copy, Clone, HeapSizeOf, Hash, PartialOrd, Ord, Debug)]

View file

@ -43,8 +43,10 @@ git = "https://github.com/servo/ipc-channel"
[dependencies]
app_units = {version = "0.2", features = ["plugins"]}
euclid = {version = "0.6.1", features = ["plugins"]}
heapsize = "0.2.5"
heapsize_plugin = "0.1.2"
libc = "0.2"
serde = "0.6"
serde_macros = "0.6"
time = "0.1.12"
url = "0.5.4"
url = {version = "0.5.4", features = ["heap_size"]}

View file

@ -7,7 +7,7 @@
//! to depend on script.
#![feature(custom_derive, plugin)]
#![plugin(plugins, serde_macros)]
#![plugin(heapsize_plugin, plugins, serde_macros)]
#![deny(missing_docs)]
extern crate app_units;
@ -15,6 +15,7 @@ extern crate canvas_traits;
extern crate devtools_traits;
extern crate euclid;
extern crate gfx_traits;
extern crate heapsize;
extern crate ipc_channel;
extern crate libc;
extern crate msg;
@ -50,7 +51,6 @@ use profile_traits::mem;
use std::any::Any;
use url::Url;
use util::ipc::OptionalOpaqueIpcSender;
use util::mem::HeapSizeOf;
pub use script_msg::{LayoutMsg, ScriptMsg};

View file

@ -168,6 +168,8 @@ dependencies = [
"cssparser 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.1 (git+https://github.com/servo/rust-layers)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
@ -334,6 +336,8 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -374,6 +378,8 @@ name = "devtools_traits"
version = "0.0.1"
dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
"msg 0.0.1",
@ -630,6 +636,8 @@ dependencies = [
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype)",
"gfx_traits 0.0.1",
"harfbuzz-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.1 (git+https://github.com/servo/rust-layers)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -671,6 +679,8 @@ version = "0.0.1"
dependencies = [
"azure 0.4.0 (git+https://github.com/servo/rust-azure)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.1 (git+https://github.com/servo/rust-layers)",
"msg 0.0.1",
"plugins 0.0.1",
@ -804,6 +814,8 @@ name = "html5ever"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -964,6 +976,8 @@ dependencies = [
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"gfx_traits 0.0.1",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
"layout_traits 0.0.1",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1152,6 +1166,8 @@ dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.1 (git+https://github.com/servo/rust-layers)",
@ -1222,6 +1238,8 @@ dependencies = [
name = "net_traits"
version = "0.0.1"
dependencies = [
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
@ -1530,6 +1548,8 @@ dependencies = [
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1579,6 +1599,8 @@ dependencies = [
"devtools_traits 0.0.1",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
@ -1602,6 +1624,8 @@ dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1777,6 +1801,8 @@ version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_generator 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_shared 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1793,6 +1819,8 @@ dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1833,6 +1861,8 @@ version = "0.0.1"
dependencies = [
"cssparser 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1947,6 +1977,8 @@ version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1982,6 +2014,8 @@ dependencies = [
"cssparser 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",

View file

@ -161,4 +161,4 @@ bitflags = "0.3"
env_logger = "0.3"
euclid = {version = "0.6.1", features = ["plugins"]}
libc = "0.2"
url = {version = "0.5.4", features = ["serde_serialization", "query_encoding"]}
url = {version = "0.5.4", features = ["heap_size", "serde_serialization", "query_encoding"]}

View file

@ -20,21 +20,23 @@ path = "../style_traits"
[dependencies]
app_units = {version = "0.2", features = ["plugins"]}
cssparser = {version = "0.5.2", features = ["serde-serialization"]}
cssparser = {version = "0.5.2", features = ["heap_size", "serde-serialization"]}
log = "0.3"
encoding = "0.2"
fnv = "1.0"
heapsize = "0.2.5"
heapsize_plugin = "0.1.2"
rustc-serialize = "0.3"
matches = "0.1"
bitflags = "0.3"
num = "0.1.24"
lazy_static = "0.1.10"
selectors = { version = "0.4.1", features = ["unstable"] }
selectors = {version = "0.4.1", features = ["heap_size", "unstable"]}
smallvec = "0.1"
string_cache = "0.2.7"
string_cache = {version = "0.2.7", features = ["heap_size"]}
euclid = {version = "0.6.1", features = ["plugins"]}
serde = "0.6"
serde_macros = "0.6"
time = "0.1"
url = "0.5.4"
url = {version = "0.5.4", features = ["heap_size"]}

View file

@ -10,7 +10,6 @@ use std::collections::{HashMap, HashSet};
use std::fmt;
use std::sync::Arc;
use string_cache::Atom;
use util::mem::HeapSizeOf;
// Does not include the `--` prefix
pub type Name = Atom;

View file

@ -8,7 +8,6 @@ use parser::{ParserContext, log_css_error};
use properties::longhands::font_family::parse_one_family;
use std::ascii::AsciiExt;
use url::Url;
use util::mem::HeapSizeOf;
#[derive(Clone, Debug, HeapSizeOf, PartialEq, Eq, Deserialize, Serialize)]
pub enum Source {

View file

@ -11,9 +11,9 @@
#![feature(custom_derive)]
#![feature(plugin)]
#![plugin(serde_macros)]
#![plugin(serde_macros)]
#![plugin(heapsize_plugin)]
#![plugin(plugins)]
#![plugin(serde_macros)]
#![recursion_limit = "500"] // For match_ignore_ascii_case in PropertyDeclaration::parse
@ -26,6 +26,7 @@ extern crate cssparser;
extern crate encoding;
extern crate euclid;
extern crate fnv;
extern crate heapsize;
#[macro_use]
extern crate lazy_static;
#[macro_use]

View file

@ -8,7 +8,6 @@ use euclid::size::{Size2D, TypedSize2D};
use properties::longhands;
use std::ascii::AsciiExt;
use util::geometry::ViewportPx;
use util::mem::HeapSizeOf;
use values::specified;

View file

@ -19,7 +19,6 @@ use std::iter::Iterator;
use std::slice;
use string_cache::{Atom, Namespace};
use url::Url;
use util::mem::HeapSizeOf;
use viewport::ViewportRule;

View file

@ -18,7 +18,6 @@ use std::str::Chars;
use style_traits::viewport::{Orientation, UserZoom, ViewportConstraints, Zoom};
use stylesheets::Origin;
use util::geometry::ViewportPx;
use util::mem::HeapSizeOf;
use values::computed::{Context, ToComputedValue};
use values::specified::{Length, LengthOrPercentageOrAuto, ViewportPercentageLength};

View file

@ -14,14 +14,15 @@ path = "../util"
path = "../plugins"
[dependencies]
cssparser = {version = "0.5.2", features = ["serde-serialization"]}
cssparser = {version = "0.5.2", features = ["heap_size", "serde-serialization"]}
euclid = {version = "0.6.1", features = ["plugins"]}
heapsize = "0.2.5"
heapsize_plugin = "0.1.2"
lazy_static = "0.1.10"
log = "0.3"
num = "0.1.24"
rustc-serialize = "0.3"
selectors = "0.4.1"
selectors = {version = "0.4.1", features = ["heap_size"]}
serde = "0.6"
serde_macros = "0.6"
url = "0.5.4"
url = {version = "0.5.4", features = ["heap_size"]}

View file

@ -10,6 +10,7 @@
#![crate_type = "rlib"]
#![feature(custom_derive)]
#![feature(plugin)]
#![plugin(heapsize_plugin)]
#![plugin(serde_macros)]
#![plugin(plugins)]
#![deny(unsafe_code)]
@ -17,6 +18,7 @@
#[macro_use]
extern crate cssparser;
extern crate euclid;
extern crate heapsize;
extern crate rustc_serialize;
extern crate serde;
extern crate util;

View file

@ -47,10 +47,12 @@ git = "https://github.com/servo/ipc-channel"
[dependencies]
app_units = {version = "0.2", features = ["plugins"]}
bitflags = "0.3"
cssparser = {version = "0.5.2", features = ["serde-serialization"]}
cssparser = {version = "0.5.2", features = ["heap_size", "serde-serialization"]}
euclid = {version = "0.6.1", features = ["unstable", "plugins"]}
getopts = "0.2.11"
html5ever = {version = "0.4.2", features = ["unstable"], optional = true}
html5ever = {version = "0.4.2", features = ["heap_size", "unstable"], optional = true}
heapsize = "0.2.5"
heapsize_plugin = "0.1.2"
hyper = { version = "0.7", optional = true }
lazy_static = "0.1"
libc = "0.2"
@ -59,12 +61,12 @@ num = "0.1.24"
num_cpus = "0.2.2"
rand = "0.3"
rustc-serialize = "0.3"
selectors = "0.4.1"
selectors = {version = "0.4.1", features = ["heap_size"]}
serde = "0.6"
serde_macros = "0.6"
smallvec = "0.1"
string_cache = "0.2.7"
url = {version = "0.5.4", features = ["serde_serialization"]}
string_cache = {version = "0.2.7", features = ["heap_size"]}
url = {version = "0.5.4", features = ["heap_size", "serde_serialization"]}
uuid = "0.1.17"
[target.x86_64-pc-windows-gnu.dependencies]

View file

@ -9,7 +9,7 @@ use std::ascii::AsciiExt;
macro_rules! define_cursor {
($( $css: expr => $variant: ident = $value: expr, )+) => {
#[derive(Clone, Copy, PartialEq, Eq, Debug, Deserialize, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, HeapSizeOf, PartialEq, Serialize)]
#[repr(u8)]
pub enum Cursor {
$( $variant = $value ),+

View file

@ -23,7 +23,7 @@ use std::i32;
///
/// The ratio between ScreenPx and DevicePixel for a given display be found by calling
/// `servo::windowing::WindowMethods::hidpi_factor`.
#[derive(Debug, Copy, Clone)]
#[derive(Clone, Copy, Debug, HeapSizeOf)]
pub enum ScreenPx {}
/// One CSS "px" in the coordinate system of the "initial viewport":
@ -35,7 +35,7 @@ pub enum ScreenPx {}
///
/// At the default zoom level of 100%, one PagePx is equal to one ScreenPx. However, if the
/// document is zoomed in or out then this scale may be larger or smaller.
#[derive(RustcEncodable, Debug, Copy, Clone)]
#[derive(Clone, Copy, Debug, HeapSizeOf)]
pub enum ViewportPx {}
/// One CSS "px" in the root coordinate system for the content document.
@ -44,7 +44,7 @@ pub enum ViewportPx {}
/// This is the mobile-style "pinch zoom" that enlarges content without reflowing it. When the
/// viewport zoom is not equal to 1.0, then the layout viewport is no longer the same physical size
/// as the viewable area.
#[derive(RustcEncodable, Debug, Copy, Clone)]
#[derive(Clone, Copy, Debug, HeapSizeOf)]
pub enum PagePx {}
// In summary, the hierarchy of pixel units and the factors to convert from one to the next:

View file

@ -18,7 +18,7 @@
#![feature(step_trait)]
#![feature(zero_one)]
#![plugin(plugins, serde_macros)]
#![plugin(heapsize_plugin, plugins, serde_macros)]
extern crate alloc;
extern crate app_units;
@ -30,6 +30,7 @@ extern crate bitflags;
extern crate cssparser;
extern crate euclid;
extern crate getopts;
extern crate heapsize;
#[cfg(feature = "non-geckolib")]
extern crate html5ever;
#[cfg(feature = "non-geckolib")]
@ -66,7 +67,6 @@ pub mod geometry;
pub mod ipc;
pub mod linked_list;
pub mod logical_geometry;
#[macro_use] pub mod mem;
#[cfg(feature = "non-geckolib")]
pub mod non_geckolib;
pub mod opts;

View file

@ -11,7 +11,7 @@ use std::fmt::{self, Debug, Error, Formatter};
use std::ops::{Add, Sub};
bitflags!(
#[derive(RustcEncodable)]
#[derive(HeapSizeOf, RustcEncodable)]
flags WritingMode: u8 {
const FLAG_RTL = 1 << 0,
const FLAG_VERTICAL = 1 << 1,

View file

@ -1,360 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
//! Data structure measurement.
use app_units::Au;
use cssparser::Color as CSSParserColor;
use cssparser::{RGBA, TokenSerializationType};
use cursor::Cursor;
use euclid::length::Length;
use euclid::scale_factor::ScaleFactor;
use euclid::{Matrix2D, Matrix4, Point2D, Rect, SideOffsets2D, Size2D};
use geometry::{PagePx, ViewportPx};
use libc::{c_void, size_t};
use logical_geometry::WritingMode;
use rand::OsRng;
use range::Range;
use selectors::parser::{Combinator, CompoundSelector, Selector, SimpleSelector, SelectorImpl};
use std::cell::{Cell, RefCell};
use std::collections::{HashMap, LinkedList};
use std::hash::{BuildHasher, Hash};
use std::mem::{size_of, transmute};
use std::rc::Rc;
use std::result::Result;
use std::sync::Arc;
use std::sync::atomic::{AtomicIsize, AtomicUsize};
use str::{DOMString, LengthOrPercentageOrAuto};
use string_cache::atom::Atom;
use string_cache::namespace::{QualName, Namespace};
use url;
use uuid::Uuid;
extern {
// Get the size of a heap block.
//
// Ideally Rust would expose a function like this in std::rt::heap, which would avoid the
// jemalloc dependence.
//
// The C prototype is `je_malloc_usable_size(JEMALLOC_USABLE_SIZE_CONST void *ptr)`. On some
// platforms `JEMALLOC_USABLE_SIZE_CONST` is `const` and on some it is empty. But in practice
// this function doesn't modify the contents of the block that `ptr` points to, so we use
// `*const c_void` here.
fn je_malloc_usable_size(ptr: *const c_void) -> size_t;
}
// A wrapper for je_malloc_usable_size that handles `EMPTY` and returns `usize`.
pub fn heap_size_of(ptr: *const c_void) -> usize {
if ptr == ::alloc::heap::EMPTY as *const c_void {
0
} else {
unsafe { je_malloc_usable_size(ptr) as usize }
}
}
// The simplest trait for measuring the size of heap data structures. More complex traits that
// return multiple measurements -- e.g. measure text separately from images -- are also possible,
// and should be used when appropriate.
//
pub trait HeapSizeOf {
/// Measure the size of any heap-allocated structures that hang off this value, but not the
/// space taken up by the value itself (i.e. what size_of::<T> measures, more or less); that
/// space is handled by the implementation of HeapSizeOf for Box<T> below.
fn heap_size_of_children(&self) -> usize;
}
// There are two possible ways to measure the size of `self` when it's on the heap: compute it
// (with `::std::rt::heap::usable_size(::std::mem::size_of::<T>(), 0)`) or measure it directly
// using the heap allocator (with `heap_size_of`). We do the latter, for the following reasons.
//
// * The heap allocator is the true authority for the sizes of heap blocks; its measurement is
// guaranteed to be correct. In comparison, size computations are error-prone. (For example, the
// `rt::heap::usable_size` function used in some of Rust's non-default allocator implementations
// underestimate the true usable size of heap blocks, which is safe in general but would cause
// under-measurement here.)
//
// * If we measure something that isn't a heap block, we'll get a crash. This keeps us honest,
// which is important because unsafe code is involved and this can be gotten wrong.
//
// However, in the best case, the two approaches should give the same results.
//
impl<T: HeapSizeOf> HeapSizeOf for Box<T> {
fn heap_size_of_children(&self) -> usize {
// Measure size of `self`.
heap_size_of(&**self as *const T as *const c_void) + (**self).heap_size_of_children()
}
}
impl HeapSizeOf for String {
fn heap_size_of_children(&self) -> usize {
heap_size_of(self.as_ptr() as *const c_void)
}
}
impl HeapSizeOf for DOMString {
fn heap_size_of_children(&self) -> usize {
heap_size_of(self.as_ptr() as *const c_void)
}
}
impl<T: HeapSizeOf> HeapSizeOf for Option<T> {
fn heap_size_of_children(&self) -> usize {
match *self {
None => 0,
Some(ref x) => x.heap_size_of_children()
}
}
}
impl HeapSizeOf for url::Url {
fn heap_size_of_children(&self) -> usize {
// Using a struct pattern without `..` rather than `foo.bar` field access
// makes sure this will be updated if a field is added.
let &url::Url { ref scheme, ref scheme_data, ref query, ref fragment } = self;
scheme.heap_size_of_children() +
scheme_data.heap_size_of_children() +
query.heap_size_of_children() +
fragment.heap_size_of_children()
}
}
impl HeapSizeOf for url::SchemeData {
fn heap_size_of_children(&self) -> usize {
match *self {
url::SchemeData::Relative(ref data) => data.heap_size_of_children(),
url::SchemeData::NonRelative(ref str) => str.heap_size_of_children()
}
}
}
impl HeapSizeOf for url::RelativeSchemeData {
fn heap_size_of_children(&self) -> usize {
// Using a struct pattern without `..` rather than `foo.bar` field access
// makes sure this will be updated if a field is added.
let &url::RelativeSchemeData { ref username, ref password, ref host,
ref port, ref default_port, ref path } = self;
username.heap_size_of_children() +
password.heap_size_of_children() +
host.heap_size_of_children() +
port.heap_size_of_children() +
default_port.heap_size_of_children() +
path.heap_size_of_children()
}
}
impl HeapSizeOf for url::Host {
fn heap_size_of_children(&self) -> usize {
match *self {
url::Host::Domain(ref str) => str.heap_size_of_children(),
url::Host::Ipv6(_) => 0,
url::Host::Ipv4(_) => 0,
}
}
}
impl<T: HeapSizeOf, U: HeapSizeOf> HeapSizeOf for (T, U) {
fn heap_size_of_children(&self) -> usize {
self.0.heap_size_of_children() + self.1.heap_size_of_children()
}
}
impl<T: HeapSizeOf> HeapSizeOf for Arc<T> {
fn heap_size_of_children(&self) -> usize {
(**self).heap_size_of_children()
}
}
impl<T: HeapSizeOf> HeapSizeOf for RefCell<T> {
fn heap_size_of_children(&self) -> usize {
self.borrow().heap_size_of_children()
}
}
impl<T: HeapSizeOf + Copy> HeapSizeOf for Cell<T> {
fn heap_size_of_children(&self) -> usize {
self.get().heap_size_of_children()
}
}
impl<T: HeapSizeOf> HeapSizeOf for Vec<T> {
fn heap_size_of_children(&self) -> usize {
heap_size_of(self.as_ptr() as *const c_void) +
self.iter().fold(0, |n, elem| n + elem.heap_size_of_children())
}
}
impl<T> HeapSizeOf for Vec<Rc<T>> {
fn heap_size_of_children(&self) -> usize {
// The fate of measuring Rc<T> is still undecided, but we still want to measure
// the space used for storing them.
heap_size_of(self.as_ptr() as *const c_void)
}
}
impl<K: HeapSizeOf, V: HeapSizeOf, S> HeapSizeOf for HashMap<K, V, S>
where K: Eq + Hash, S: BuildHasher {
fn heap_size_of_children(&self) -> usize {
//TODO(#6908) measure actual bucket memory usage instead of approximating
let size = self.capacity() * (size_of::<V>() + size_of::<K>());
self.iter().fold(size, |n, (key, value)| {
n + key.heap_size_of_children() + value.heap_size_of_children()
})
}
}
// FIXME(njn): We can't implement HeapSizeOf accurately for LinkedList because it requires access
// to the private Node type. Eventually we'll want to add HeapSizeOf (or equivalent) to Rust
// itself. In the meantime, we use the dirty hack of transmuting LinkedList into an identical type
// (LinkedList2) and measuring that.
impl<T: HeapSizeOf> HeapSizeOf for LinkedList<T> {
fn heap_size_of_children(&self) -> usize {
let list2: &LinkedList2<T> = unsafe { transmute(self) };
list2.heap_size_of_children()
}
}
struct LinkedList2<T> {
_length: usize,
list_head: Link<T>,
_list_tail: Rawlink<Node<T>>,
}
type Link<T> = Option<Box<Node<T>>>;
struct Rawlink<T> {
_p: *mut T,
}
struct Node<T> {
next: Link<T>,
_prev: Rawlink<Node<T>>,
value: T,
}
impl<T: HeapSizeOf> HeapSizeOf for Node<T> {
// Unlike most heap_size_of_children() functions, this one does *not* measure descendents.
// Instead, LinkedList2<T>::heap_size_of_children() handles that, so that it can use iteration
// instead of recursion, which avoids potentially blowing the stack.
fn heap_size_of_children(&self) -> usize {
self.value.heap_size_of_children()
}
}
impl<T: HeapSizeOf> HeapSizeOf for LinkedList2<T> {
fn heap_size_of_children(&self) -> usize {
let mut size = 0;
let mut curr: &Link<T> = &self.list_head;
while curr.is_some() {
size += (*curr).heap_size_of_children();
curr = &curr.as_ref().unwrap().next;
}
size
}
}
// This is a basic sanity check. If the representation of LinkedList changes such that it becomes a
// different size to LinkedList2, this will fail at compile-time.
#[allow(dead_code)]
unsafe fn linked_list2_check() {
transmute::<LinkedList<i32>, LinkedList2<i32>>(panic!());
}
// Currently, types that implement the Drop type are larger than those that don't. Because
// LinkedList implements Drop, LinkedList2 must also so that linked_list2_check() doesn't fail.
impl<T> Drop for LinkedList2<T> {
fn drop(&mut self) {}
}
/// For use on types defined in external crates
/// with known heap sizes.
#[macro_export]
macro_rules! known_heap_size(
($size:expr, $($ty:ident),+) => (
$(
impl $crate::mem::HeapSizeOf for $ty {
#[inline(always)]
fn heap_size_of_children(&self) -> usize {
$size
}
}
)+
);
($size: expr, $($ty:ident<$($gen:ident),+>),+) => (
$(
impl<$($gen: $crate::mem::HeapSizeOf),+> $crate::mem::HeapSizeOf for $ty<$($gen),+> {
#[inline(always)]
fn heap_size_of_children(&self) -> usize {
$size
}
}
)+
);
);
impl<T: HeapSizeOf, U: HeapSizeOf> HeapSizeOf for Result<T, U> {
fn heap_size_of_children(&self) -> usize {
match *self {
Result::Ok(ref ok) => ok.heap_size_of_children(),
Result::Err(ref err) => err.heap_size_of_children()
}
}
}
impl HeapSizeOf for () {
fn heap_size_of_children(&self) -> usize {
0
}
}
impl<T: SelectorImpl> HeapSizeOf for Selector<T>
where T::NonTSPseudoClass: HeapSizeOf,
T::PseudoElement: HeapSizeOf {
fn heap_size_of_children(&self) -> usize {
let &Selector { ref compound_selectors, ref pseudo_element, ref specificity } = self;
compound_selectors.heap_size_of_children() + pseudo_element.heap_size_of_children() +
specificity.heap_size_of_children()
}
}
impl<T: SelectorImpl> HeapSizeOf for CompoundSelector<T>
where T::NonTSPseudoClass: HeapSizeOf {
fn heap_size_of_children(&self) -> usize {
let &CompoundSelector { ref simple_selectors, ref next } = self;
simple_selectors.heap_size_of_children() + next.heap_size_of_children()
}
}
impl<T: SelectorImpl> HeapSizeOf for SimpleSelector<T>
where T::NonTSPseudoClass: HeapSizeOf {
fn heap_size_of_children(&self) -> usize {
match *self {
SimpleSelector::Negation(ref vec) => vec.heap_size_of_children(),
SimpleSelector::AttrIncludes(_, ref str) | SimpleSelector::AttrPrefixMatch(_, ref str) |
SimpleSelector::AttrSubstringMatch(_, ref str) | SimpleSelector::AttrSuffixMatch(_, ref str)
=> str.heap_size_of_children(),
SimpleSelector::AttrEqual(_, ref str, _) => str.heap_size_of_children(),
SimpleSelector::AttrDashMatch(_, ref first, ref second)
=> first.heap_size_of_children() + second.heap_size_of_children(),
SimpleSelector::NonTSPseudoClass(ref pseudo_class)
=> pseudo_class.heap_size_of_children(),
// All other types come down to Atom, enum or i32, all 0
_ => 0
}
}
}
known_heap_size!(0, u8, u16, u32, u64, usize);
known_heap_size!(0, i8, i16, i32, i64, isize);
known_heap_size!(0, bool, f32, f64);
known_heap_size!(0, AtomicIsize, AtomicUsize);
known_heap_size!(0, Rect<T>, Point2D<T>, Size2D<T>, Matrix2D<T>, SideOffsets2D<T>, Range<T>);
known_heap_size!(0, Length<T, U>, ScaleFactor<T, U, V>);
known_heap_size!(0, Au, WritingMode, CSSParserColor, RGBA, Cursor, Matrix4, QualName, Atom, Namespace);
known_heap_size!(0, PagePx, ViewportPx, OsRng);
known_heap_size!(0, TokenSerializationType, LengthOrPercentageOrAuto);
known_heap_size!(0, Combinator, str);
known_heap_size!(0, Uuid);

View file

@ -4,20 +4,10 @@
///! Miscellaneous Code which depends on large libraries that we don't
/// depend on in GeckoLib builds.
use azure::azure_hl::Color;
use html5ever::tree_builder::QuirksMode;
use hyper::header::ContentType;
use hyper::http::RawStatus;
use hyper::method::Method;
use hyper::mime::{Attr, Mime, SubLevel, TopLevel, Value};
use js::conversions::{FromJSValConvertible, ToJSValConvertible, latin1_to_string};
use js::jsapi::{JSContext, JSString, HandleValue, Heap, MutableHandleValue};
use js::jsapi::{JSContext, JSString, HandleValue, MutableHandleValue};
use js::jsapi::{JS_GetTwoByteStringCharsAndLength, JS_StringHasLatin1Chars};
use js::jsval::JSVal;
use js::rust::{GCMethods, ToString};
use layers::geometry::DevicePixel;
use mem::HeapSizeOf;
use js::rust::ToString;
use opts;
use std::char;
use std::ptr;
@ -99,73 +89,3 @@ pub unsafe fn jsstring_to_str(cx: *mut JSContext, s: *mut JSString) -> DOMString
s
})
}
// This is measured properly by the heap measurement implemented in SpiderMonkey.
impl<T: Copy + GCMethods<T>> HeapSizeOf for Heap<T> {
fn heap_size_of_children(&self) -> usize {
0
}
}
impl HeapSizeOf for ContentType {
fn heap_size_of_children(&self) -> usize {
let &ContentType(ref mime) = self;
mime.heap_size_of_children()
}
}
impl HeapSizeOf for Method {
fn heap_size_of_children(&self) -> usize {
match *self {
Method::Extension(ref str) => str.heap_size_of_children(),
_ => 0
}
}
}
impl HeapSizeOf for Mime {
fn heap_size_of_children(&self) -> usize {
let &Mime(ref top_level, ref sub_level, ref vec) = self;
top_level.heap_size_of_children() + sub_level.heap_size_of_children() +
vec.heap_size_of_children()
}
}
impl HeapSizeOf for TopLevel {
fn heap_size_of_children(&self) -> usize {
match *self {
TopLevel::Ext(ref str) => str.heap_size_of_children(),
_ => 0
}
}
}
impl HeapSizeOf for SubLevel {
fn heap_size_of_children(&self) -> usize {
match *self {
SubLevel::Ext(ref str) => str.heap_size_of_children(),
_ => 0
}
}
}
impl HeapSizeOf for Attr {
fn heap_size_of_children(&self) -> usize {
match *self {
Attr::Ext(ref str) => str.heap_size_of_children(),
_ => 0
}
}
}
impl HeapSizeOf for Value {
fn heap_size_of_children(&self) -> usize {
match *self {
Value::Ext(ref str) => str.heap_size_of_children(),
_ => 0
}
}
}
known_heap_size!(0, Color, DevicePixel, JSVal, QuirksMode, RawStatus);

View file

@ -136,7 +136,7 @@ macro_rules! int_range_index {
}
/// A range of indices
#[derive(Clone, RustcEncodable, Copy, Deserialize, Serialize)]
#[derive(Clone, Copy, Deserialize, HeapSizeOf, RustcEncodable, Serialize)]
pub struct Range<I> {
begin: I,
length: I,

View file

@ -16,7 +16,7 @@ use std::iter::{Filter, Peekable};
use std::ops::{Deref, DerefMut};
use std::str::{Bytes, CharIndices, FromStr, Split, from_utf8};
#[derive(Clone, PartialOrd, Ord, PartialEq, Eq, Deserialize, Serialize, Hash, Debug)]
#[derive(Clone, Debug, Deserialize, Eq, Hash, HeapSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
pub struct DOMString(String);
impl !Send for DOMString {}
@ -220,7 +220,7 @@ pub fn parse_unsigned_integer<T: Iterator<Item=char>>(input: T) -> Option<u32> {
})
}
#[derive(Copy, Clone, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, HeapSizeOf, PartialEq)]
pub enum LengthOrPercentageOrAuto {
Auto,
Percentage(f32),

View file

@ -31,5 +31,5 @@ log = "0.3"
hyper = "0.7"
rustc-serialize = "0.3.4"
regex = "0.1.33"
url = "0.5.4"
url = {version = "0.5.4", features = ["heap_size"]}
uuid = "0.1"

34
ports/cef/Cargo.lock generated
View file

@ -158,6 +158,8 @@ dependencies = [
"cssparser 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.1 (git+https://github.com/servo/rust-layers)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
@ -335,6 +337,8 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -375,6 +379,8 @@ name = "devtools_traits"
version = "0.0.1"
dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
"msg 0.0.1",
@ -598,6 +604,8 @@ dependencies = [
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype)",
"gfx_traits 0.0.1",
"harfbuzz-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.1 (git+https://github.com/servo/rust-layers)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -630,6 +638,8 @@ version = "0.0.1"
dependencies = [
"azure 0.4.0 (git+https://github.com/servo/rust-azure)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.1 (git+https://github.com/servo/rust-layers)",
"msg 0.0.1",
"plugins 0.0.1",
@ -763,6 +773,8 @@ name = "html5ever"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -923,6 +935,8 @@ dependencies = [
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"gfx_traits 0.0.1",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
"layout_traits 0.0.1",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1111,6 +1125,8 @@ dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.1 (git+https://github.com/servo/rust-layers)",
@ -1163,6 +1179,8 @@ dependencies = [
name = "net_traits"
version = "0.0.1"
dependencies = [
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
@ -1454,6 +1472,8 @@ dependencies = [
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1494,6 +1514,8 @@ dependencies = [
"devtools_traits 0.0.1",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
@ -1517,6 +1539,8 @@ dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1727,6 +1751,8 @@ version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_generator 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_shared 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1743,6 +1769,8 @@ dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1766,6 +1794,8 @@ version = "0.0.1"
dependencies = [
"cssparser 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1880,6 +1910,8 @@ version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1915,6 +1947,8 @@ dependencies = [
"cssparser 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",

View file

@ -14,7 +14,7 @@ gleam = "0.2"
libc = "0.2"
log = "0.3"
stb_image = "0.2"
url = "0.5.4"
url = {version = "0.5.4", features = ["heap_size"]}
[dependencies.servo]
path = "../../components/servo"

View file

@ -71,6 +71,8 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -319,6 +321,8 @@ dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -362,6 +366,8 @@ version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_generator 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_shared 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -378,6 +384,8 @@ dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -401,6 +409,8 @@ version = "0.0.1"
dependencies = [
"cssparser 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
@ -454,6 +464,8 @@ name = "url"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -471,6 +483,8 @@ dependencies = [
"cssparser 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -11,15 +11,15 @@ crate-type = ["staticlib"]
[dependencies]
app_units = {version = "0.2", features = ["plugins"]}
bitflags = "0.3"
cssparser = {version = "0.5.2", features = ["serde-serialization"]}
cssparser = {version = "0.5.2", features = ["heap_size", "serde-serialization"]}
euclid = {version = "0.6.1", features = ["plugins"]}
libc = "0.2"
log = "0.3"
num_cpus = "0.2.2"
selectors = "0.4.1"
selectors = {version = "0.4.1", features = ["heap_size"]}
smallvec = "0.1"
string_cache = "0.2.7"
url = "0.5.4"
string_cache = {version = "0.2.7", features = ["heap_size"]}
url = {version = "0.5.4", features = ["heap_size"]}
[dependencies.util]
path = "../../components/util"

View file

@ -13,7 +13,7 @@ headless = ["servo-glutin/headless"]
[dependencies]
bitflags = "0.3"
url = "0.5.4"
url = {version = "0.5.4", features = ["heap_size"]}
gleam = "0.2"
euclid = {version = "0.6.1", features = ["plugins"]}
servo-glutin = "0.4"

34
ports/gonk/Cargo.lock generated
View file

@ -150,6 +150,8 @@ dependencies = [
"cssparser 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.1 (git+https://github.com/servo/rust-layers)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
@ -316,6 +318,8 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -356,6 +360,8 @@ name = "devtools_traits"
version = "0.0.1"
dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
"msg 0.0.1",
@ -589,6 +595,8 @@ dependencies = [
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype)",
"gfx_traits 0.0.1",
"harfbuzz-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.1 (git+https://github.com/servo/rust-layers)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -621,6 +629,8 @@ version = "0.0.1"
dependencies = [
"azure 0.4.0 (git+https://github.com/servo/rust-azure)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.1 (git+https://github.com/servo/rust-layers)",
"msg 0.0.1",
"plugins 0.0.1",
@ -734,6 +744,8 @@ name = "html5ever"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -894,6 +906,8 @@ dependencies = [
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"gfx_traits 0.0.1",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
"layout_traits 0.0.1",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1082,6 +1096,8 @@ dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.1 (git+https://github.com/servo/rust-layers)",
@ -1134,6 +1150,8 @@ dependencies = [
name = "net_traits"
version = "0.0.1"
dependencies = [
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
@ -1425,6 +1443,8 @@ dependencies = [
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1465,6 +1485,8 @@ dependencies = [
"devtools_traits 0.0.1",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
@ -1488,6 +1510,8 @@ dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1696,6 +1720,8 @@ version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_generator 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_shared 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1712,6 +1738,8 @@ dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1735,6 +1763,8 @@ version = "0.0.1"
dependencies = [
"cssparser 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1849,6 +1879,8 @@ version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1884,6 +1916,8 @@ dependencies = [
"cssparser 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",

View file

@ -46,7 +46,7 @@ features = ["non-geckolib"]
[dependencies]
env_logger = "0.3"
url = "0.5.4"
url = {version = "0.5.4", features = ["heap_size"]}
time = "0.1.17"
errno = "0.1"
libc = "0.2"

View file

@ -32,6 +32,6 @@ git = "https://github.com/servo/ipc-channel"
[dependencies]
cookie = "0.2"
hyper = "0.7"
url = "0.5.4"
url = {version = "0.5.4", features = ["heap_size"]}
time = "0.1"
flate2 = "0.2.0"

View file

@ -12,4 +12,4 @@ doctest = false
path = "../../../components/plugins"
[dependencies]
url = "0.5.4"
url = {version = "0.5.4", features = ["heap_size"]}

View file

@ -25,8 +25,8 @@ path = "../../../components/util"
[dependencies]
app_units = {version = "0.2", features = ["plugins"]}
url = "0.5.4"
cssparser = "0.5.2"
selectors = "0.4.1"
string_cache = "0.2.7"
url = {version = "0.5.4", features = ["heap_size"]}
cssparser = {version = "0.5.2", features = ["heap_size"]}
selectors = {version = "0.4.1", features = ["heap_size"]}
string_cache = {version = "0.2.7", features = ["heap_size"]}
euclid = {version = "0.6.1", features = ["plugins"]}

View file

@ -16,6 +16,5 @@ extern crate util;
#[cfg(test)] mod logical_geometry;
#[cfg(test)] mod thread;
#[cfg(test)] mod vec;
#[cfg(test)] mod mem;
#[cfg(test)] mod str;
#[cfg(test)] mod opts;

View file

@ -1,106 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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 libc::c_void;
use util::mem::{HeapSizeOf, heap_size_of};
struct Four;
impl HeapSizeOf for Four {
fn heap_size_of_children(&self) -> usize {
4
}
}
#[derive(HeapSizeOf)]
struct Eight(Four, Four, bool, bool, bool);
#[derive(HeapSizeOf)]
enum EightOrFour {
Eight(Eight),
Four(Four),
Zero(u8)
}
#[test]
fn test_heap_size() {
// Note: jemalloc often rounds up request sizes. However, it does not round up for request
// sizes of 8 and higher that are powers of two. We take advantage of knowledge here to make
// the sizes of various heap-allocated blocks predictable.
//-----------------------------------------------------------------------
// Start with basic heap block measurement.
unsafe {
// EMPTY is the special non-null address used to represent zero-size allocations.
assert_eq!(heap_size_of(::alloc::heap::EMPTY as *const c_void), 0);
// A 64 byte request is allocated exactly.
let x = ::alloc::heap::allocate(64, 0);
assert_eq!(heap_size_of(x as *const c_void), 64);
::alloc::heap::deallocate(x, 64, 0);
// A 255 byte request is rounded up to 256 bytes.
let x = ::alloc::heap::allocate(255, 0);
assert_eq!(heap_size_of(x as *const c_void), 256);
::alloc::heap::deallocate(x, 255, 0);
// A 1MiB request is allocated exactly.
let x = ::alloc::heap::allocate(1024 * 1024, 0);
assert_eq!(heap_size_of(x as *const c_void), 1024 * 1024);
::alloc::heap::deallocate(x, 1024 * 1024, 0);
}
//-----------------------------------------------------------------------
// Test HeapSizeOf implementations for various built-in types.
// Not on the heap; 0 bytes.
let x = 0i64;
assert_eq!(x.heap_size_of_children(), 0);
// An i64 is 8 bytes.
let x = Box::new(0i64);
assert_eq!(x.heap_size_of_children(), 8);
// An ascii string with 16 chars is 16 bytes in UTF-8.
assert_eq!(String::from("0123456789abcdef").heap_size_of_children(), 16);
// Not on the heap.
let x: Option<i32> = None;
assert_eq!(x.heap_size_of_children(), 0);
// Not on the heap.
let x = Some(0i64);
assert_eq!(x.heap_size_of_children(), 0);
// The `Some` is not on the heap, but the Box is.
let x = Some(Box::new(0i64));
assert_eq!(x.heap_size_of_children(), 8);
// Not on the heap.
let x = ::std::sync::Arc::new(0i64);
assert_eq!(x.heap_size_of_children(), 0);
// The `Arc` is not on the heap, but the Box is.
let x = ::std::sync::Arc::new(Box::new(0i64));
assert_eq!(x.heap_size_of_children(), 8);
// Zero elements, no heap storage.
let x: Vec<i64> = vec![];
assert_eq!(x.heap_size_of_children(), 0);
// Four elements, 8 bytes per element.
let x = vec![0i64, 1i64, 2i64, 3i64];
assert_eq!(x.heap_size_of_children(), 32);
//-----------------------------------------------------------------------
// Test the HeapSizeOf auto-deriving.
assert_eq!(Four.heap_size_of_children(), 4);
let eight = Eight(Four, Four, true, true, true);
assert_eq!(eight.heap_size_of_children(), 8);
assert_eq!(EightOrFour::Eight(eight).heap_size_of_children(), 8);
assert_eq!(EightOrFour::Four(Four).heap_size_of_children(), 4);
assert_eq!(EightOrFour::Zero(1).heap_size_of_children(), 0);
}