Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump heapsize to 0.3 #9622

Merged
merged 12 commits into from Feb 13, 2016
@@ -37,4 +37,4 @@ git = "https://github.com/servo/ipc-channel"
log = "0.3"
num = "0.1.24"
gleam = "0.2"
euclid = {version = "0.6.1", features = ["plugins"]}
euclid = {version = "0.6.2", features = ["plugins"]}
@@ -35,9 +35,9 @@ path = "../plugins"
path = "../util"

[dependencies]
cssparser = {version = "0.5.2", features = ["heap_size", "serde-serialization"]}
euclid = {version = "0.6.1", features = ["plugins"]}
heapsize = "0.2.5"
cssparser = {version = "0.5.3", features = ["heap_size", "serde-serialization"]}
euclid = {version = "0.6.2", features = ["plugins"]}
heapsize = "0.3.0"
heapsize_plugin = "0.1.2"
serde_macros = "0.6"

@@ -82,16 +82,16 @@ git = "https://github.com/servo/gaol"
git = "https://github.com/servo/gaol"

[dependencies]
app_units = {version = "0.2", features = ["plugins"]}
app_units = {version = "0.2.1", features = ["plugins"]}
euclid = {version = "0.6.2", features = ["plugins"]}
gleam = "0.2"
image = "0.5.0"
log = "0.3"
num = "0.1.24"
time = "0.1.17"
gleam = "0.2"
euclid = {version = "0.6.1", features = ["plugins"]}
serde = "0.6"
serde_macros = "0.6"
url = {version = "0.5.4", features = ["heap_size"]}
time = "0.1.17"
url = {version = "0.5.5", features = ["heap_size"]}

[target.x86_64-apple-darwin.dependencies]
core-graphics = "0.2"
@@ -20,13 +20,13 @@ git = "https://github.com/servo/ipc-channel"
path = "../plugins"

[dependencies]
heapsize = "0.2.5"
heapsize = "0.3.0"
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 = {version = "0.5.4", features = ["heap_size"]}
url = {version = "0.5.5", features = ["heap_size"]}

@@ -9,12 +9,12 @@ name = "gfx"
path = "lib.rs"

[dependencies]
app_units = {version = "0.2", features = ["plugins"]}
app_units = {version = "0.2.1", features = ["plugins"]}
bitflags = "0.3"
euclid = {version = "0.6.1", features = ["plugins"]}
euclid = {version = "0.6.2", features = ["plugins"]}
fnv = "1.0"
harfbuzz-sys = "0.1"
heapsize = "0.2.5"
heapsize = "0.3.0"
heapsize_plugin = "0.1.2"
lazy_static = "0.1"
libc = "0.2"
@@ -24,12 +24,12 @@ rand = "0.3"
rustc-serialize = "0.3"
serde = "0.6"
serde_macros = "0.6"
servo-skia = "0.20130412.0"
smallvec = "0.1"
string_cache = {version = "0.2.7", features = ["heap_size"]}
string_cache = {version = "0.2.9", features = ["heap_size"]}
time = "0.1.12"
unicode-script = { version = "0.1", features = ["harfbuzz"] }
url = {version = "0.5.4", features = ["heap_size"]}
servo-skia = "0.20130412.0"
url = {version = "0.5.5", features = ["heap_size"]}

[dependencies.plugins]
path = "../plugins"
@@ -1238,7 +1238,7 @@ pub struct ImageDisplayItem {


/// Paints a gradient.
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
pub struct GradientDisplayItem {
/// Fields common to all display items.
pub base: BaseDisplayItem,
@@ -1253,21 +1253,6 @@ pub struct GradientDisplayItem {
pub stops: Vec<GradientStop>,
}


impl HeapSizeOf for GradientDisplayItem {
fn heap_size_of_children(&self) -> usize {
use heapsize::heap_size_of;
use libc::c_void;

// 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
// the HeapSizeOf trait is defined. So we measure the elements directly.
self.base.heap_size_of_children() +
heap_size_of(self.stops.as_ptr() as *const c_void)
}
}


/// Paints a border.
#[derive(Clone, HeapSizeOf, Deserialize, Serialize)]
pub struct BorderDisplayItem {
@@ -28,7 +28,7 @@ const FT_ALIGNMENT: usize = 1;
extern fn ft_alloc(mem: FT_Memory, req_size: c_long) -> *mut c_void {
unsafe {
let ptr = heap::allocate(req_size as usize, FT_ALIGNMENT) as *mut c_void;
let actual_size = heap_size_of(ptr);
let actual_size = heap_size_of(ptr as *const _);

let user = (*mem).user as *mut User;
(*user).size += actual_size;
@@ -39,7 +39,7 @@ extern fn ft_alloc(mem: FT_Memory, req_size: c_long) -> *mut c_void {

extern fn ft_free(mem: FT_Memory, ptr: *mut c_void) {
unsafe {
let actual_size = heap_size_of(ptr);
let actual_size = heap_size_of(ptr as *const _);

let user = (*mem).user as *mut User;
(*user).size -= actual_size;
@@ -51,10 +51,10 @@ extern fn ft_free(mem: FT_Memory, ptr: *mut c_void) {
extern fn ft_realloc(mem: FT_Memory, _cur_size: c_long, new_req_size: c_long,
old_ptr: *mut c_void) -> *mut c_void {
unsafe {
let old_actual_size = heap_size_of(old_ptr);
let old_actual_size = heap_size_of(old_ptr as *const _);
let new_ptr = heap::reallocate(old_ptr as *mut u8, old_actual_size,
new_req_size as usize, FT_ALIGNMENT) as *mut c_void;
let new_actual_size = heap_size_of(new_ptr);
let new_actual_size = heap_size_of(new_ptr as *const _);

let user = (*mem).user as *mut User;
(*user).size += new_actual_size;
@@ -90,11 +90,12 @@ impl Drop for FreeTypeLibraryHandle {

impl HeapSizeOf for FreeTypeLibraryHandle {
fn heap_size_of_children(&self) -> usize {
let ft_size = unsafe { (*self.user).size };
ft_size +
heap_size_of(self.ctx as *const c_void) +
heap_size_of(self.mem as *const c_void) +
heap_size_of(self.user as *const c_void)
unsafe {
(*self.user).size +
heap_size_of(self.ctx as *const _) +
heap_size_of(self.mem as *const _) +
heap_size_of(self.user as *const _)
}
}
}

@@ -25,8 +25,8 @@ path = "../plugins"
path = "../util"

[dependencies]
euclid = {version = "0.6.1", features = ["plugins"]}
heapsize = "0.2.5"
euclid = {version = "0.6.2", features = ["plugins"]}
heapsize = "0.3.0"
heapsize_plugin = "0.1.2"
serde = "0.6"
serde_macros = "0.6"
@@ -54,23 +54,23 @@ path = "../util"
git = "https://github.com/servo/ipc-channel"

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

[dependencies]
bitflags = "0.3"
cssparser = {version = "0.5.2", features = ["heap_size", "serde-serialization"]}
euclid = {version = "0.6.1", features = ["plugins"]}
heapsize = "0.2.5"
cssparser = {version = "0.5.3", features = ["heap_size", "serde-serialization"]}
euclid = {version = "0.6.2", features = ["plugins"]}
heapsize = "0.3.0"
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 = {version = "0.5.4", features = ["heap_size"]}
url = {version = "0.5.5", features = ["heap_size"]}
@@ -38,6 +38,6 @@ cookie = "0.2"
mime_guess = "1.1.1"
flate2 = "0.2.0"
uuid = "0.1.16"
url = {version = "0.5.4", features = ["heap_size"]}
url = {version = "0.5.5", features = ["heap_size"]}
websocket = "0.14.0"
immeta = "0.3.1"
@@ -20,13 +20,13 @@ git = "https://github.com/servo/ipc-channel"
path = "../plugins"

[dependencies]
heapsize = "0.2.5"
heapsize = "0.3.0"
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 = {version = "0.5.4", features = ["heap_size"]}
url = {version = "0.5.5", features = ["heap_size"]}
websocket = "0.14.0"
@@ -17,7 +17,7 @@ rev = "9dca15de3e8ea266d3e7e868c0f358ed4fa5f195"
optional = true

[dependencies]
url = {version = "0.5.4", features = ["heap_size"]}
url = {version = "0.5.5", features = ["heap_size"]}

[features]
default = []
@@ -63,16 +63,16 @@ features = ["unstable"]
path = "../gfx_traits"

[dependencies]
app_units = {version = "0.2", features = ["plugins"]}
app_units = {version = "0.2.1", features = ["plugins"]}
bitflags = "0.3"
caseless = "0.1.0"
cssparser = {version = "0.5.2", features = ["heap_size", "serde-serialization"]}
cssparser = {version = "0.5.3", features = ["heap_size", "serde-serialization"]}
encoding = "0.2"
euclid = {version = "0.6.1", features = ["plugins"]}
euclid = {version = "0.6.2", features = ["plugins"]}
fnv = "1.0"
heapsize = "0.2.5"
heapsize = "0.3.0"
heapsize_plugin = "0.1.2"
html5ever = {version = "0.5.0", features = ["heap_size", "unstable"]}
html5ever = {version = "0.5.1", features = ["heap_size", "unstable"]}
hyper = { version = "0.7", features = [ "serde-serialization" ] }
image = "0.5.0"
libc = "0.2"
@@ -81,12 +81,12 @@ num = "0.1.24"
rand = "0.3"
ref_slice = "0.1.0"
rustc-serialize = "0.3"
selectors = {version = "0.4.1", features = ["heap_size"]}
selectors = {version = "0.4.2", features = ["heap_size"]}
serde = "0.6"
smallvec = "0.1"
string_cache = {version = "0.2.7", features = ["heap_size", "unstable"]}
string_cache = {version = "0.2.9", features = ["heap_size", "unstable"]}
time = "0.1.12"
unicase = "1.0"
url = {version = "0.5.4", features = ["heap_size"]}
url = {version = "0.5.5", features = ["heap_size"]}
uuid = "0.1.16"
websocket = "0.14.0"
@@ -36,6 +36,7 @@ use js::{JS_CALLEE};
use libc::{self, c_uint};
use std::default::Default;
use std::ffi::CString;
use std::os::raw::c_void;
use std::ptr;
use util::non_geckolib::jsstring_to_str;

@@ -91,7 +92,7 @@ pub struct DOMClass {
pub type_id: TopTypeId,

/// The HeapSizeOf function wrapper for that interface.
pub heap_size_of: unsafe fn(*const libc::c_void) -> usize,
pub heap_size_of: unsafe fn(*const c_void) -> usize,
}
unsafe impl Sync for DOMClass {}

@@ -2446,7 +2446,7 @@ impl HeapSizeOf for UniqueId {
#[allow(unsafe_code)]
fn heap_size_of_children(&self) -> usize {
if let &Some(ref uuid) = unsafe { &*self.cell.get() } {
heap_size_of(&** uuid as *const Uuid as *const c_void)
unsafe { heap_size_of(&** uuid as *const Uuid as *const _) }
} else {
0
}
@@ -7,7 +7,7 @@
use dom::bindings::conversions::get_dom_class;
use dom::bindings::reflector::Reflectable;
use heapsize::{HeapSizeOf, heap_size_of};
use libc::c_void;
use std::os::raw::c_void;

// 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
@@ -41,12 +41,12 @@ path = "../devtools_traits"
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"
app_units = {version = "0.2.1", features = ["plugins"]}
euclid = {version = "0.6.2", features = ["plugins"]}
heapsize = "0.3.0"
heapsize_plugin = "0.1.2"
libc = "0.2"
serde = "0.6"
serde_macros = "0.6"
time = "0.1.12"
url = {version = "0.5.4", features = ["heap_size"]}
url = {version = "0.5.5", features = ["heap_size"]}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.