Replace all uses of the heapsize crate with malloc_size_of.

Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`.
`malloc_size_of` is better -- it handles various cases that `heapsize` does not
-- so this patch changes Servo to use `malloc_size_of`.

This patch makes the following changes to the `malloc_size_of` crate.

- Adds `MallocSizeOf` trait implementations for numerous types, some built-in
  (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`).

- Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't
  support that operation.

- For `HashSet`/`HashMap`, falls back to a computed estimate when
  `enclosing_size_of_op` isn't available.

- Adds an extern "C" `malloc_size_of` function that does the actual heap
  measurement; this is based on the same functions from the `heapsize` crate.

This patch makes the following changes elsewhere.

- Converts all the uses of `heapsize` to instead use `malloc_size_of`.

- Disables the "heapsize"/"heap_size" feature for the external crates that
  provide it.

- Removes the `HeapSizeOf` implementation from `hashglobe`.

- Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of`
  doesn't derive those types, unlike `heapsize`.
This commit is contained in:
Nicholas Nethercote 2017-10-18 10:42:01 +11:00
parent 421baa854e
commit 4506f0d30c
269 changed files with 1418 additions and 1521 deletions

82
Cargo.lock generated
View file

@ -327,10 +327,10 @@ version = "0.0.1"
dependencies = [
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.0.1",
"nonzero 0.0.1",
"offscreen_gl_context 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
@ -580,7 +580,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"dtoa-short 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
@ -714,11 +713,11 @@ name = "devtools_traits"
version = "0.0.1"
dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.0.1",
"msg 0.0.1",
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
"servo_url 0.0.1",
@ -1099,12 +1098,12 @@ dependencies = [
"freetype 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"harfbuzz-sys 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.0.1",
"msg 0.0.1",
"net_traits 0.0.1",
"ordered-float 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1142,8 +1141,8 @@ dependencies = [
name = "gfx_traits"
version = "0.0.1"
dependencies = [
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.0.1",
"range 0.0.1",
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1244,7 +1243,6 @@ dependencies = [
name = "hashglobe"
version = "0.1.0"
dependencies = [
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1257,16 +1255,6 @@ dependencies = [
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "heapsize_derive"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "heartbeats-simple"
version = "0.4.0"
@ -1514,11 +1502,11 @@ dependencies = [
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"gfx_traits 0.0.1",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"msg 0.0.1",
"net_traits 0.0.1",
"ordered-float 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1562,7 +1550,6 @@ dependencies = [
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"gfx_traits 0.0.1",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"layout 0.0.1",
@ -1570,6 +1557,7 @@ dependencies = [
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"metrics 0.0.1",
"msg 0.0.1",
"net_traits 0.0.1",
@ -1744,9 +1732,15 @@ dependencies = [
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.3 (registry+https://github.com/rust-lang/crates.io-index)",
"hashglobe 0.1.0",
"js 0.1.6 (git+https://github.com/servo/rust-mozjs)",
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"servo_arc 0.0.1",
"smallbitvec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender_api 0.52.1 (git+https://github.com/servo/webrender)",
"xml5ever 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1763,8 +1757,6 @@ name = "markup5ever"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1914,8 +1906,8 @@ name = "msg"
version = "0.0.1"
dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.0.1",
"nonzero 0.0.1",
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender_api 0.52.1 (git+https://github.com/servo/webrender)",
@ -2018,14 +2010,14 @@ name = "net_traits"
version = "0.0.1"
dependencies = [
"cookie 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.0.1",
"msg 0.0.1",
"num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2452,8 +2444,8 @@ dependencies = [
name = "range"
version = "0.0.1"
dependencies = [
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.0.1",
"num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -2602,8 +2594,6 @@ dependencies = [
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"half 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2614,6 +2604,8 @@ dependencies = [
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.0.1",
"metrics 0.0.1",
"mime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"mime_guess 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2669,12 +2661,12 @@ dependencies = [
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.3 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.0.1",
"metrics 0.0.1",
"msg 0.0.1",
"net_traits 0.0.1",
@ -2715,12 +2707,12 @@ dependencies = [
"devtools_traits 0.0.1",
"euclid 0.15.3 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.0.1",
"msg 0.0.1",
"net_traits 0.0.1",
"profile_traits 0.0.1",
@ -2933,7 +2925,6 @@ dependencies = [
name = "servo_arc"
version = "0.0.1"
dependencies = [
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"nodrop 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
"stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2979,7 +2970,8 @@ version = "0.0.1"
dependencies = [
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.0.1",
]
[[package]]
@ -3011,8 +3003,8 @@ dependencies = [
name = "servo_url"
version = "0.0.1"
dependencies = [
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.0.1",
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
"servo_rand 0.0.1",
"url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3081,9 +3073,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "smallvec"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "stable_deref_trait"
@ -3096,7 +3085,6 @@ version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
"precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3143,8 +3131,6 @@ dependencies = [
"fallible 0.0.1",
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hashglobe 0.1.0",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3222,8 +3208,6 @@ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.0.1",
"selectors 0.19.0",
@ -3491,7 +3475,6 @@ version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"idna 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3872,7 +3855,6 @@ dependencies = [
"checksum half 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "63d68db75012a85555434ee079e7e6337931f87a087ab2988becbadf64673a7f"
"checksum harfbuzz-sys 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "a2caaa66078fdfacea32db1351223697a1167ad2d4bbee6b8d4ca220ce5b10b3"
"checksum heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4c7593b1522161003928c959c20a2ca421c68e940d63d75573316a009e48a6d4"
"checksum heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "46f96d52fb1564059fc97b85ef6165728cc30198ab60073bf114c66c4c89bb5d"
"checksum heartbeats-simple 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ad003ce233955e9d95f2c69cde84e68302ba9ba4a673d351c9bff93c738aadc"
"checksum heartbeats-simple-sys 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e1a408c0011427cc0e0049f7861c70377819aedfc006e8c901b1c70fd98fb1a4"
"checksum html5ever 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5bfb46978eb757a603b7dfe2dafb1c62cb4dee3428d8ac1de734d83d6b022d06"

View file

@ -10,7 +10,7 @@ build = "build.rs"
path = "lib.rs"
[dependencies]
string_cache = {version = "0.6", features = ["heapsize"]}
string_cache = {version = "0.6"}
[build-dependencies]
string_cache_codegen = "0.4"

View file

@ -12,10 +12,10 @@ path = "lib.rs"
[dependencies]
cssparser = "0.22.0"
euclid = "0.15"
heapsize = "0.4"
heapsize_derive = "0.1"
ipc-channel = "0.9"
lazy_static = "0.2"
malloc_size_of = { path = "../malloc_size_of" }
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
nonzero = {path = "../nonzero"}
offscreen_gl_context = { version = "0.11", features = ["serde"] }
serde = "1.0"

View file

@ -82,13 +82,13 @@ pub enum FromScriptMsg {
SendPixels(IpcSender<Option<Vec<u8>>>),
}
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct CanvasGradientStop {
pub offset: f64,
pub color: RGBA,
}
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct LinearGradientStyle {
pub x0: f64,
pub y0: f64,
@ -110,7 +110,7 @@ impl LinearGradientStyle {
}
}
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct RadialGradientStyle {
pub x0: f64,
pub y0: f64,
@ -165,7 +165,7 @@ pub enum FillOrStrokeStyle {
Surface(SurfaceStyle),
}
#[derive(Clone, Copy, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum LineCapStyle {
Butt = 0,
Round = 1,
@ -185,7 +185,7 @@ impl FromStr for LineCapStyle {
}
}
#[derive(Clone, Copy, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum LineJoinStyle {
Round = 0,
Bevel = 1,
@ -227,7 +227,7 @@ impl FromStr for RepetitionStyle {
}
}
#[derive(Clone, Copy, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum CompositionStyle {
SrcIn,
SrcOut,
@ -281,7 +281,7 @@ impl CompositionStyle {
}
}
#[derive(Clone, Copy, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum BlendingStyle {
Multiply,
Screen,
@ -347,7 +347,7 @@ impl BlendingStyle {
}
}
#[derive(Clone, Copy, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum CompositionOrBlending {
Composition(CompositionStyle),
Blending(BlendingStyle),

View file

@ -9,10 +9,10 @@
extern crate cssparser;
extern crate euclid;
extern crate heapsize;
#[macro_use] extern crate heapsize_derive;
extern crate ipc_channel;
#[macro_use] extern crate lazy_static;
extern crate malloc_size_of;
#[macro_use] extern crate malloc_size_of_derive;
extern crate nonzero;
extern crate offscreen_gl_context;
#[macro_use] extern crate serde;

View file

@ -64,7 +64,7 @@ pub struct WebGLCreateContextResult {
pub share_mode: WebGLContextShareMode,
}
#[derive(Clone, Copy, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Copy, Deserialize, MallocSizeOf, Serialize)]
pub enum WebGLContextShareMode {
/// Fast: a shared texture_id is used in WebRender.
SharedTexture,
@ -73,10 +73,10 @@ pub enum WebGLContextShareMode {
}
/// Helper struct to send WebGLCommands to a specific WebGLContext.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct WebGLMsgSender {
ctx_id: WebGLContextId,
#[ignore_heap_size_of = "channels are hard"]
#[ignore_malloc_size_of = "channels are hard"]
sender: WebGLChan,
}
@ -313,8 +313,8 @@ macro_rules! define_resource_id {
}
}
impl ::heapsize::HeapSizeOf for $name {
fn heap_size_of_children(&self) -> usize { 0 }
impl ::malloc_size_of::MallocSizeOf for $name {
fn size_of(&self, _ops: &mut ::malloc_size_of::MallocSizeOfOps) -> usize { 0 }
}
}
}
@ -327,13 +327,10 @@ define_resource_id!(WebGLProgramId);
define_resource_id!(WebGLShaderId);
define_resource_id!(WebGLVertexArrayId);
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, Ord)]
#[derive(PartialEq, PartialOrd, Serialize)]
pub struct WebGLContextId(pub usize);
impl ::heapsize::HeapSizeOf for WebGLContextId {
fn heap_size_of_children(&self) -> usize { 0 }
}
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
pub enum WebGLError {
InvalidEnum,

View file

@ -11,11 +11,11 @@ path = "lib.rs"
[dependencies]
bitflags = "0.7"
heapsize = "0.4"
heapsize_derive = "0.1"
hyper = "0.10"
hyper_serde = "0.7"
ipc-channel = "0.9"
malloc_size_of = { path = "../malloc_size_of" }
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
msg = {path = "../msg"}
serde = "1.0"
servo_url = {path = "../url"}

View file

@ -14,10 +14,10 @@
#[macro_use]
extern crate bitflags;
extern crate heapsize;
#[macro_use] extern crate heapsize_derive;
extern crate hyper;
extern crate ipc_channel;
extern crate malloc_size_of;
#[macro_use] extern crate malloc_size_of_derive;
extern crate msg;
#[macro_use] extern crate serde;
extern crate servo_url;
@ -40,7 +40,7 @@ pub struct DevtoolsPageInfo {
pub url: ServoUrl,
}
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub struct CSSError {
pub filename: String,
pub line: u32,
@ -144,7 +144,7 @@ pub struct TimelineMarker {
pub end_stack: Option<Vec<()>>,
}
#[derive(Clone, Debug, Deserialize, Eq, Hash, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
pub enum TimelineMarkerType {
Reflow,
DOMEvent,
@ -355,5 +355,5 @@ impl PreciseTime {
}
}
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
pub struct WorkerId(pub u32);

View file

@ -15,7 +15,7 @@ pub fn dom_struct(args: TokenStream, input: TokenStream) -> TokenStream {
panic!("#[dom_struct] takes no arguments");
}
let attributes = quote! {
#[derive(DenyPublicFields, DomObject, HeapSizeOf, JSTraceable)]
#[derive(DenyPublicFields, DomObject, JSTraceable, MallocSizeOf)]
#[must_root]
#[repr(C)]
};

View file

@ -12,4 +12,5 @@ path = "lib.rs"
[dependencies]
app_units = "0.5"
euclid = "0.15"
heapsize = "0.4"
malloc_size_of = { path = "../malloc_size_of" }
malloc_size_of_derive = { path = "../malloc_size_of_derive" }

View file

@ -4,7 +4,8 @@
extern crate app_units;
extern crate euclid;
#[macro_use] extern crate heapsize;
extern crate malloc_size_of;
#[macro_use] extern crate malloc_size_of_derive;
use app_units::{Au, MAX_AU, MIN_AU};
use euclid::{Point2D, Rect, Size2D};
@ -24,11 +25,9 @@ use euclid::{Point2D, Rect, Size2D};
///
/// The ratio between DeviceIndependentPixel and DevicePixel for a given display be found by calling
/// `servo::windowing::WindowMethods::hidpi_factor`.
#[derive(Clone, Copy, Debug)]
#[derive(Clone, Copy, Debug, MallocSizeOf)]
pub enum DeviceIndependentPixel {}
known_heap_size!(0, DeviceIndependentPixel);
// An Au is an "App Unit" and represents 1/60th of a CSS pixel. It was
// originally proposed in 2002 as a standard unit of measure in Gecko.
// See https://bugzilla.mozilla.org/show_bug.cgi?id=177805 for more info.

View file

@ -21,12 +21,12 @@ fnv = "1.0"
fontsan = {git = "https://github.com/servo/fontsan"}
gfx_traits = {path = "../gfx_traits"}
harfbuzz-sys = "0.1"
heapsize = "0.4"
heapsize_derive = "0.1"
ipc-channel = "0.9"
lazy_static = "0.2"
libc = "0.2"
log = "0.3.5"
malloc_size_of = { path = "../malloc_size_of" }
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
msg = {path = "../msg"}
net_traits = {path = "../net_traits"}
ordered-float = "0.4"

View file

@ -43,7 +43,7 @@ pub use style::dom::OpaqueNode;
/// items that involve a blur. This ensures that the display item boundaries include all the ink.
pub static BLUR_INFLATION_FACTOR: i32 = 3;
#[derive(Deserialize, HeapSizeOf, Serialize)]
#[derive(Deserialize, MallocSizeOf, Serialize)]
pub struct DisplayList {
pub list: Vec<DisplayItem>,
}
@ -314,7 +314,7 @@ impl<'a> Iterator for DisplayListTraversal<'a> {
/// Display list sections that make up a stacking context. Each section here refers
/// to the steps in CSS 2.1 Appendix E.
///
#[derive(Clone, Copy, Debug, Deserialize, Eq, HeapSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, MallocSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
pub enum DisplayListSection {
BackgroundAndBorders,
BlockBackgroundsAndBorders,
@ -322,14 +322,14 @@ pub enum DisplayListSection {
Outlines,
}
#[derive(Clone, Copy, Debug, Deserialize, Eq, HeapSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, MallocSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
pub enum StackingContextType {
Real,
PseudoPositioned,
PseudoFloat,
}
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
/// Represents one CSS stacking context, which may or may not have a hardware layer.
pub struct StackingContext {
/// The ID of this StackingContext for uniquely identifying it.
@ -484,7 +484,7 @@ impl fmt::Debug for StackingContext {
}
}
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub enum ClipScrollNodeType {
ScrollFrame(ScrollSensitivity),
StickyFrame(StickyFrameInfo),
@ -492,7 +492,7 @@ pub enum ClipScrollNodeType {
}
/// Defines a clip scroll node.
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub struct ClipScrollNode {
/// The WebRender clip id of this scroll root based on the source of this clip
/// and information about the fragment.
@ -522,7 +522,7 @@ impl ClipScrollNode {
/// One drawing command in the list.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub enum DisplayItem {
SolidColor(Box<SolidColorDisplayItem>),
Text(Box<TextDisplayItem>),
@ -541,7 +541,7 @@ pub enum DisplayItem {
}
/// Information common to all display items.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct BaseDisplayItem {
/// The boundaries of the display item, in layer coordinates.
pub bounds: Rect<Au>,
@ -600,7 +600,7 @@ impl BaseDisplayItem {
/// A clipping region for a display item. Currently, this can describe rectangles, rounded
/// rectangles (for `border-radius`), or arbitrary intersections of the two. Arbitrary transforms
/// are not supported because those are handled by the higher-level `StackingContext` abstraction.
#[derive(Clone, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub struct ClippingRegion {
/// The main rectangular region. This does not include any corners.
pub main: Rect<Au>,
@ -614,7 +614,7 @@ pub struct ClippingRegion {
/// A complex clipping region. These don't as easily admit arbitrary intersection operations, so
/// they're stored in a list over to the side. Currently a complex clipping region is just a
/// rounded rectangle, but the CSS WGs will probably make us throw more stuff in here eventually.
#[derive(Clone, Debug, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub struct ComplexClippingRegion {
/// The boundaries of the rectangle.
pub rect: Rect<Au>,
@ -784,7 +784,7 @@ impl ComplexClippingRegion {
/// Metadata attached to each display item. This is useful for performing auxiliary threads with
/// the display list involving hit testing: finding the originating DOM node and determining the
/// cursor to use when the element is hovered over.
#[derive(Clone, Copy, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Copy, Deserialize, MallocSizeOf, Serialize)]
pub struct DisplayItemMetadata {
/// The DOM node from which this display item originated.
pub node: OpaqueNode,
@ -794,7 +794,7 @@ pub struct DisplayItemMetadata {
}
/// Paints a solid color.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct SolidColorDisplayItem {
/// Fields common to all display items.
pub base: BaseDisplayItem,
@ -804,13 +804,13 @@ pub struct SolidColorDisplayItem {
}
/// Paints text.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct TextDisplayItem {
/// Fields common to all display items.
pub base: BaseDisplayItem,
/// The text run.
#[ignore_heap_size_of = "Because it is non-owning"]
#[ignore_malloc_size_of = "Because it is non-owning"]
pub text_run: Arc<TextRun>,
/// The range of text within the text run.
@ -826,7 +826,7 @@ pub struct TextDisplayItem {
pub orientation: TextOrientation,
}
#[derive(Clone, Deserialize, Eq, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Deserialize, Eq, MallocSizeOf, PartialEq, Serialize)]
pub enum TextOrientation {
Upright,
SidewaysLeft,
@ -834,13 +834,13 @@ pub enum TextOrientation {
}
/// Paints an image.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct ImageDisplayItem {
pub base: BaseDisplayItem,
pub webrender_image: WebRenderImageInfo,
#[ignore_heap_size_of = "Because it is non-owning"]
#[ignore_malloc_size_of = "Because it is non-owning"]
pub image_data: Option<Arc<IpcSharedMemory>>,
/// The dimensions to which the image display item should be stretched. If this is smaller than
@ -857,14 +857,14 @@ pub struct ImageDisplayItem {
pub image_rendering: image_rendering::T,
}
/// Paints an iframe.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct IframeDisplayItem {
pub base: BaseDisplayItem,
pub iframe: PipelineId,
}
/// Paints a gradient.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct Gradient {
/// The start point of the gradient (computed during display list construction).
pub start_point: Point2D<Au>,
@ -879,7 +879,7 @@ pub struct Gradient {
pub repeating: bool,
}
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct GradientDisplayItem {
/// Fields common to all display item.
pub base: BaseDisplayItem,
@ -889,7 +889,7 @@ pub struct GradientDisplayItem {
}
/// Paints a radial gradient.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct RadialGradient {
/// The center point of the gradient.
pub center: Point2D<Au>,
@ -904,7 +904,7 @@ pub struct RadialGradient {
pub repeating: bool,
}
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct RadialGradientDisplayItem {
/// Fields common to all display item.
pub base: BaseDisplayItem,
@ -914,7 +914,7 @@ pub struct RadialGradientDisplayItem {
}
/// A normal border, supporting CSS border styles.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct NormalBorder {
/// Border colors.
pub color: SideOffsets2D<ColorF>,
@ -929,7 +929,7 @@ pub struct NormalBorder {
}
/// A border that is made of image segments.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct ImageBorder {
/// The image this border uses, border-image-source.
pub image: WebRenderImageInfo,
@ -951,7 +951,7 @@ pub struct ImageBorder {
}
/// A border that is made of linear gradient
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct GradientBorder {
/// The gradient info that this border uses, border-image-source.
pub gradient: Gradient,
@ -961,7 +961,7 @@ pub struct GradientBorder {
}
/// A border that is made of radial gradient
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct RadialGradientBorder {
/// The gradient info that this border uses, border-image-source.
pub gradient: RadialGradient,
@ -971,7 +971,7 @@ pub struct RadialGradientBorder {
}
/// Specifies the type of border
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub enum BorderDetails {
Normal(NormalBorder),
Image(ImageBorder),
@ -980,7 +980,7 @@ pub enum BorderDetails {
}
/// Paints a border.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct BorderDisplayItem {
/// Fields common to all display items.
pub base: BaseDisplayItem,
@ -995,7 +995,7 @@ pub struct BorderDisplayItem {
/// Information about the border radii.
///
/// TODO(pcwalton): Elliptical radii.
#[derive(Clone, Copy, Debug, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub struct BorderRadii<T> {
pub top_left: Size2D<T>,
pub top_right: Size2D<T>,
@ -1057,7 +1057,7 @@ impl<T> BorderRadii<T> where T: PartialEq + Zero + Clone {
}
/// Paints a line segment.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct LineDisplayItem {
pub base: BaseDisplayItem,
@ -1065,12 +1065,12 @@ pub struct LineDisplayItem {
pub color: ColorF,
/// The line segment style.
#[ignore_heap_size_of = "enum type in webrender"]
#[ignore_malloc_size_of = "enum type in webrender"]
pub style: webrender_api::LineStyle,
}
/// Paints a box shadow per CSS-BACKGROUNDS.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct BoxShadowDisplayItem {
/// Fields common to all display items.
pub base: BaseDisplayItem,
@ -1100,7 +1100,7 @@ pub struct BoxShadowDisplayItem {
}
/// Defines a text shadow that affects all items until the paired PopTextShadow.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct PushTextShadowDisplayItem {
/// Fields common to all display items.
pub base: BaseDisplayItem,
@ -1116,14 +1116,14 @@ pub struct PushTextShadowDisplayItem {
}
/// Defines a text shadow that affects all items until the next PopTextShadow.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct PopAllTextShadowsDisplayItem {
/// Fields common to all display items.
pub base: BaseDisplayItem,
}
/// Defines a stacking context.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct PushStackingContextItem {
/// Fields common to all display items.
pub base: BaseDisplayItem,
@ -1132,7 +1132,7 @@ pub struct PushStackingContextItem {
}
/// Defines a stacking context.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct PopStackingContextItem {
/// Fields common to all display items.
pub base: BaseDisplayItem,
@ -1141,7 +1141,7 @@ pub struct PopStackingContextItem {
}
/// Starts a group of items inside a particular scroll root.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct DefineClipScrollNodeItem {
/// Fields common to all display items.
pub base: BaseDisplayItem,
@ -1151,7 +1151,7 @@ pub struct DefineClipScrollNodeItem {
}
/// How a box shadow should be clipped.
#[derive(Clone, Copy, Debug, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum BoxShadowClipMode {
/// No special clipping should occur. This is used for (shadowed) text decorations.
None,
@ -1258,7 +1258,7 @@ impl fmt::Debug for DisplayItem {
}
}
#[derive(Clone, Copy, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Copy, Deserialize, MallocSizeOf, Serialize)]
pub struct WebRenderImageInfo {
pub width: u32,
pub height: u32,

View file

@ -7,7 +7,7 @@ use fnv::FnvHasher;
use font::{Font, FontGroup, FontHandleMethods};
use font_cache_thread::FontCacheThread;
use font_template::FontTemplateDescriptor;
use heapsize::HeapSizeOf;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use platform::font::FontHandle;
use platform::font_context::FontContextHandle;
use platform::font_template::FontTemplateData;
@ -232,10 +232,10 @@ impl FontContext {
}
}
impl HeapSizeOf for FontContext {
fn heap_size_of_children(&self) -> usize {
impl MallocSizeOf for FontContext {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
// FIXME(njn): Measure other fields eventually.
self.platform_handle.heap_size_of_children()
self.platform_handle.size_of(ops)
}
}

View file

@ -35,14 +35,15 @@ extern crate gfx_traits;
// shapers. For now, however, this is a hard dependency.
extern crate harfbuzz_sys as harfbuzz;
extern crate heapsize;
#[macro_use] extern crate heapsize_derive;
extern crate ipc_channel;
#[macro_use]
extern crate lazy_static;
extern crate libc;
#[macro_use]
extern crate log;
#[cfg_attr(target_os = "windows", macro_use)]
extern crate malloc_size_of;
#[macro_use] extern crate malloc_size_of_derive;
extern crate msg;
extern crate net_traits;
extern crate ordered_float;

View file

@ -8,7 +8,7 @@ use freetype::freetype::FT_Library;
use freetype::freetype::FT_Memory;
use freetype::freetype::FT_MemoryRec_;
use freetype::freetype::FT_New_Library;
use heapsize::{HeapSizeOf, heap_size_of};
use malloc_size_of::{malloc_size_of, MallocSizeOf, MallocSizeOfOps};
use std::mem;
use std::os::raw::{c_long, c_void};
use std::ptr;
@ -31,7 +31,7 @@ extern fn ft_alloc(mem: FT_Memory, req_size: c_long) -> *mut c_void {
mem::forget(vec);
unsafe {
let actual_size = heap_size_of(ptr as *const _);
let actual_size = malloc_size_of(ptr as *const _);
let user = (*mem).user as *mut User;
(*user).size += actual_size;
}
@ -41,7 +41,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 as *const _);
let actual_size = malloc_size_of(ptr as *const _);
let user = (*mem).user as *mut User;
(*user).size -= actual_size;
@ -55,7 +55,7 @@ extern fn ft_realloc(mem: FT_Memory, _cur_size: c_long, new_req_size: c_long,
let old_actual_size;
let mut vec;
unsafe {
old_actual_size = heap_size_of(old_ptr as *const _);
old_actual_size = malloc_size_of(old_ptr as *const _);
vec = Vec::<u8>::from_raw_parts(old_ptr as *mut u8, old_actual_size, old_actual_size);
};
@ -71,7 +71,7 @@ extern fn ft_realloc(mem: FT_Memory, _cur_size: c_long, new_req_size: c_long,
mem::forget(vec);
unsafe {
let new_actual_size = heap_size_of(new_ptr as *const _);
let new_actual_size = malloc_size_of(new_ptr as *const _);
let user = (*mem).user as *mut User;
(*user).size += new_actual_size;
(*user).size -= old_actual_size;
@ -104,13 +104,13 @@ impl Drop for FreeTypeLibraryHandle {
}
}
impl HeapSizeOf for FreeTypeLibraryHandle {
fn heap_size_of_children(&self) -> usize {
impl MallocSizeOf for FreeTypeLibraryHandle {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
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 _)
ops.malloc_size_of(self.ctx as *const _) +
ops.malloc_size_of(self.mem as *const _) +
ops.malloc_size_of(self.user as *const _)
}
}
}
@ -123,9 +123,9 @@ pub struct FontContextHandle {
pub ctx: Rc<FreeTypeLibraryHandle>,
}
impl HeapSizeOf for FontContextHandle {
fn heap_size_of_children(&self) -> usize {
self.ctx.heap_size_of_children()
impl MallocSizeOf for FontContextHandle {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.ctx.size_of(ops)
}
}

View file

@ -2,9 +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 heapsize::HeapSizeOf;
#[derive(Clone, Debug)]
#[derive(Clone, Debug, MallocSizeOf)]
pub struct FontContextHandle {
ctx: ()
}
@ -15,9 +13,3 @@ impl FontContextHandle {
FontContextHandle { ctx: () }
}
}
impl HeapSizeOf for FontContextHandle {
fn heap_size_of_children(&self) -> usize {
0
}
}

View file

@ -2,8 +2,6 @@
* 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 heapsize::HeapSizeOf;
#[derive(Clone, Debug)]
pub struct FontContextHandle;
@ -14,8 +12,4 @@ impl FontContextHandle {
}
}
impl HeapSizeOf for FontContextHandle {
fn heap_size_of_children(&self) -> usize {
0
}
}
malloc_size_of_is_0!(FontContextHandle);

View file

@ -10,7 +10,7 @@ name = "gfx_traits"
path = "lib.rs"
[dependencies]
heapsize = "0.4"
heapsize_derive = "0.1"
malloc_size_of = { path = "../malloc_size_of" }
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
range = {path = "../range"}
serde = "1.0"

View file

@ -7,8 +7,8 @@
#![deny(unsafe_code)]
extern crate heapsize;
#[macro_use] extern crate heapsize_derive;
extern crate malloc_size_of;
#[macro_use] extern crate malloc_size_of_derive;
#[macro_use] extern crate range;
#[macro_use] extern crate serde;
@ -28,7 +28,7 @@ impl Epoch {
}
/// A unique ID for every stacking context.
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
pub struct StackingContextId(
/// The identifier for this StackingContext, derived from the Flow's memory address
/// and fragment type. As a space optimization, these are combined into a single word.
@ -53,7 +53,7 @@ int_range_index! {
#[derive(Deserialize, Serialize)]
#[doc = "An index that refers to a byte offset in a text run. This could \
point to the middle of a glyph."]
#[derive(HeapSizeOf)]
#[derive(MallocSizeOf)]
struct ByteIndex(isize)
}
@ -62,7 +62,7 @@ int_range_index! {
/// This can only ever grow to maximum 4 entries. That's because we cram the value of this enum
/// into the lower 2 bits of the `StackingContextId`, which otherwise contains a 32-bit-aligned
/// heap address.
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
pub enum FragmentType {
/// A StackingContext for the fragment body itself.
FragmentBody,

View file

@ -11,7 +11,6 @@ readme = "README.md"
[dependencies]
libc = "0.2"
heapsize = "0.4"
[dev-dependencies]
rand = "0.3"

View file

@ -14,7 +14,6 @@
//! These methods are a lie. They are not actually fallible. This is just to make
//! it smooth to switch between hashmap impls in a codebase.
use heapsize::HeapSizeOf;
use std::collections::HashMap as StdMap;
use std::collections::HashSet as StdSet;
use std::fmt;
@ -161,14 +160,6 @@ impl<T, S> HashSet<T, S>
// Pass through trait impls
// We can't derive these since the bounds are not obvious to the derive macro
impl<K: HeapSizeOf + Hash + Eq, V: HeapSizeOf, S: BuildHasher>
HeapSizeOf for HashMap<K, V, S> {
fn heap_size_of_children(&self) -> usize {
self.0.heap_size_of_children()
}
}
impl<K: Hash + Eq, V, S: BuildHasher + Default> Default for HashMap<K, V, S> {
fn default() -> Self {
HashMap(Default::default())
@ -225,13 +216,6 @@ impl<'a, K, V, S> IntoIterator for &'a mut HashMap<K, V, S>
}
}
impl<T: HeapSizeOf + Eq + Hash, S: BuildHasher> HeapSizeOf for HashSet<T, S> {
fn heap_size_of_children(&self) -> usize {
self.0.heap_size_of_children()
}
}
impl<T: Eq + Hash, S: BuildHasher + Default> Default for HashSet<T, S> {
fn default() -> Self {
HashSet(Default::default())

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate heapsize;
pub mod alloc;
pub mod diagnostic;
pub mod hash_map;

View file

@ -18,11 +18,11 @@ euclid = "0.15"
fnv = "1.0"
gfx = {path = "../gfx"}
gfx_traits = {path = "../gfx_traits"}
heapsize = "0.4"
html5ever = "0.20.0"
ipc-channel = "0.9"
libc = "0.2"
log = "0.3.5"
malloc_size_of = { path = "../malloc_size_of" }
msg = {path = "../msg"}
net_traits = {path = "../net_traits"}
ordered-float = "0.4"

View file

@ -8,7 +8,7 @@ use fnv::FnvHasher;
use gfx::display_list::{WebRenderImageInfo, OpaqueNode};
use gfx::font_cache_thread::FontCacheThread;
use gfx::font_context::FontContext;
use heapsize::HeapSizeOf;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use msg::constellation_msg::PipelineId;
use net_traits::image_cache::{CanRequestImages, ImageCache, ImageState};
use net_traits::image_cache::{ImageOrMetadataAvailable, UsePlaceholder};
@ -42,10 +42,10 @@ pub fn with_thread_local_font_context<F, R>(layout_context: &LayoutContext, f: F
})
}
pub fn heap_size_of_persistent_local_context() -> usize {
pub fn malloc_size_of_persistent_local_context(ops: &mut MallocSizeOfOps) -> usize {
FONT_CONTEXT_KEY.with(|r| {
if let Some(ref context) = *r.borrow() {
context.heap_size_of_children()
context.size_of(ops)
} else {
0
}

View file

@ -13,12 +13,12 @@ extern crate euclid;
extern crate fnv;
extern crate gfx;
extern crate gfx_traits;
extern crate heapsize;
#[macro_use] extern crate html5ever;
extern crate ipc_channel;
extern crate libc;
#[macro_use]
extern crate log;
extern crate malloc_size_of;
extern crate msg;
extern crate net_traits;
extern crate ordered_float;

View file

@ -19,7 +19,6 @@ euclid = "0.15"
fnv = "1.0"
gfx = {path = "../gfx"}
gfx_traits = {path = "../gfx_traits"}
heapsize = "0.4"
html5ever = "0.20.0"
ipc-channel = "0.9"
layout = {path = "../layout"}
@ -27,6 +26,7 @@ layout_traits = {path = "../layout_traits"}
lazy_static = "0.2"
libc = "0.2"
log = "0.3.5"
malloc_size_of = { path = "../malloc_size_of" }
metrics = {path = "../metrics"}
msg = {path = "../msg"}
net_traits = {path = "../net_traits"}

View file

@ -13,7 +13,6 @@ extern crate euclid;
extern crate fnv;
extern crate gfx;
extern crate gfx_traits;
extern crate heapsize;
#[macro_use]
extern crate html5ever;
extern crate ipc_channel;
@ -25,6 +24,7 @@ extern crate lazy_static;
extern crate libc;
#[macro_use]
extern crate log;
extern crate malloc_size_of;
extern crate metrics;
extern crate msg;
extern crate net_traits;
@ -60,7 +60,6 @@ use gfx::font;
use gfx::font_cache_thread::FontCacheThread;
use gfx::font_context;
use gfx_traits::{Epoch, node_id_from_clip_id};
use heapsize::HeapSizeOf;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use layout::animation;
@ -68,7 +67,7 @@ use layout::construct::ConstructionResult;
use layout::context::LayoutContext;
use layout::context::RegisteredPainter;
use layout::context::RegisteredPainters;
use layout::context::heap_size_of_persistent_local_context;
use layout::context::malloc_size_of_persistent_local_context;
use layout::display_list_builder::ToGfxColor;
use layout::flow::{self, Flow, ImmutableFlowUtils, MutableOwnedFlowUtils};
use layout::flow_ref::FlowRef;
@ -85,6 +84,7 @@ use layout::webrender_helpers::WebRenderDisplayListConverter;
use layout::wrapper::LayoutNodeLayoutData;
use layout_traits::LayoutThreadFactory;
use libc::c_void;
use malloc_size_of::{malloc_size_of, MallocSizeOf, MallocSizeOfOps};
use metrics::{PaintTimeMetrics, ProfilerMetadataFactory};
use msg::constellation_msg::PipelineId;
use msg::constellation_msg::TopLevelBrowsingContextId;
@ -773,6 +773,9 @@ impl LayoutThread {
reports_chan: ReportsChan,
possibly_locked_rw_data: &mut RwData<'a, 'b>) {
let mut reports = vec![];
// Servo uses vanilla jemalloc, which doesn't have a
// malloc_enclosing_size_of function.
let mut ops = MallocSizeOfOps::new(malloc_size_of, None, None);
// FIXME(njn): Just measuring the display tree for now.
let rw_data = possibly_locked_rw_data.lock();
@ -781,20 +784,20 @@ impl LayoutThread {
reports.push(Report {
path: path![formatted_url, "layout-thread", "display-list"],
kind: ReportKind::ExplicitJemallocHeapSize,
size: display_list.map_or(0, |sc| sc.heap_size_of_children()),
size: display_list.map_or(0, |sc| sc.size_of(&mut ops)),
});
reports.push(Report {
path: path![formatted_url, "layout-thread", "stylist"],
kind: ReportKind::ExplicitJemallocHeapSize,
size: self.stylist.heap_size_of_children(),
size: self.stylist.size_of(&mut ops),
});
// The LayoutThread has data in Persistent TLS...
reports.push(Report {
path: path![formatted_url, "layout-thread", "local-context"],
kind: ReportKind::ExplicitJemallocHeapSize,
size: heap_size_of_persistent_local_context(),
size: malloc_size_of_persistent_local_context(&mut ops),
});
reports_chan.send(reports);

View file

@ -8,11 +8,22 @@ publish = false
[lib]
path = "lib.rs"
[target.'cfg(windows)'.dependencies]
kernel32-sys = "0.2.1"
[features]
servo = ["js", "string_cache", "url", "webrender_api", "xml5ever"]
[dependencies]
app_units = "0.5.5"
cssparser = "0.22.0"
euclid = "0.15"
hashglobe = { path = "../hashglobe" }
js = { git = "https://github.com/servo/rust-mozjs", features = ["promises"], optional = true }
servo_arc = { path = "../servo_arc" }
smallbitvec = "1.0.3"
smallvec = "0.4"
string_cache = { version = "0.6", optional = true }
url = { version = "1.2", optional = true }
webrender_api = { git = "https://github.com/servo/webrender", features = ["ipc"], optional = true }
xml5ever = { version = "0.10", optional = true }

View file

@ -10,28 +10,15 @@
//! A crate for measuring the heap usage of data structures in a way that
//! integrates with Firefox's memory reporting, particularly the use of
//! mozjemalloc and DMD.
//!
//! This crate has a lot of overlap with the existing `heapsize` crate, and may
//! one day be merged into it. But for now, `heapsize` has the following
//! major shortcomings.
//! - It basically assumes that the `HeapSizeOf` trait can be used for every
//! type, which is not true. Sometimes more than a single size measurement
//! needs to be returned for a type, and sometimes additional synchronization
//! arguments (such as lock guards) need to be passed in.
//! - It has no proper way of measuring some common types, such as `HashSet`
//! and `HashMap`, that don't expose internal pointers.
//! - It has no proper way of handling values with multiple referents, such as
//! `Rc` and `Arc`.
//!
//! This crate solves those problems.
//! mozjemalloc and DMD. In particular, it has the following features.
//! - It isn't bound to a particular heap allocator.
//! - It provides traits for both "shallow" and "deep" measurement, which gives
//! more flexibility in the cases where the traits can't be used.
//! flexibility in the cases where the traits can't be used.
//! - It allows for measuring blocks even when only an interior pointer can be
//! obtained for heap allocations, e.g. `HashSet` and `HashMap`. (This relies
//! on the heap allocator having suitable support, which mozjemalloc has.)
//! - It allows handling of types like `Rc` and `Arc` by providing special
//! traits that are different to the ones for non-graph structures.
//! - It allows handling of types like `Rc` and `Arc` by providing traits that
//! are different to the ones for non-graph structures.
//!
//! Suggested uses are as follows.
//! - When possible, use the `MallocSizeOf` trait. (Deriving support is
@ -60,11 +47,26 @@ extern crate app_units;
extern crate cssparser;
extern crate euclid;
extern crate hashglobe;
#[cfg(feature = "servo")]
extern crate js;
#[cfg(target_os = "windows")]
extern crate kernel32;
extern crate servo_arc;
extern crate smallbitvec;
extern crate smallvec;
#[cfg(feature = "servo")]
extern crate string_cache;
#[cfg(feature = "servo")]
extern crate url;
#[cfg(feature = "servo")]
extern crate webrender_api;
#[cfg(feature = "servo")]
extern crate xml5ever;
#[cfg(target_os = "windows")]
use kernel32::{GetProcessHeap, HeapSize, HeapValidate};
use std::hash::{BuildHasher, Hash};
use std::mem::size_of;
use std::ops::Range;
use std::os::raw::c_void;
@ -79,8 +81,11 @@ pub struct MallocSizeOfOps {
/// A function that returns the size of a heap allocation.
size_of_op: VoidPtrToSizeFn,
/// Like `size_of_op`, but can take an interior pointer.
enclosing_size_of_op: VoidPtrToSizeFn,
/// Like `size_of_op`, but can take an interior pointer. Optional because
/// not all allocators support this operation. If it's not provided, some
/// memory measurements will actually be computed estimates rather than
/// real and accurate measurements.
enclosing_size_of_op: Option<VoidPtrToSizeFn>,
/// Check if a pointer has been seen before, and remember it for next time.
/// Useful when measuring `Rc`s and `Arc`s. Optional, because many places
@ -89,7 +94,8 @@ pub struct MallocSizeOfOps {
}
impl MallocSizeOfOps {
pub fn new(size_of: VoidPtrToSizeFn, malloc_enclosing_size_of: VoidPtrToSizeFn,
pub fn new(size_of: VoidPtrToSizeFn,
malloc_enclosing_size_of: Option<VoidPtrToSizeFn>,
have_seen_ptr: Option<Box<VoidPtrToBoolFnMut>>) -> Self {
MallocSizeOfOps {
size_of_op: size_of,
@ -121,10 +127,16 @@ impl MallocSizeOfOps {
}
}
/// Call `enclosing_size_of_op` on `ptr`, which must not be empty.
/// Is an `enclosing_size_of_op` available?
pub fn has_malloc_enclosing_size_of(&self) -> bool {
self.enclosing_size_of_op.is_some()
}
/// Call `enclosing_size_of_op`, which must be available, on `ptr`, which
/// must not be empty.
pub unsafe fn malloc_enclosing_size_of<T>(&self, ptr: *const T) -> usize {
assert!(!MallocSizeOfOps::is_empty(ptr));
(self.enclosing_size_of_op)(ptr as *const c_void)
(self.enclosing_size_of_op.unwrap())(ptr as *const c_void)
}
/// Call `have_seen_ptr_op` on `ptr`.
@ -134,6 +146,33 @@ impl MallocSizeOfOps {
}
}
/// Get the size of a heap block.
#[cfg(not(target_os = "windows"))]
pub unsafe extern "C" fn malloc_size_of(ptr: *const c_void) -> usize {
// 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.
extern "C" {
#[cfg_attr(any(prefixed_jemalloc, target_os = "macos", target_os = "ios", target_os = "android"),
link_name = "je_malloc_usable_size")]
fn malloc_usable_size(ptr: *const c_void) -> usize;
}
malloc_usable_size(ptr)
}
/// Get the size of a heap block.
#[cfg(target_os = "windows")]
pub unsafe extern "C" fn malloc_size_of(mut ptr: *const c_void) -> usize {
let heap = GetProcessHeap();
if HeapValidate(heap, 0, ptr) == 0 {
ptr = *(ptr as *const *const c_void).offset(-1);
}
HeapSize(heap, 0, ptr) as usize
}
/// Trait for measuring the "deep" heap usage of a data structure. This is the
/// most commonly-used of the traits.
pub trait MallocSizeOf {
@ -188,6 +227,13 @@ impl MallocSizeOf for String {
}
}
impl<'a, T: ?Sized> MallocSizeOf for &'a T {
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
// Zero makes sense for a non-owning reference.
0
}
}
impl<T: ?Sized> MallocShallowSizeOf for Box<T> {
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
unsafe { ops.malloc_size_of(&**self) }
@ -200,12 +246,36 @@ impl<T: MallocSizeOf + ?Sized> MallocSizeOf for Box<T> {
}
}
impl<A: MallocSizeOf, B: MallocSizeOf> MallocSizeOf for (A, B) {
impl MallocSizeOf for () {
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
0
}
}
impl<T1, T2> MallocSizeOf for (T1, T2)
where T1: MallocSizeOf, T2: MallocSizeOf
{
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.0.size_of(ops) + self.1.size_of(ops)
}
}
impl<T1, T2, T3> MallocSizeOf for (T1, T2, T3)
where T1: MallocSizeOf, T2: MallocSizeOf, T3: MallocSizeOf
{
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.0.size_of(ops) + self.1.size_of(ops) + self.2.size_of(ops)
}
}
impl<T1, T2, T3, T4> MallocSizeOf for (T1, T2, T3, T4)
where T1: MallocSizeOf, T2: MallocSizeOf, T3: MallocSizeOf, T4: MallocSizeOf
{
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.0.size_of(ops) + self.1.size_of(ops) + self.2.size_of(ops) + self.3.size_of(ops)
}
}
impl<T: MallocSizeOf> MallocSizeOf for Option<T> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
if let Some(val) = self.as_ref() {
@ -216,6 +286,38 @@ impl<T: MallocSizeOf> MallocSizeOf for Option<T> {
}
}
impl<T: MallocSizeOf, E: MallocSizeOf> MallocSizeOf for Result<T, E> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
match *self {
Ok(ref x) => x.size_of(ops),
Err(ref e) => e.size_of(ops),
}
}
}
impl<T: MallocSizeOf + Copy> MallocSizeOf for std::cell::Cell<T> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.get().size_of(ops)
}
}
impl<T: MallocSizeOf> MallocSizeOf for std::cell::RefCell<T> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.borrow().size_of(ops)
}
}
impl<'a, B: ?Sized + ToOwned> MallocSizeOf for std::borrow::Cow<'a, B>
where B::Owned: MallocSizeOf
{
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
match *self {
std::borrow::Cow::Borrowed(_) => 0,
std::borrow::Cow::Owned(ref b) => b.size_of(ops),
}
}
}
impl<T: MallocSizeOf> MallocSizeOf for [T] {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
let mut n = 0;
@ -242,6 +344,33 @@ impl<T: MallocSizeOf> MallocSizeOf for Vec<T> {
}
}
impl<T> MallocShallowSizeOf for std::collections::VecDeque<T> {
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
if ops.has_malloc_enclosing_size_of() {
if let Some(front) = self.front() {
// The front element is an interior pointer.
unsafe { ops.malloc_enclosing_size_of(&*front) }
} else {
// This assumes that no memory is allocated when the VecDeque is empty.
0
}
} else {
// An estimate.
self.capacity() * size_of::<T>()
}
}
}
impl<T: MallocSizeOf> MallocSizeOf for std::collections::VecDeque<T> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
let mut n = self.shallow_size_of(ops);
for elem in self.iter() {
n += elem.size_of(ops);
}
n
}
}
impl<A: smallvec::Array> MallocShallowSizeOf for smallvec::SmallVec<A> {
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
if self.spilled() {
@ -270,11 +399,16 @@ impl<T, S> MallocShallowSizeOf for std::collections::HashSet<T, S>
S: BuildHasher
{
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
// The first value from the iterator gives us an interior pointer.
// `ops.malloc_enclosing_size_of()` then gives us the storage size.
// This assumes that the `HashSet`'s contents (values and hashes) are
// all stored in a single contiguous heap allocation.
self.iter().next().map_or(0, |t| unsafe { ops.malloc_enclosing_size_of(t) })
if ops.has_malloc_enclosing_size_of() {
// The first value from the iterator gives us an interior pointer.
// `ops.malloc_enclosing_size_of()` then gives us the storage size.
// This assumes that the `HashSet`'s contents (values and hashes)
// are all stored in a single contiguous heap allocation.
self.iter().next().map_or(0, |t| unsafe { ops.malloc_enclosing_size_of(t) })
} else {
// An estimate.
self.capacity() * (size_of::<T>() + size_of::<usize>())
}
}
}
@ -297,7 +431,11 @@ impl<T, S> MallocShallowSizeOf for hashglobe::hash_set::HashSet<T, S>
{
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
// See the implementation for std::collections::HashSet for details.
self.iter().next().map_or(0, |t| unsafe { ops.malloc_enclosing_size_of(t) })
if ops.has_malloc_enclosing_size_of() {
self.iter().next().map_or(0, |t| unsafe { ops.malloc_enclosing_size_of(t) })
} else {
self.capacity() * (size_of::<T>() + size_of::<usize>())
}
}
}
@ -314,13 +452,66 @@ impl<T, S> MallocSizeOf for hashglobe::hash_set::HashSet<T, S>
}
}
impl<T, S> MallocShallowSizeOf for hashglobe::fake::HashSet<T, S>
where T: Eq + Hash,
S: BuildHasher,
{
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
use std::ops::Deref;
self.deref().shallow_size_of(ops)
}
}
impl<T, S> MallocSizeOf for hashglobe::fake::HashSet<T, S>
where T: Eq + Hash + MallocSizeOf,
S: BuildHasher,
{
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
use std::ops::Deref;
self.deref().size_of(ops)
}
}
impl<K, V, S> MallocShallowSizeOf for std::collections::HashMap<K, V, S>
where K: Eq + Hash,
S: BuildHasher
{
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
// See the implementation for std::collections::HashSet for details.
if ops.has_malloc_enclosing_size_of() {
self.values().next().map_or(0, |v| unsafe { ops.malloc_enclosing_size_of(v) })
} else {
self.capacity() * (size_of::<V>() + size_of::<K>() + size_of::<usize>())
}
}
}
impl<K, V, S> MallocSizeOf for std::collections::HashMap<K, V, S>
where K: Eq + Hash + MallocSizeOf,
V: MallocSizeOf,
S: BuildHasher,
{
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
let mut n = self.shallow_size_of(ops);
for (k, v) in self.iter() {
n += k.size_of(ops);
n += v.size_of(ops);
}
n
}
}
impl<K, V, S> MallocShallowSizeOf for hashglobe::hash_map::HashMap<K, V, S>
where K: Eq + Hash,
S: BuildHasher
{
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
// See the implementation for std::collections::HashSet for details.
self.values().next().map_or(0, |v| unsafe { ops.malloc_enclosing_size_of(v) })
if ops.has_malloc_enclosing_size_of() {
self.values().next().map_or(0, |v| unsafe { ops.malloc_enclosing_size_of(v) })
} else {
self.capacity() * (size_of::<V>() + size_of::<K>() + size_of::<usize>())
}
}
}
@ -358,6 +549,34 @@ impl<K, V, S> MallocSizeOf for hashglobe::diagnostic::DiagnosticHashMap<K, V, S>
}
}
impl<K, V, S> MallocShallowSizeOf for hashglobe::fake::HashMap<K, V, S>
where K: Eq + Hash,
S: BuildHasher,
{
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
use std::ops::Deref;
self.deref().shallow_size_of(ops)
}
}
impl<K, V, S> MallocSizeOf for hashglobe::fake::HashMap<K, V, S>
where K: Eq + Hash + MallocSizeOf,
V: MallocSizeOf,
S: BuildHasher,
{
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
use std::ops::Deref;
self.deref().size_of(ops)
}
}
// PhantomData is always 0.
impl<T> MallocSizeOf for std::marker::PhantomData<T> {
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
0
}
}
// XXX: we don't want MallocSizeOf to be defined for Rc and Arc. If negative
// trait bounds are ever allowed, this code should be uncommented.
// (We do have a compile-fail test for this:
@ -407,12 +626,86 @@ impl MallocSizeOf for smallbitvec::SmallBitVec {
}
}
impl<T: MallocSizeOf, Unit> MallocSizeOf for euclid::Length<T, Unit> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.0.size_of(ops)
}
}
impl<T: MallocSizeOf, Src, Dst> MallocSizeOf for euclid::ScaleFactor<T, Src, Dst> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.0.size_of(ops)
}
}
impl<T: MallocSizeOf, U> MallocSizeOf for euclid::TypedPoint2D<T, U> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.x.size_of(ops) + self.y.size_of(ops)
}
}
impl<T: MallocSizeOf, U> MallocSizeOf for euclid::TypedRect<T, U> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.origin.size_of(ops) + self.size.size_of(ops)
}
}
impl<T: MallocSizeOf, U> MallocSizeOf for euclid::TypedSideOffsets2D<T, U> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.top.size_of(ops) + self.right.size_of(ops) +
self.bottom.size_of(ops) + self.left.size_of(ops)
}
}
impl<T: MallocSizeOf, U> MallocSizeOf for euclid::TypedSize2D<T, U> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.width.size_of(ops) + self.height.size_of(ops)
}
}
impl<T: MallocSizeOf, Src, Dst> MallocSizeOf for euclid::TypedTransform2D<T, Src, Dst> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.m11.size_of(ops) + self.m12.size_of(ops) +
self.m21.size_of(ops) + self.m22.size_of(ops) +
self.m31.size_of(ops) + self.m32.size_of(ops)
}
}
impl<T: MallocSizeOf, Src, Dst> MallocSizeOf for euclid::TypedTransform3D<T, Src, Dst> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.m11.size_of(ops) + self.m12.size_of(ops) +
self.m13.size_of(ops) + self.m14.size_of(ops) +
self.m21.size_of(ops) + self.m22.size_of(ops) +
self.m23.size_of(ops) + self.m24.size_of(ops) +
self.m31.size_of(ops) + self.m32.size_of(ops) +
self.m33.size_of(ops) + self.m34.size_of(ops) +
self.m41.size_of(ops) + self.m42.size_of(ops) +
self.m43.size_of(ops) + self.m44.size_of(ops)
}
}
impl<T: MallocSizeOf, U> MallocSizeOf for euclid::TypedVector2D<T, U> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.x.size_of(ops) + self.y.size_of(ops)
}
}
#[cfg(feature = "servo")]
impl<Static: string_cache::StaticAtomSet> MallocSizeOf for string_cache::Atom<Static> {
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
0
}
}
// This is measured properly by the heap measurement implemented in
// SpiderMonkey.
#[cfg(feature = "servo")]
impl<T: Copy + js::rust::GCMethods> MallocSizeOf for js::jsapi::Heap<T> {
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
0
}
}
/// For use on types where size_of() returns 0.
#[macro_export]
macro_rules! malloc_size_of_is_0(
@ -443,9 +736,57 @@ malloc_size_of_is_0!(u8, u16, u32, u64, usize);
malloc_size_of_is_0!(i8, i16, i32, i64, isize);
malloc_size_of_is_0!(f32, f64);
malloc_size_of_is_0!(std::sync::atomic::AtomicBool);
malloc_size_of_is_0!(std::sync::atomic::AtomicIsize, std::sync::atomic::AtomicUsize);
malloc_size_of_is_0!(Range<u8>, Range<u16>, Range<u32>, Range<u64>, Range<usize>);
malloc_size_of_is_0!(Range<i8>, Range<i16>, Range<i32>, Range<i64>, Range<isize>);
malloc_size_of_is_0!(Range<f32>, Range<f64>);
malloc_size_of_is_0!(app_units::Au);
malloc_size_of_is_0!(cssparser::RGBA, cssparser::TokenSerializationType);
#[cfg(feature = "servo")]
impl MallocSizeOf for url::Host {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
match *self {
url::Host::Domain(ref s) => s.size_of(ops),
_ => 0,
}
}
}
#[cfg(feature = "servo")]
malloc_size_of_is_0!(webrender_api::ClipAndScrollInfo);
#[cfg(feature = "servo")]
malloc_size_of_is_0!(webrender_api::ClipId);
#[cfg(feature = "servo")]
malloc_size_of_is_0!(webrender_api::ColorF);
#[cfg(feature = "servo")]
malloc_size_of_is_0!(webrender_api::GradientStop);
#[cfg(feature = "servo")]
malloc_size_of_is_0!(webrender_api::ImageKey);
#[cfg(feature = "servo")]
malloc_size_of_is_0!(webrender_api::LocalClip);
#[cfg(feature = "servo")]
malloc_size_of_is_0!(webrender_api::MixBlendMode);
#[cfg(feature = "servo")]
malloc_size_of_is_0!(webrender_api::RepeatMode);
#[cfg(feature = "servo")]
malloc_size_of_is_0!(webrender_api::ScrollPolicy);
#[cfg(feature = "servo")]
malloc_size_of_is_0!(webrender_api::ScrollSensitivity);
#[cfg(feature = "servo")]
malloc_size_of_is_0!(webrender_api::StickySideConstraint);
#[cfg(feature = "servo")]
malloc_size_of_is_0!(webrender_api::TransformStyle);
#[cfg(feature = "servo")]
impl MallocSizeOf for xml5ever::QualName {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.prefix.size_of(ops) +
self.ns.size_of(ops) +
self.local.size_of(ops)
}
}

View file

@ -14,8 +14,8 @@ unstable = ["nonzero/unstable"]
[dependencies]
bitflags = "0.7"
heapsize = "0.4"
heapsize_derive = "0.1"
malloc_size_of = { path = "../malloc_size_of" }
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
nonzero = {path = "../nonzero"}
serde = "1.0.14"
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}

View file

@ -18,7 +18,7 @@ pub enum KeyState {
}
//N.B. Based on the glutin key enum
#[derive(Clone, Copy, Debug, Deserialize, Eq, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, MallocSizeOf, PartialEq, Serialize)]
pub enum Key {
Space,
Apostrophe,
@ -217,14 +217,14 @@ impl PipelineNamespace {
thread_local!(pub static PIPELINE_NAMESPACE: Cell<Option<PipelineNamespace>> = Cell::new(None));
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, HeapSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
pub struct PipelineNamespaceId(pub u32);
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub struct PipelineIndex(pub NonZero<u32>);
known_heap_size!(0, PipelineIndex);
malloc_size_of_is_0!(PipelineIndex);
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, HeapSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
pub struct PipelineId {
pub namespace_id: PipelineNamespaceId,
pub index: PipelineIndex
@ -276,9 +276,9 @@ impl fmt::Display for PipelineId {
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub struct BrowsingContextIndex(pub NonZero<u32>);
known_heap_size!(0, BrowsingContextIndex);
malloc_size_of_is_0!(BrowsingContextIndex);
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, HeapSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
pub struct BrowsingContextId {
pub namespace_id: PipelineNamespaceId,
pub index: BrowsingContextIndex,
@ -305,7 +305,7 @@ impl fmt::Display for BrowsingContextId {
thread_local!(pub static TOP_LEVEL_BROWSING_CONTEXT_ID: Cell<Option<TopLevelBrowsingContextId>> = Cell::new(None));
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, HeapSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
pub struct TopLevelBrowsingContextId(BrowsingContextId);
impl TopLevelBrowsingContextId {
@ -362,7 +362,7 @@ pub const TEST_BROWSING_CONTEXT_INDEX: BrowsingContextIndex =
pub const TEST_BROWSING_CONTEXT_ID: BrowsingContextId =
BrowsingContextId { namespace_id: TEST_NAMESPACE, index: TEST_BROWSING_CONTEXT_INDEX };
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
pub enum FrameType {
IFrame,
MozBrowserIFrame,

View file

@ -6,8 +6,8 @@
#[macro_use]
extern crate bitflags;
#[macro_use] extern crate heapsize;
#[macro_use] extern crate heapsize_derive;
#[macro_use] extern crate malloc_size_of;
#[macro_use] extern crate malloc_size_of_derive;
extern crate nonzero;
#[macro_use] extern crate serde;
extern crate webrender_api;

View file

@ -38,7 +38,7 @@ servo-websocket = "0.19"
threadpool = "1.0"
time = "0.1.17"
unicase = "1.4.0"
url = {version = "1.2", features = ["heap_size"]}
url = "1.2"
uuid = {version = "0.5", features = ["v4"]}
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}

View file

@ -11,19 +11,19 @@ path = "lib.rs"
[dependencies]
cookie = "0.6"
heapsize = "0.4"
heapsize_derive = "0.1"
hyper = "0.10"
hyper_serde = "0.7"
image = "0.16"
ipc-channel = "0.9"
lazy_static = "0.2"
log = "0.3.5"
malloc_size_of = { path = "../malloc_size_of" }
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
msg = {path = "../msg"}
num-traits = "0.1.32"
serde = "1.0"
servo_config = {path = "../config"}
servo_url = {path = "../url"}
url = {version = "1.2", features = ["heap_size"]}
url = "1.2"
uuid = {version = "0.5", features = ["v4", "serde"]}
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}

View file

@ -7,7 +7,7 @@ use piston_image::{self, DynamicImage, ImageFormat};
use std::fmt;
use webrender_api;
#[derive(Clone, Copy, Debug, Deserialize, Eq, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, MallocSizeOf, PartialEq, Serialize)]
pub enum PixelFormat {
/// Luminance channel only
K8,
@ -19,14 +19,14 @@ pub enum PixelFormat {
BGRA8,
}
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct Image {
pub width: u32,
pub height: u32,
pub format: PixelFormat,
#[ignore_heap_size_of = "Defined in ipc-channel"]
#[ignore_malloc_size_of = "Defined in ipc-channel"]
pub bytes: IpcSharedMemory,
#[ignore_heap_size_of = "Defined in webrender_api"]
#[ignore_malloc_size_of = "Defined in webrender_api"]
pub id: Option<webrender_api::ImageKey>,
}
@ -37,7 +37,7 @@ impl fmt::Debug for Image {
}
}
#[derive(Clone, Debug, Deserialize, Eq, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Debug, Deserialize, Eq, MallocSizeOf, PartialEq, Serialize)]
pub struct ImageMetadata {
pub width: u32,
pub height: u32,

View file

@ -23,9 +23,9 @@ pub enum CanRequestImages {
}
/// Indicating either entire image or just metadata availability
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub enum ImageOrMetadataAvailable {
ImageAvailable(Arc<Image>, ServoUrl),
ImageAvailable(#[ignore_malloc_size_of = "Arc"] Arc<Image>, ServoUrl),
MetadataAvailable(ImageMetadata),
}
@ -60,14 +60,14 @@ impl ImageResponder {
}
/// The returned image.
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub enum ImageResponse {
/// The requested image was loaded.
Loaded(Arc<Image>, ServoUrl),
Loaded(#[ignore_malloc_size_of = "Arc"] Arc<Image>, ServoUrl),
/// The request image metadata was loaded.
MetadataLoaded(ImageMetadata),
/// The requested image failed to load, so a placeholder was loaded instead.
PlaceholderLoaded(Arc<Image>, ServoUrl),
PlaceholderLoaded(#[ignore_malloc_size_of = "Arc"] Arc<Image>, ServoUrl),
/// Neither the requested image nor the placeholder could be loaded.
None,
}
@ -81,7 +81,7 @@ pub enum ImageState {
}
/// The unique id for an image that has previously been requested.
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
pub struct PendingImageId(pub u64);
#[derive(Debug, Deserialize, Serialize)]

View file

@ -6,14 +6,14 @@
#![deny(unsafe_code)]
extern crate cookie as cookie_rs;
extern crate heapsize;
#[macro_use] extern crate heapsize_derive;
extern crate hyper;
extern crate hyper_serde;
extern crate image as piston_image;
extern crate ipc_channel;
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate log;
#[macro_use] extern crate malloc_size_of;
#[macro_use] extern crate malloc_size_of_derive;
extern crate msg;
extern crate num_traits;
#[macro_use] extern crate serde;
@ -25,7 +25,6 @@ extern crate webrender_api;
use cookie_rs::Cookie;
use filemanager_thread::FileManagerThreadMsg;
use heapsize::HeapSizeOf;
use hyper::Error as HyperError;
use hyper::header::{ContentType, Headers, ReferrerPolicy as ReferrerPolicyHeader};
use hyper::http::RawStatus;
@ -60,7 +59,7 @@ pub mod image {
/// A loading context, for context-specific sniffing, as defined in
/// <https://mimesniff.spec.whatwg.org/#context-specific-sniffing>
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub enum LoadContext {
Browsing,
Image,
@ -73,13 +72,13 @@ pub enum LoadContext {
CacheManifest,
}
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub struct CustomResponse {
#[ignore_heap_size_of = "Defined in hyper"]
#[ignore_malloc_size_of = "Defined in hyper"]
#[serde(deserialize_with = "::hyper_serde::deserialize",
serialize_with = "::hyper_serde::serialize")]
pub headers: Headers,
#[ignore_heap_size_of = "Defined in hyper"]
#[ignore_malloc_size_of = "Defined in hyper"]
#[serde(deserialize_with = "::hyper_serde::deserialize",
serialize_with = "::hyper_serde::serialize")]
pub raw_status: RawStatus,
@ -104,7 +103,7 @@ pub struct CustomResponseMediator {
/// [Policies](https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-states)
/// for providing a referrer header for a request
#[derive(Clone, Copy, Debug, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, Serialize)]
pub enum ReferrerPolicy {
/// "no-referrer"
NoReferrer,
@ -310,11 +309,7 @@ impl IpcSend<StorageThreadMsg> for ResourceThreads {
}
// Ignore the sub-fields
impl HeapSizeOf for ResourceThreads {
fn heap_size_of_children(&self) -> usize {
0
}
}
malloc_size_of_is_0!(ResourceThreads);
#[derive(Clone, Copy, Deserialize, PartialEq, Serialize)]
pub enum IncludeSubdomains {
@ -322,7 +317,7 @@ pub enum IncludeSubdomains {
NotIncluded,
}
#[derive(Deserialize, HeapSizeOf, Serialize)]
#[derive(Deserialize, MallocSizeOf, Serialize)]
pub enum MessageData {
Text(String),
Binary(Vec<u8>),
@ -395,7 +390,7 @@ pub fn fetch_async<F>(request: RequestInit, core_resource_thread: &CoreResourceT
core_resource_thread.send(CoreResourceMsg::Fetch(request, action_sender)).unwrap();
}
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct ResourceCorsData {
/// CORS Preflight flag
pub preflight: bool,
@ -404,7 +399,7 @@ pub struct ResourceCorsData {
}
/// Metadata about a loaded resource, such as is obtained from HTTP headers.
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct Metadata {
/// Final URL after redirects.
pub final_url: ServoUrl,
@ -412,14 +407,14 @@ pub struct Metadata {
/// Location URL from the response headers.
pub location_url: Option<Result<ServoUrl, String>>,
#[ignore_heap_size_of = "Defined in hyper"]
#[ignore_malloc_size_of = "Defined in hyper"]
/// MIME type / subtype.
pub content_type: Option<Serde<ContentType>>,
/// Character set.
pub charset: Option<String>,
#[ignore_heap_size_of = "Defined in hyper"]
#[ignore_malloc_size_of = "Defined in hyper"]
/// Headers
pub headers: Option<Serde<Headers>>,
@ -509,11 +504,11 @@ pub fn load_whole_resource(request: RequestInit,
}
/// An unique identifier to keep track of each load message in the resource handler
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
pub struct ResourceId(pub u32);
/// Network errors that have to be exported out of the loaders
#[derive(Clone, Debug, Deserialize, Eq, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Debug, Deserialize, Eq, MallocSizeOf, PartialEq, Serialize)]
pub enum NetworkError {
/// Could be any of the internal errors, like unsupported scheme, connection errors, etc.
Internal(String),

View file

@ -10,7 +10,7 @@ use servo_url::{ImmutableOrigin, ServoUrl};
use std::default::Default;
/// An [initiator](https://fetch.spec.whatwg.org/#concept-request-initiator)
#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
pub enum Initiator {
None,
Download,
@ -20,7 +20,7 @@ pub enum Initiator {
}
/// A request [type](https://fetch.spec.whatwg.org/#concept-request-type)
#[derive(Clone, Copy, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum Type {
None,
Audio,
@ -33,7 +33,7 @@ pub enum Type {
}
/// A request [destination](https://fetch.spec.whatwg.org/#concept-request-destination)
#[derive(Clone, Copy, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum Destination {
None,
Document,
@ -53,14 +53,14 @@ pub enum Destination {
}
/// A request [origin](https://fetch.spec.whatwg.org/#concept-request-origin)
#[derive(Clone, Debug, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum Origin {
Client,
Origin(ImmutableOrigin),
}
/// A [referer](https://fetch.spec.whatwg.org/#concept-request-referrer)
#[derive(Clone, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum Referrer {
NoReferrer,
/// Default referrer if nothing is specified
@ -69,7 +69,7 @@ pub enum Referrer {
}
/// A [request mode](https://fetch.spec.whatwg.org/#concept-request-mode)
#[derive(Clone, Copy, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum RequestMode {
Navigate,
SameOrigin,
@ -79,7 +79,7 @@ pub enum RequestMode {
}
/// Request [credentials mode](https://fetch.spec.whatwg.org/#concept-request-credentials-mode)
#[derive(Clone, Copy, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum CredentialsMode {
Omit,
CredentialsSameOrigin,
@ -87,7 +87,7 @@ pub enum CredentialsMode {
}
/// [Cache mode](https://fetch.spec.whatwg.org/#concept-request-cache-mode)
#[derive(Clone, Copy, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum CacheMode {
Default,
NoStore,
@ -98,7 +98,7 @@ pub enum CacheMode {
}
/// [Service-workers mode](https://fetch.spec.whatwg.org/#request-service-workers-mode)
#[derive(Clone, Copy, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum ServiceWorkersMode {
All,
Foreign,
@ -106,7 +106,7 @@ pub enum ServiceWorkersMode {
}
/// [Redirect mode](https://fetch.spec.whatwg.org/#concept-request-redirect-mode)
#[derive(Clone, Copy, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum RedirectMode {
Follow,
Error,
@ -114,7 +114,7 @@ pub enum RedirectMode {
}
/// [Response tainting](https://fetch.spec.whatwg.org/#concept-request-response-tainting)
#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
pub enum ResponseTainting {
Basic,
CorsTainting,
@ -122,7 +122,7 @@ pub enum ResponseTainting {
}
/// [Window](https://fetch.spec.whatwg.org/#concept-request-window)
#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
pub enum Window {
NoWindow,
Client, // TODO: Environmental settings object
@ -135,16 +135,16 @@ pub enum CorsSettings {
UseCredentials,
}
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct RequestInit {
#[serde(deserialize_with = "::hyper_serde::deserialize",
serialize_with = "::hyper_serde::serialize")]
#[ignore_heap_size_of = "Defined in hyper"]
#[ignore_malloc_size_of = "Defined in hyper"]
pub method: Method,
pub url: ServoUrl,
#[serde(deserialize_with = "::hyper_serde::deserialize",
serialize_with = "::hyper_serde::serialize")]
#[ignore_heap_size_of = "Defined in hyper"]
#[ignore_malloc_size_of = "Defined in hyper"]
pub headers: Headers,
pub unsafe_request: bool,
pub body: Option<Vec<u8>>,
@ -199,17 +199,17 @@ impl Default for RequestInit {
/// A [Request](https://fetch.spec.whatwg.org/#concept-request) as defined by
/// the Fetch spec.
#[derive(Clone, HeapSizeOf)]
#[derive(Clone, MallocSizeOf)]
pub struct Request {
/// <https://fetch.spec.whatwg.org/#concept-request-method>
#[ignore_heap_size_of = "Defined in hyper"]
#[ignore_malloc_size_of = "Defined in hyper"]
pub method: Method,
/// <https://fetch.spec.whatwg.org/#local-urls-only-flag>
pub local_urls_only: bool,
/// <https://fetch.spec.whatwg.org/#sandboxed-storage-area-urls-flag>
pub sandboxed_storage_area_urls: bool,
/// <https://fetch.spec.whatwg.org/#concept-request-header-list>
#[ignore_heap_size_of = "Defined in hyper"]
#[ignore_malloc_size_of = "Defined in hyper"]
pub headers: Headers,
/// <https://fetch.spec.whatwg.org/#unsafe-request-flag>
pub unsafe_request: bool,

View file

@ -13,7 +13,7 @@ use std::ascii::AsciiExt;
use std::sync::{Arc, Mutex};
/// [Response type](https://fetch.spec.whatwg.org/#concept-response-type)
#[derive(Clone, Debug, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum ResponseType {
Basic,
Cors,
@ -24,7 +24,7 @@ pub enum ResponseType {
}
/// [Response termination reason](https://fetch.spec.whatwg.org/#concept-response-termination-reason)
#[derive(Clone, Copy, Debug, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, Serialize)]
pub enum TerminationReason {
EndUserAbort,
Fatal,
@ -33,7 +33,7 @@ pub enum TerminationReason {
/// The response body can still be pushed to after fetch
/// This provides a way to store unfinished response bodies
#[derive(Clone, Debug, HeapSizeOf, PartialEq)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub enum ResponseBody {
Empty, // XXXManishearth is this necessary, or is Done(vec![]) enough?
Receiving(Vec<u8>),
@ -52,7 +52,7 @@ impl ResponseBody {
/// [Cache state](https://fetch.spec.whatwg.org/#concept-response-cache-state)
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub enum CacheState {
None,
Local,
@ -61,7 +61,7 @@ pub enum CacheState {
}
/// [Https state](https://fetch.spec.whatwg.org/#concept-response-https-state)
#[derive(Clone, Copy, Debug, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, Serialize)]
pub enum HttpsState {
None,
Deprecated,
@ -74,31 +74,31 @@ pub enum ResponseMsg {
Errored,
}
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
pub struct ResponseInit {
pub url: ServoUrl,
#[serde(deserialize_with = "::hyper_serde::deserialize",
serialize_with = "::hyper_serde::serialize")]
#[ignore_heap_size_of = "Defined in hyper"]
#[ignore_malloc_size_of = "Defined in hyper"]
pub headers: Headers,
pub referrer: Option<ServoUrl>,
pub location_url: Option<Result<ServoUrl, String>>,
}
/// A [Response](https://fetch.spec.whatwg.org/#concept-response) as defined by the Fetch spec
#[derive(Clone, Debug, HeapSizeOf)]
#[derive(Clone, Debug, MallocSizeOf)]
pub struct Response {
pub response_type: ResponseType,
pub termination_reason: Option<TerminationReason>,
url: Option<ServoUrl>,
pub url_list: Vec<ServoUrl>,
/// `None` can be considered a StatusCode of `0`.
#[ignore_heap_size_of = "Defined in hyper"]
#[ignore_malloc_size_of = "Defined in hyper"]
pub status: Option<StatusCode>,
pub raw_status: Option<(u16, Vec<u8>)>,
#[ignore_heap_size_of = "Defined in hyper"]
#[ignore_malloc_size_of = "Defined in hyper"]
pub headers: Headers,
#[ignore_heap_size_of = "Mutex heap size undefined"]
#[ignore_malloc_size_of = "Mutex heap size undefined"]
pub body: Arc<Mutex<ResponseBody>>,
pub cache_state: CacheState,
pub https_state: HttpsState,

View file

@ -5,7 +5,7 @@
use ipc_channel::ipc::IpcSender;
use servo_url::ServoUrl;
#[derive(Clone, Copy, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Copy, Deserialize, MallocSizeOf, Serialize)]
pub enum StorageType {
Session,
Local,

View file

@ -79,7 +79,7 @@ impl ProfilerChan {
#[derive(Deserialize, Serialize)]
pub enum ReportKind {
/// A size measurement for an explicit allocation on the jemalloc heap. This should be used
/// for any measurements done via the `HeapSizeOf` trait.
/// for any measurements done via the `MallocSizeOf` trait.
ExplicitJemallocHeapSize,
/// A size measurement for an explicit allocation on the system heap. Only likely to be used

View file

@ -11,7 +11,7 @@ name = "range"
path = "lib.rs"
[dependencies]
heapsize = "0.4"
heapsize_derive = "0.1"
malloc_size_of = { path = "../malloc_size_of" }
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
num-traits = "0.1.32"
serde = "1.0"

View file

@ -4,8 +4,8 @@
#![deny(unsafe_code)]
extern crate heapsize;
#[macro_use] extern crate heapsize_derive;
extern crate malloc_size_of;
#[macro_use] extern crate malloc_size_of_derive;
extern crate num_traits;
#[macro_use] extern crate serde;
@ -146,7 +146,7 @@ macro_rules! int_range_index {
}
/// A range of indices
#[derive(Clone, Copy, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Copy, Deserialize, MallocSizeOf, Serialize)]
pub struct Range<I> {
begin: I,
length: I,

View file

@ -44,9 +44,7 @@ euclid = "0.15"
fnv = "1.0"
gleam = "0.4"
half = "1.0"
heapsize = "0.4"
heapsize_derive = "0.1"
html5ever = {version = "0.20", features = ["heap_size"]}
html5ever = "0.20"
hyper = "0.10"
hyper_serde = "0.7"
image = "0.16"
@ -56,6 +54,8 @@ jstraceable_derive = {path = "../jstraceable_derive"}
lazy_static = "0.2"
libc = "0.2"
log = "0.3.5"
malloc_size_of = { path = "../malloc_size_of" }
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
metrics = {path = "../metrics"}
mitochondria = "1.1.2"
mime = "0.2.1"
@ -89,7 +89,7 @@ style_traits = {path = "../style_traits"}
swapper = "0.1"
time = "0.1.12"
unicode-segmentation = "1.1.0"
url = {version = "1.2", features = ["heap_size", "query_encoding"]}
url = {version = "1.2", features = ["query_encoding"]}
utf-8 = "0.7"
uuid = {version = "0.5", features = ["v4"]}
xml5ever = {version = "0.10"}

View file

@ -22,7 +22,7 @@ use std::rc::Rc;
use std::str;
use url::form_urlencoded;
#[derive(Clone, Copy, HeapSizeOf, JSTraceable)]
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
pub enum BodyType {
Blob,
FormData,

View file

@ -14,7 +14,7 @@ use net_traits::request::RequestInit;
use servo_url::ServoUrl;
use std::thread;
#[derive(Clone, Debug, HeapSizeOf, JSTraceable, PartialEq)]
#[derive(Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum LoadType {
Image(ServoUrl),
Script(ServoUrl),
@ -40,7 +40,7 @@ impl LoadType {
/// Canary value ensuring that manually added blocking loads (ie. ones that weren't
/// created via DocumentLoader::fetch_async) are always removed by the time
/// that the owner is destroyed.
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
pub struct LoadBlocker {
/// The document whose load event is blocked by this object existing.
@ -81,7 +81,7 @@ impl Drop for LoadBlocker {
}
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
pub struct DocumentLoader {
resource_threads: ResourceThreads,
blocking_loads: Vec<LoadType>,

View file

@ -11,7 +11,7 @@ use style::thread_state;
///
/// This extends the API of `std::cell::RefCell` to allow unsafe access in
/// certain situations, with dynamic checking in debug builds.
#[derive(Clone, Debug, Default, HeapSizeOf, PartialEq)]
#[derive(Clone, Debug, Default, MallocSizeOf, PartialEq)]
pub struct DomRefCell<T> {
value: RefCell<T>,
}

View file

@ -2029,7 +2029,7 @@ def DOMClass(descriptor):
# padding.
protoList.extend(['PrototypeList::ID::Last'] * (descriptor.config.maxProtoChainLength - len(protoList)))
prototypeChainString = ', '.join(protoList)
heapSizeOf = 'heap_size_of_raw_self_and_children::<%s>' % descriptor.concreteType
mallocSizeOf = 'malloc_size_of_including_raw_self::<%s>' % descriptor.concreteType
if descriptor.isGlobal():
globals_ = camel_to_upper_snake(descriptor.name)
else:
@ -2038,9 +2038,9 @@ def DOMClass(descriptor):
DOMClass {
interface_chain: [ %s ],
type_id: %s,
heap_size_of: %s as unsafe fn(_) -> _,
malloc_size_of: %s as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::%s,
}""" % (prototypeChainString, DOMClassTypeId(descriptor), heapSizeOf, globals_)
}""" % (prototypeChainString, DOMClassTypeId(descriptor), mallocSizeOf, globals_)
class CGDOMJSClass(CGThing):
@ -4005,7 +4005,7 @@ class CGEnum(CGThing):
ident = enum.identifier.name
decl = """\
#[repr(usize)]
#[derive(JSTraceable, PartialEq, Copy, Clone, HeapSizeOf, Debug)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum %s {
%s
}
@ -5794,7 +5794,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
'dom::bindings::weakref::WeakReferenceable',
'dom::windowproxy::WindowProxy',
'dom::globalscope::GlobalScope',
'mem::heap_size_of_raw_self_and_children',
'mem::malloc_size_of_including_raw_self',
'libc',
'servo_config::prefs::PREFS',
'std::borrow::ToOwned',

View file

@ -25,7 +25,7 @@ use libc::c_uint;
use std::slice::from_raw_parts;
/// DOM exceptions that can be thrown by a native DOM method.
#[derive(Clone, Debug, HeapSizeOf)]
#[derive(Clone, Debug, MallocSizeOf)]
pub enum Error {
/// IndexSizeError DOMException
IndexSize,

View file

@ -22,7 +22,7 @@ use std::cell::Cell;
use std::ptr;
/// The values that an iterator will iterate over.
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
pub enum IteratorType {
/// The keys of the iterable object.
Keys,

View file

@ -4,7 +4,7 @@
//! The `Finite<T>` struct.
use heapsize::HeapSizeOf;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use num_traits::Float;
use std::default::Default;
use std::ops::Deref;
@ -41,9 +41,9 @@ impl<T: Float> Deref for Finite<T> {
}
}
impl<T: Float + HeapSizeOf> HeapSizeOf for Finite<T> {
fn heap_size_of_children(&self) -> usize {
(**self).heap_size_of_children()
impl<T: Float + MallocSizeOf> MallocSizeOf for Finite<T> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
(**self).size_of(ops)
}
}

View file

@ -27,11 +27,11 @@ pub fn reflect_dom_object<T, U>(
/// A struct to store a reference to the reflector of a DOM object.
#[allow(unrooted_must_root)]
#[derive(HeapSizeOf)]
#[derive(MallocSizeOf)]
#[must_root]
// If you're renaming or moving this field, update the path in plugins::reflector as well
pub struct Reflector {
#[ignore_heap_size_of = "defined and measured in rust-mozjs"]
#[ignore_malloc_size_of = "defined and measured in rust-mozjs"]
object: Heap<*mut JSObject>,
}

View file

@ -30,9 +30,9 @@ use dom::bindings::reflector::{DomObject, Reflector};
use dom::bindings::trace::JSTraceable;
use dom::bindings::trace::trace_reflector;
use dom::node::Node;
use heapsize::HeapSizeOf;
use js::jsapi::{JSObject, JSTracer, Heap};
use js::rust::GCMethods;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use mitochondria::OnceCell;
use nonzero::NonZero;
use script_layout_interface::TrustedNodeAddress;
@ -157,12 +157,12 @@ impl<T: DomObject> DomRoot<T> {
}
}
impl<T> HeapSizeOf for DomRoot<T>
impl<T> MallocSizeOf for DomRoot<T>
where
T: DomObject + HeapSizeOf,
T: DomObject + MallocSizeOf,
{
fn heap_size_of_children(&self) -> usize {
(**self).heap_size_of_children()
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
(**self).size_of(ops)
}
}
@ -317,8 +317,8 @@ pub struct Dom<T> {
// Dom<T> is similar to Rc<T>, in that it's not always clear how to avoid double-counting.
// For now, we choose not to follow any such pointers.
impl<T> HeapSizeOf for Dom<T> {
fn heap_size_of_children(&self) -> usize {
impl<T> MallocSizeOf for Dom<T> {
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
0
}
}
@ -516,9 +516,9 @@ impl<T: DomObject> MutDom<T> {
}
}
impl<T: DomObject> HeapSizeOf for MutDom<T> {
fn heap_size_of_children(&self) -> usize {
// See comment on HeapSizeOf for Dom<T>.
impl<T: DomObject> MallocSizeOf for MutDom<T> {
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
// See comment on MallocSizeOf for Dom<T>.
0
}
}
@ -635,9 +635,9 @@ impl<T: DomObject> Default for MutNullableDom<T> {
}
}
impl<T: DomObject> HeapSizeOf for MutNullableDom<T> {
fn heap_size_of_children(&self) -> usize {
// See comment on HeapSizeOf for Dom<T>.
impl<T: DomObject> MallocSizeOf for MutNullableDom<T> {
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
// See comment on MallocSizeOf for Dom<T>.
0
}
}
@ -678,9 +678,9 @@ impl<T: DomObject> Default for DomOnceCell<T> {
}
}
impl<T: DomObject> HeapSizeOf for DomOnceCell<T> {
fn heap_size_of_children(&self) -> usize {
// See comment on HeapSizeOf for Dom<T>.
impl<T: DomObject> MallocSizeOf for DomOnceCell<T> {
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
// See comment on MallocSizeOf for Dom<T>.
0
}
}

View file

@ -19,7 +19,7 @@ use std::str;
use std::str::{Bytes, FromStr};
/// Encapsulates the IDL `ByteString` type.
#[derive(Clone, Debug, Default, Eq, HeapSizeOf, JSTraceable, PartialEq)]
#[derive(Clone, Debug, Default, Eq, JSTraceable, MallocSizeOf, PartialEq)]
pub struct ByteString(Vec<u8>);
impl ByteString {
@ -78,7 +78,7 @@ impl ops::Deref for ByteString {
/// A string that is constructed from a UCS-2 buffer by replacing invalid code
/// points with the replacement character.
#[derive(Clone, Default, HeapSizeOf)]
#[derive(Clone, Default, MallocSizeOf)]
pub struct USVString(pub String);
@ -153,7 +153,7 @@ pub fn is_token(s: &[u8]) -> bool {
///
/// This type is currently `!Send`, in order to help with an independent
/// experiment to store `JSString`s rather than Rust `String`s.
#[derive(Clone, Debug, Eq, Hash, HeapSizeOf, Ord, PartialEq, PartialOrd)]
#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd)]
pub struct DOMString(String, PhantomData<*const ()>);
impl DOMString {

View file

@ -13,7 +13,6 @@ use dom::bindings::inheritance::TopTypeId;
use dom::bindings::str::DOMString;
use dom::bindings::trace::trace_object;
use dom::windowproxy;
use heapsize::HeapSizeOf;
use js;
use js::JS_CALLEE;
use js::glue::{CallJitGetterOp, CallJitMethodOp, CallJitSetterOp, IsWrapper};
@ -32,6 +31,7 @@ use js::jsapi::{JS_StringHasLatin1Chars, MutableHandleValue, ObjectOpResult};
use js::jsval::{JSVal, UndefinedValue};
use js::rust::{GCMethods, ToString, get_object_class, is_dom_class};
use libc;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use std::ffi::CString;
use std::os::raw::{c_char, c_void};
use std::ptr;
@ -40,14 +40,14 @@ use std::slice;
/// Proxy handler for a WindowProxy.
pub struct WindowProxyHandler(pub *const libc::c_void);
impl HeapSizeOf for WindowProxyHandler {
fn heap_size_of_children(&self) -> usize {
impl MallocSizeOf for WindowProxyHandler {
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
// FIXME(#6907) this is a pointer to memory allocated by `new` in NewProxyHandler in rust-mozjs.
0
}
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
/// Static data associated with a global object.
pub struct GlobalStaticData {
/// The WindowProxy proxy handler for this global.
@ -88,8 +88,8 @@ pub struct DOMClass {
/// The type ID of that interface.
pub type_id: TopTypeId,
/// The HeapSizeOf function wrapper for that interface.
pub heap_size_of: unsafe fn(*const c_void) -> usize,
/// The MallocSizeOf function wrapper for that interface.
pub malloc_size_of: unsafe fn(ops: &mut MallocSizeOfOps, *const c_void) -> usize,
/// The `Globals` flag for this global interface, if any.
pub global: InterfaceObjectMap::Globals,

View file

@ -14,10 +14,10 @@
use dom::bindings::reflector::DomObject;
use dom::bindings::root::DomRoot;
use dom::bindings::trace::JSTraceable;
use heapsize::HeapSizeOf;
use js::jsapi::{JSTracer, JS_GetReservedSlot, JS_SetReservedSlot};
use js::jsval::PrivateValue;
use libc::c_void;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use nonzero::NonZero;
use std::cell::{Cell, UnsafeCell};
use std::mem;
@ -110,8 +110,8 @@ impl<T: WeakReferenceable> Clone for WeakRef<T> {
}
}
impl<T: WeakReferenceable> HeapSizeOf for WeakRef<T> {
fn heap_size_of_children(&self) -> usize {
impl<T: WeakReferenceable> MallocSizeOf for WeakRef<T> {
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
0
}
}
@ -188,8 +188,8 @@ impl<T: WeakReferenceable> MutableWeakRef<T> {
}
}
impl<T: WeakReferenceable> HeapSizeOf for MutableWeakRef<T> {
fn heap_size_of_children(&self) -> usize {
impl<T: WeakReferenceable> MallocSizeOf for MutableWeakRef<T> {
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
0
}
}
@ -210,7 +210,7 @@ unsafe impl<T: WeakReferenceable> JSTraceable for MutableWeakRef<T> {
/// A vector of weak references. On tracing, the vector retains
/// only references which still point to live objects.
#[allow_unrooted_interior]
#[derive(HeapSizeOf)]
#[derive(MallocSizeOf)]
pub struct WeakRefVec<T: WeakReferenceable> {
vec: Vec<WeakRef<T>>,
}

View file

@ -69,7 +69,7 @@ impl BlobImpl {
#[dom_struct]
pub struct Blob {
reflector_: Reflector,
#[ignore_heap_size_of = "No clear owner"]
#[ignore_malloc_size_of = "No clear owner"]
blob_impl: DomRefCell<BlobImpl>,
/// content-type string
type_string: String,

View file

@ -56,13 +56,13 @@ const OPTIONS_ERROR: &'static str = "Fields of 'options' conflict with each othe
Either 'acceptAllDevices' member must be true, or 'filters' member must be set to a value.";
const BT_DESC_CONVERSION_ERROR: &'static str = "Can't convert to an IDL value of type BluetoothPermissionDescriptor";
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
pub struct AllowedBluetoothDevice {
pub deviceId: DOMString,
pub mayUseGATT: bool,
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
pub struct BluetoothExtraPermissionData {
allowed_devices: DomRefCell<Vec<AllowedBluetoothDevice>>,
}

View file

@ -24,7 +24,7 @@ pub struct CanvasGradient {
stops: DomRefCell<Vec<CanvasGradientStop>>,
}
#[derive(Clone, HeapSizeOf, JSTraceable)]
#[derive(Clone, JSTraceable, MallocSizeOf)]
pub enum CanvasGradientStyle {
Linear(LinearGradientStyle),
Radial(RadialGradientStyle),

View file

@ -51,7 +51,7 @@ use std::sync::Arc;
use unpremultiplytable::UNPREMULTIPLY_TABLE;
#[must_root]
#[derive(Clone, HeapSizeOf, JSTraceable)]
#[derive(Clone, JSTraceable, MallocSizeOf)]
#[allow(dead_code)]
enum CanvasFillOrStrokeStyle {
Color(RGBA),
@ -63,12 +63,12 @@ enum CanvasFillOrStrokeStyle {
#[dom_struct]
pub struct CanvasRenderingContext2D {
reflector_: Reflector,
#[ignore_heap_size_of = "Defined in ipc-channel"]
#[ignore_malloc_size_of = "Defined in ipc-channel"]
ipc_renderer: IpcSender<CanvasMsg>,
/// For rendering contexts created by an HTML canvas element, this is Some,
/// for ones created by a paint worklet, this is None.
canvas: Option<Dom<HTMLCanvasElement>>,
#[ignore_heap_size_of = "Arc"]
#[ignore_malloc_size_of = "Arc"]
image_cache: Arc<ImageCache>,
/// Any missing image URLs.
missing_image_urls: DomRefCell<Vec<ServoUrl>>,
@ -81,7 +81,7 @@ pub struct CanvasRenderingContext2D {
}
#[must_root]
#[derive(Clone, HeapSizeOf, JSTraceable)]
#[derive(Clone, JSTraceable, MallocSizeOf)]
struct CanvasContextState {
global_alpha: f64,
global_composition: CompositionOrBlending,

View file

@ -20,7 +20,7 @@ pub struct Client {
active_worker: MutNullableDom<ServiceWorker>,
url: ServoUrl,
frame_type: FrameType,
#[ignore_heap_size_of = "Defined in uuid"]
#[ignore_malloc_size_of = "Defined in uuid"]
id: Uuid
}

View file

@ -21,7 +21,7 @@ unsafe_no_jsmanaged_fields!(ServoRng);
#[dom_struct]
pub struct Crypto {
reflector_: Reflector,
#[ignore_heap_size_of = "Defined in rand"]
#[ignore_malloc_size_of = "Defined in rand"]
rng: DomRefCell<ServoRng>,
}

View file

@ -17,7 +17,7 @@ use style::stylesheets::FontFaceRule;
#[dom_struct]
pub struct CSSFontFaceRule {
cssrule: CSSRule,
#[ignore_heap_size_of = "Arc"]
#[ignore_malloc_size_of = "Arc"]
fontfacerule: Arc<Locked<FontFaceRule>>,
}

View file

@ -19,7 +19,7 @@ use style::stylesheets::CssRules as StyleCssRules;
#[dom_struct]
pub struct CSSGroupingRule {
cssrule: CSSRule,
#[ignore_heap_size_of = "Arc"]
#[ignore_malloc_size_of = "Arc"]
rules: Arc<Locked<StyleCssRules>>,
rulelist: MutNullableDom<CSSRuleList>,
}

View file

@ -17,7 +17,7 @@ use style::stylesheets::ImportRule;
#[dom_struct]
pub struct CSSImportRule {
cssrule: CSSRule,
#[ignore_heap_size_of = "Arc"]
#[ignore_malloc_size_of = "Arc"]
import_rule: Arc<Locked<ImportRule>>,
}

View file

@ -19,7 +19,7 @@ use style::stylesheets::keyframes_rule::Keyframe;
#[dom_struct]
pub struct CSSKeyframeRule {
cssrule: CSSRule,
#[ignore_heap_size_of = "Arc"]
#[ignore_malloc_size_of = "Arc"]
keyframerule: Arc<Locked<Keyframe>>,
style_decl: MutNullableDom<CSSStyleDeclaration>,
}

View file

@ -24,7 +24,7 @@ use style::values::KeyframesName;
#[dom_struct]
pub struct CSSKeyframesRule {
cssrule: CSSRule,
#[ignore_heap_size_of = "Arc"]
#[ignore_malloc_size_of = "Arc"]
keyframesrule: Arc<Locked<KeyframesRule>>,
rulelist: MutNullableDom<CSSRuleList>,
}

View file

@ -25,7 +25,7 @@ use style_traits::{PARSING_MODE_DEFAULT, ToCss};
#[dom_struct]
pub struct CSSMediaRule {
cssconditionrule: CSSConditionRule,
#[ignore_heap_size_of = "Arc"]
#[ignore_malloc_size_of = "Arc"]
mediarule: Arc<Locked<MediaRule>>,
medialist: MutNullableDom<MediaList>,
}

View file

@ -18,7 +18,7 @@ use style::stylesheets::NamespaceRule;
#[dom_struct]
pub struct CSSNamespaceRule {
cssrule: CSSRule,
#[ignore_heap_size_of = "Arc"]
#[ignore_malloc_size_of = "Arc"]
namespacerule: Arc<Locked<NamespaceRule>>,
}

View file

@ -37,7 +37,7 @@ impl From<RulesMutateError> for Error {
pub struct CSSRuleList {
reflector_: Reflector,
parent_stylesheet: Dom<CSSStyleSheet>,
#[ignore_heap_size_of = "Arc"]
#[ignore_malloc_size_of = "Arc"]
rules: RulesSource,
dom_rules: DomRefCell<Vec<MutNullableDom<CSSRule>>>
}

View file

@ -33,12 +33,12 @@ pub struct CSSStyleDeclaration {
pseudo: Option<PseudoElement>,
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
pub enum CSSStyleOwner {
Element(Dom<Element>),
CSSRule(Dom<CSSRule>,
#[ignore_heap_size_of = "Arc"]
#[ignore_malloc_size_of = "Arc"]
Arc<Locked<PropertyDeclarationBlock>>),
}
@ -154,7 +154,7 @@ impl CSSStyleOwner {
}
}
#[derive(HeapSizeOf, PartialEq)]
#[derive(MallocSizeOf, PartialEq)]
pub enum CSSModificationAccess {
ReadWrite,
Readonly,

View file

@ -25,7 +25,7 @@ use style::stylesheets::{StyleRule, Origin};
#[dom_struct]
pub struct CSSStyleRule {
cssrule: CSSRule,
#[ignore_heap_size_of = "Arc"]
#[ignore_malloc_size_of = "Arc"]
stylerule: Arc<Locked<StyleRule>>,
style_decl: MutNullableDom<CSSStyleDeclaration>,
}

View file

@ -24,7 +24,7 @@ pub struct CSSStyleSheet {
stylesheet: StyleSheet,
owner: Dom<Element>,
rulelist: MutNullableDom<CSSRuleList>,
#[ignore_heap_size_of = "Arc"]
#[ignore_malloc_size_of = "Arc"]
style_stylesheet: Arc<StyleStyleSheet>,
origin_clean: Cell<bool>,
}

View file

@ -23,7 +23,7 @@ use style_traits::{PARSING_MODE_DEFAULT, ToCss};
#[dom_struct]
pub struct CSSSupportsRule {
cssconditionrule: CSSConditionRule,
#[ignore_heap_size_of = "Arc"]
#[ignore_malloc_size_of = "Arc"]
supportsrule: Arc<Locked<SupportsRule>>,
}

View file

@ -17,7 +17,7 @@ use style::stylesheets::ViewportRule;
#[dom_struct]
pub struct CSSViewportRule {
cssrule: CSSRule,
#[ignore_heap_size_of = "Arc"]
#[ignore_malloc_size_of = "Arc"]
viewportrule: Arc<Locked<ViewportRule>>,
}

View file

@ -47,12 +47,12 @@ pub struct CustomElementRegistry {
window: Dom<Window>,
#[ignore_heap_size_of = "Rc"]
#[ignore_malloc_size_of = "Rc"]
when_defined: DomRefCell<HashMap<LocalName, Rc<Promise>>>,
element_definition_is_running: Cell<bool>,
#[ignore_heap_size_of = "Rc"]
#[ignore_malloc_size_of = "Rc"]
definitions: DomRefCell<HashMap<LocalName, Rc<CustomElementDefinition>>>,
}
@ -369,35 +369,35 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
}
}
#[derive(Clone, HeapSizeOf, JSTraceable)]
#[derive(Clone, JSTraceable, MallocSizeOf)]
pub struct LifecycleCallbacks {
#[ignore_heap_size_of = "Rc"]
#[ignore_malloc_size_of = "Rc"]
connected_callback: Option<Rc<Function>>,
#[ignore_heap_size_of = "Rc"]
#[ignore_malloc_size_of = "Rc"]
disconnected_callback: Option<Rc<Function>>,
#[ignore_heap_size_of = "Rc"]
#[ignore_malloc_size_of = "Rc"]
adopted_callback: Option<Rc<Function>>,
#[ignore_heap_size_of = "Rc"]
#[ignore_malloc_size_of = "Rc"]
attribute_changed_callback: Option<Rc<Function>>,
}
#[derive(Clone, HeapSizeOf, JSTraceable)]
#[derive(Clone, JSTraceable, MallocSizeOf)]
pub enum ConstructionStackEntry {
Element(DomRoot<Element>),
AlreadyConstructedMarker,
}
/// <https://html.spec.whatwg.org/multipage/#custom-element-definition>
#[derive(Clone, HeapSizeOf, JSTraceable)]
#[derive(Clone, JSTraceable, MallocSizeOf)]
pub struct CustomElementDefinition {
pub name: LocalName,
pub local_name: LocalName,
#[ignore_heap_size_of = "Rc"]
#[ignore_malloc_size_of = "Rc"]
pub constructor: Rc<Function>,
pub observed_attributes: Vec<DOMString>,
@ -580,15 +580,15 @@ pub fn try_upgrade_element(element: &Element) {
}
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
pub enum CustomElementReaction {
Upgrade(
#[ignore_heap_size_of = "Rc"]
#[ignore_malloc_size_of = "Rc"]
Rc<CustomElementDefinition>
),
Callback(
#[ignore_heap_size_of = "Rc"]
#[ignore_malloc_size_of = "Rc"]
Rc<Function>,
Box<[Heap<JSVal>]>
),
@ -617,14 +617,14 @@ pub enum CallbackReaction {
}
/// <https://html.spec.whatwg.org/multipage/#processing-the-backup-element-queue>
#[derive(Clone, Copy, Eq, HeapSizeOf, JSTraceable, PartialEq)]
#[derive(Clone, Copy, Eq, JSTraceable, MallocSizeOf, PartialEq)]
enum BackupElementQueueFlag {
Processing,
NotProcessing,
}
/// <https://html.spec.whatwg.org/multipage/#custom-element-reactions-stack>
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
pub struct CustomElementReactionStack {
stack: DomRefCell<Vec<ElementQueue>>,
@ -773,7 +773,7 @@ impl CustomElementReactionStack {
}
/// <https://html.spec.whatwg.org/multipage/#element-queue>
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
struct ElementQueue {
queue: DomRefCell<VecDeque<Dom<Element>>>,

View file

@ -22,7 +22,7 @@ use servo_atoms::Atom;
#[dom_struct]
pub struct CustomEvent {
event: Event,
#[ignore_heap_size_of = "Defined in rust-mozjs"]
#[ignore_malloc_size_of = "Defined in rust-mozjs"]
detail: Heap<JSVal>,
}

View file

@ -80,15 +80,15 @@ enum MixedMessage {
#[dom_struct]
pub struct DedicatedWorkerGlobalScope {
workerglobalscope: WorkerGlobalScope,
#[ignore_heap_size_of = "Defined in std"]
#[ignore_malloc_size_of = "Defined in std"]
receiver: Receiver<(TrustedWorkerAddress, WorkerScriptMsg)>,
#[ignore_heap_size_of = "Defined in std"]
#[ignore_malloc_size_of = "Defined in std"]
own_sender: Sender<(TrustedWorkerAddress, WorkerScriptMsg)>,
#[ignore_heap_size_of = "Defined in std"]
#[ignore_malloc_size_of = "Defined in std"]
timer_event_port: Receiver<(TrustedWorkerAddress, TimerEvent)>,
#[ignore_heap_size_of = "Trusted<T> has unclear ownership like Dom<T>"]
#[ignore_malloc_size_of = "Trusted<T> has unclear ownership like Dom<T>"]
worker: DomRefCell<Option<TrustedWorkerAddress>>,
#[ignore_heap_size_of = "Can't measure trait objects"]
#[ignore_malloc_size_of = "Can't measure trait objects"]
/// Sender to the parent thread.
parent_sender: Box<ScriptChan + Send>,
}

View file

@ -158,13 +158,13 @@ pub enum TouchEventResult {
Forwarded,
}
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum IsHTMLDocument {
HTMLDocument,
NonHTMLDocument,
}
#[derive(Debug, HeapSizeOf)]
#[derive(Debug, MallocSizeOf)]
pub struct PendingRestyle {
/// If this element had a state or attribute change since the last restyle, track
/// the original condition of the element.
@ -187,10 +187,10 @@ impl PendingRestyle {
}
}
#[derive(Clone, HeapSizeOf, JSTraceable)]
#[derive(Clone, JSTraceable, MallocSizeOf)]
#[must_root]
struct StyleSheetInDocument {
#[ignore_heap_size_of = "Arc"]
#[ignore_malloc_size_of = "Arc"]
sheet: Arc<Stylesheet>,
owner: Dom<Element>,
}
@ -228,7 +228,7 @@ pub struct Document {
is_html_document: bool,
activity: Cell<DocumentActivity>,
url: DomRefCell<ServoUrl>,
#[ignore_heap_size_of = "defined in selectors"]
#[ignore_malloc_size_of = "defined in selectors"]
quirks_mode: Cell<QuirksMode>,
/// Caches for the getElement methods
id_map: DomRefCell<HashMap<Atom, Vec<Dom<Element>>>>,
@ -321,7 +321,7 @@ pub struct Document {
/// <https://html.spec.whatwg.org/multipage/#target-element>
target_element: MutNullableDom<Element>,
/// <https://w3c.github.io/uievents/#event-type-dblclick>
#[ignore_heap_size_of = "Defined in std"]
#[ignore_malloc_size_of = "Defined in std"]
last_click_info: DomRefCell<Option<(Instant, Point2D<f32>)>>,
/// <https://html.spec.whatwg.org/multipage/#ignore-destructive-writes-counter>
ignore_destructive_writes_counter: Cell<u32>,
@ -346,7 +346,7 @@ pub struct Document {
form_id_listener_map: DomRefCell<HashMap<Atom, HashSet<Dom<Element>>>>,
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
struct ImagesFilter;
impl CollectionFilter for ImagesFilter {
fn filter(&self, elem: &Element, _root: &Node) -> bool {
@ -354,7 +354,7 @@ impl CollectionFilter for ImagesFilter {
}
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
struct EmbedsFilter;
impl CollectionFilter for EmbedsFilter {
fn filter(&self, elem: &Element, _root: &Node) -> bool {
@ -362,7 +362,7 @@ impl CollectionFilter for EmbedsFilter {
}
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
struct LinksFilter;
impl CollectionFilter for LinksFilter {
fn filter(&self, elem: &Element, _root: &Node) -> bool {
@ -371,7 +371,7 @@ impl CollectionFilter for LinksFilter {
}
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
struct FormsFilter;
impl CollectionFilter for FormsFilter {
fn filter(&self, elem: &Element, _root: &Node) -> bool {
@ -379,7 +379,7 @@ impl CollectionFilter for FormsFilter {
}
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
struct ScriptsFilter;
impl CollectionFilter for ScriptsFilter {
fn filter(&self, elem: &Element, _root: &Node) -> bool {
@ -387,7 +387,7 @@ impl CollectionFilter for ScriptsFilter {
}
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
struct AnchorsFilter;
impl CollectionFilter for AnchorsFilter {
fn filter(&self, elem: &Element, _root: &Node) -> bool {
@ -395,7 +395,7 @@ impl CollectionFilter for AnchorsFilter {
}
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
struct AppletsFilter;
impl CollectionFilter for AppletsFilter {
fn filter(&self, elem: &Element, _root: &Node) -> bool {
@ -1978,7 +1978,7 @@ impl Document {
}
}
#[derive(HeapSizeOf, PartialEq)]
#[derive(MallocSizeOf, PartialEq)]
pub enum DocumentSource {
FromParser,
NotFromParser,
@ -2092,7 +2092,7 @@ fn url_has_network_scheme(url: &ServoUrl) -> bool {
}
}
#[derive(Clone, Copy, Eq, HeapSizeOf, JSTraceable, PartialEq)]
#[derive(Clone, Copy, Eq, JSTraceable, MallocSizeOf, PartialEq)]
pub enum HasBrowsingContext {
No,
Yes,
@ -3470,7 +3470,7 @@ impl DocumentMethods for Document {
#[allow(unsafe_code)]
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:dom-document-nameditem-filter
unsafe fn NamedGetter(&self, _cx: *mut JSContext, name: DOMString) -> Option<NonNullJSObjectPtr> {
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
struct NamedElementFilter {
name: Atom,
}
@ -3945,10 +3945,10 @@ pub enum FocusEventType {
/// If the page is observed to be using `requestAnimationFrame()` for non-animation purposes (i.e.
/// without mutating the DOM), then we fall back to simple timeouts to save energy over video
/// refresh.
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
pub struct FakeRequestAnimationFrameCallback {
/// The document.
#[ignore_heap_size_of = "non-owning"]
#[ignore_malloc_size_of = "non-owning"]
document: Trusted<Document>,
}
@ -3959,11 +3959,11 @@ impl FakeRequestAnimationFrameCallback {
}
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
pub enum AnimationFrameCallback {
DevtoolsFramerateTick { actor_name: String },
FrameRequestCallback {
#[ignore_heap_size_of = "Rc is hard"]
#[ignore_malloc_size_of = "Rc is hard"]
callback: Rc<FrameRequestCallback>
},
}
@ -3985,7 +3985,7 @@ impl AnimationFrameCallback {
}
}
#[derive(Default, HeapSizeOf, JSTraceable)]
#[derive(Default, JSTraceable, MallocSizeOf)]
#[must_root]
struct PendingInOrderScriptVec {
scripts: DomRefCell<VecDeque<PendingScript>>,
@ -4021,7 +4021,7 @@ impl PendingInOrderScriptVec {
}
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
struct PendingScript {
element: Dom<HTMLScriptElement>,

View file

@ -12,7 +12,7 @@ use dom::globalscope::GlobalScope;
use dom_struct::dom_struct;
#[repr(u16)]
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable)]
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf)]
pub enum DOMErrorName {
IndexSizeError = DOMExceptionConstants::INDEX_SIZE_ERR,
HierarchyRequestError = DOMExceptionConstants::HIERARCHY_REQUEST_ERR,

View file

@ -140,7 +140,7 @@ pub struct Element {
attrs: DomRefCell<Vec<Dom<Attr>>>,
id_attribute: DomRefCell<Option<Atom>>,
is: DomRefCell<Option<LocalName>>,
#[ignore_heap_size_of = "Arc"]
#[ignore_malloc_size_of = "Arc"]
style_attribute: DomRefCell<Option<Arc<Locked<PropertyDeclarationBlock>>>>,
attr_list: MutNullableDom<NamedNodeMap>,
class_list: MutNullableDom<DOMTokenList>,
@ -149,12 +149,12 @@ pub struct Element {
/// operations may require restyling this element or its descendants. The
/// flags are not atomic, so the style system takes care of only set them
/// when it has exclusive access to the element.
#[ignore_heap_size_of = "bitflags defined in rust-selectors"]
#[ignore_malloc_size_of = "bitflags defined in rust-selectors"]
selector_flags: Cell<ElementSelectorFlags>,
/// <https://html.spec.whatwg.org/multipage/#custom-element-reaction-queue>
custom_element_reaction_queue: DomRefCell<Vec<CustomElementReaction>>,
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-definition>
#[ignore_heap_size_of = "Rc"]
#[ignore_malloc_size_of = "Rc"]
custom_element_definition: DomRefCell<Option<Rc<CustomElementDefinition>>>,
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-state>
custom_element_state: Cell<CustomElementState>,
@ -176,7 +176,7 @@ impl fmt::Debug for DomRoot<Element> {
}
}
#[derive(HeapSizeOf, PartialEq)]
#[derive(MallocSizeOf, PartialEq)]
pub enum ElementCreator {
ParserCreated(u64),
ScriptCreated,
@ -188,7 +188,7 @@ pub enum CustomElementCreationMode {
}
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-state>
#[derive(Clone, Copy, Eq, HeapSizeOf, JSTraceable, PartialEq)]
#[derive(Clone, Copy, Eq, JSTraceable, MallocSizeOf, PartialEq)]
pub enum CustomElementState {
Undefined,
Failed,
@ -3025,7 +3025,7 @@ impl<'a> AttributeMutation<'a> {
/// A holder for an element's "tag name", which will be lazily
/// resolved and cached. Should be reset when the document
/// owner changes.
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
struct TagName {
ptr: DomRefCell<Option<LocalName>>,
}

View file

@ -27,7 +27,7 @@ pub struct ErrorEvent {
filename: DomRefCell<DOMString>,
lineno: Cell<u32>,
colno: Cell<u32>,
#[ignore_heap_size_of = "Defined in rust-mozjs"]
#[ignore_malloc_size_of = "Defined in rust-mozjs"]
error: Heap<JSVal>,
}

View file

@ -294,7 +294,7 @@ impl EventMethods for Event {
}
}
#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
pub enum EventBubbles {
Bubbles,
DoesNotBubble
@ -318,7 +318,7 @@ impl From<EventBubbles> for bool {
}
}
#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
pub enum EventCancelable {
Cancelable,
NotCancelable
@ -344,7 +344,7 @@ impl From<EventCancelable> for bool {
#[derive(Clone, Copy, Debug, Eq, JSTraceable, PartialEq)]
#[repr(u16)]
#[derive(HeapSizeOf)]
#[derive(MallocSizeOf)]
pub enum EventPhase {
None = EventConstants::NONE,
Capturing = EventConstants::CAPTURING_PHASE,
@ -363,7 +363,7 @@ pub enum EventPhase {
///
/// [msg]: https://doc.servo.org/script_traits/enum.ConstellationMsg.html#variant.KeyEvent
///
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub enum EventDefault {
/// The default action of the event is allowed (constructor's default)
Allowed,

View file

@ -41,10 +41,10 @@ header! { (LastEventId, "Last-Event-ID") => [String] }
const DEFAULT_RECONNECTION_TIME: u64 = 5000;
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
struct GenerationId(u32);
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
/// <https://html.spec.whatwg.org/multipage/#dom-eventsource-readystate>
enum ReadyState {
Connecting = 0,
@ -528,11 +528,11 @@ impl EventSourceMethods for EventSource {
}
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
pub struct EventSourceTimeoutCallback {
#[ignore_heap_size_of = "Because it is non-owning"]
#[ignore_malloc_size_of = "Because it is non-owning"]
event_source: Trusted<EventSource>,
#[ignore_heap_size_of = "Because it is non-owning"]
#[ignore_malloc_size_of = "Because it is non-owning"]
action_sender: ipc::IpcSender<FetchResponseMsg>,
}

View file

@ -32,7 +32,6 @@ use dom::virtualmethods::VirtualMethods;
use dom::window::Window;
use dom_struct::dom_struct;
use fnv::FnvHasher;
use heapsize::HeapSizeOf;
use js::jsapi::{CompileFunction, JS_GetFunctionObject, JSAutoCompartment};
use js::rust::{AutoObjectVectorWrapper, CompileOptionsWrapper};
use libc::{c_char, size_t};
@ -48,11 +47,19 @@ use std::ops::{Deref, DerefMut};
use std::ptr;
use std::rc::Rc;
#[derive(Clone, JSTraceable, PartialEq)]
#[derive(Clone, JSTraceable, MallocSizeOf, PartialEq)]
pub enum CommonEventHandler {
EventHandler(Rc<EventHandlerNonNull>),
ErrorEventHandler(Rc<OnErrorEventHandlerNonNull>),
BeforeUnloadEventHandler(Rc<OnBeforeUnloadEventHandlerNonNull>),
EventHandler(
#[ignore_malloc_size_of = "Rc"]
Rc<EventHandlerNonNull>),
ErrorEventHandler(
#[ignore_malloc_size_of = "Rc"]
Rc<OnErrorEventHandlerNonNull>),
BeforeUnloadEventHandler(
#[ignore_malloc_size_of = "Rc"]
Rc<OnBeforeUnloadEventHandlerNonNull>),
}
impl CommonEventHandler {
@ -65,14 +72,14 @@ impl CommonEventHandler {
}
}
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub enum ListenerPhase {
Capturing,
Bubbling,
}
/// <https://html.spec.whatwg.org/multipage/#internal-raw-uncompiled-handler>
#[derive(Clone, JSTraceable, PartialEq)]
#[derive(Clone, JSTraceable, MallocSizeOf, PartialEq)]
struct InternalRawUncompiledHandler {
source: DOMString,
url: ServoUrl,
@ -80,7 +87,7 @@ struct InternalRawUncompiledHandler {
}
/// A representation of an event handler, either compiled or uncompiled raw source, or null.
#[derive(Clone, JSTraceable, PartialEq)]
#[derive(Clone, JSTraceable, MallocSizeOf, PartialEq)]
enum InlineEventListener {
Uncompiled(InternalRawUncompiledHandler),
Compiled(CommonEventHandler),
@ -110,19 +117,12 @@ impl InlineEventListener {
}
}
#[derive(Clone, JSTraceable, PartialEq)]
#[derive(Clone, JSTraceable, MallocSizeOf, PartialEq)]
enum EventListenerType {
Additive(Rc<EventListener>),
Additive(#[ignore_malloc_size_of = "Rc"] Rc<EventListener>),
Inline(InlineEventListener),
}
impl HeapSizeOf for EventListenerType {
fn heap_size_of_children(&self) -> usize {
// FIXME: Rc<T> isn't HeapSizeOf and we can't ignore it due to #6870 and #6871
0
}
}
impl EventListenerType {
fn get_compiled_listener(&mut self, owner: &EventTarget, ty: &Atom)
-> Option<CompiledEventListener> {
@ -225,14 +225,14 @@ impl CompiledEventListener {
}
}
#[derive(Clone, DenyPublicFields, HeapSizeOf, JSTraceable, PartialEq)]
#[derive(Clone, DenyPublicFields, JSTraceable, MallocSizeOf, PartialEq)]
/// A listener in a collection of event listeners.
struct EventListenerEntry {
phase: ListenerPhase,
listener: EventListenerType
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
/// A mix of potentially uncompiled and compiled event listeners of the same type.
struct EventListeners(Vec<EventListenerEntry>);

View file

@ -39,7 +39,7 @@ use task::TaskCanceller;
use task_source::TaskSource;
use task_source::file_reading::{FileReadingTask, FileReadingTaskSource};
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub enum FileReaderFunction {
ReadAsText,
ReadAsDataUrl,
@ -48,7 +48,7 @@ pub enum FileReaderFunction {
pub type TrustedFileReader = Trusted<FileReader>;
#[derive(Clone, HeapSizeOf)]
#[derive(Clone, MallocSizeOf)]
pub struct ReadMetaData {
pub blobtype: String,
pub label: Option<String>,
@ -66,18 +66,18 @@ impl ReadMetaData {
}
}
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub struct GenerationId(u32);
#[repr(u16)]
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum FileReaderReadyState {
Empty = FileReaderConstants::EMPTY,
Loading = FileReaderConstants::LOADING,
Done = FileReaderConstants::DONE,
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
pub enum FileReaderResult {
ArrayBuffer(Heap<JSVal>),
String(DOMString),

View file

@ -35,7 +35,7 @@ pub struct Gamepad {
axes: Heap<*mut JSObject>,
buttons: Dom<GamepadButtonList>,
pose: Option<Dom<VRPose>>,
#[ignore_heap_size_of = "Defined in rust-webvr"]
#[ignore_malloc_size_of = "Defined in rust-webvr"]
hand: WebVRGamepadHand,
display_id: u32
}

View file

@ -72,22 +72,22 @@ pub struct GlobalScope {
console_timers: DomRefCell<HashMap<DOMString, u64>>,
/// For providing instructions to an optional devtools server.
#[ignore_heap_size_of = "channels are hard"]
#[ignore_malloc_size_of = "channels are hard"]
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
/// For sending messages to the memory profiler.
#[ignore_heap_size_of = "channels are hard"]
#[ignore_malloc_size_of = "channels are hard"]
mem_profiler_chan: mem::ProfilerChan,
/// For sending messages to the time profiler.
#[ignore_heap_size_of = "channels are hard"]
#[ignore_malloc_size_of = "channels are hard"]
time_profiler_chan: time::ProfilerChan,
/// A handle for communicating messages to the constellation thread.
#[ignore_heap_size_of = "channels are hard"]
#[ignore_malloc_size_of = "channels are hard"]
script_to_constellation_chan: ScriptToConstellationChan,
#[ignore_heap_size_of = "channels are hard"]
#[ignore_malloc_size_of = "channels are hard"]
scheduler_chan: IpcSender<TimerSchedulerMsg>,
/// <https://html.spec.whatwg.org/multipage/#in-error-reporting-mode>
@ -108,7 +108,7 @@ pub struct GlobalScope {
/// same microtask queue.
///
/// <https://html.spec.whatwg.org/multipage/#microtask-queue>
#[ignore_heap_size_of = "Rc<T> is hard"]
#[ignore_malloc_size_of = "Rc<T> is hard"]
microtask_queue: Rc<MicrotaskQueue>,
}

View file

@ -21,12 +21,12 @@ use std::str;
pub struct Headers {
reflector_: Reflector,
guard: Cell<Guard>,
#[ignore_heap_size_of = "Defined in hyper"]
#[ignore_malloc_size_of = "Defined in hyper"]
header_list: DomRefCell<HyperHeaders>
}
// https://fetch.spec.whatwg.org/#concept-headers-guard
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub enum Guard {
Immutable,
Request,

View file

@ -30,7 +30,7 @@ use std::default::Default;
use style::element_state::*;
#[derive(Clone, Copy, JSTraceable, PartialEq)]
#[derive(HeapSizeOf)]
#[derive(MallocSizeOf)]
enum ButtonType {
Submit,
Reset,

View file

@ -42,7 +42,7 @@ const DEFAULT_WIDTH: u32 = 300;
const DEFAULT_HEIGHT: u32 = 150;
#[must_root]
#[derive(Clone, HeapSizeOf, JSTraceable)]
#[derive(Clone, JSTraceable, MallocSizeOf)]
pub enum CanvasContext {
Context2d(Dom<CanvasRenderingContext2D>),
WebGL(Dom<WebGLRenderingContext>),

View file

@ -26,7 +26,7 @@ pub trait CollectionFilter : JSTraceable {
// An optional u32, using maxint to represent None.
// It would be nicer just to use Option<u32> for this, but that would produce word
// alignment issues since Option<u32> uses 33 bits.
#[derive(Clone, Copy, HeapSizeOf, JSTraceable)]
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
struct OptionU32 {
bits: u32,
}
@ -54,7 +54,7 @@ impl OptionU32 {
pub struct HTMLCollection {
reflector_: Reflector,
root: Dom<Node>,
#[ignore_heap_size_of = "Contains a trait object; can't measure due to #6870"]
#[ignore_malloc_size_of = "Contains a trait object; can't measure due to #6870"]
filter: Box<CollectionFilter + 'static>,
// We cache the version of the root node and all its decendents,
// the length of the collection, and a cursor into the collection.
@ -119,7 +119,7 @@ impl HTMLCollection {
-> DomRoot<HTMLCollection> {
// case 1
if qualified_name == local_name!("*") {
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
struct AllFilter;
impl CollectionFilter for AllFilter {
fn filter(&self, _elem: &Element, _root: &Node) -> bool {
@ -129,7 +129,7 @@ impl HTMLCollection {
return HTMLCollection::create(window, root, Box::new(AllFilter));
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
struct HtmlDocumentFilter {
qualified_name: LocalName,
ascii_lower_qualified_name: LocalName,
@ -169,7 +169,7 @@ impl HTMLCollection {
}
pub fn by_qual_tag_name(window: &Window, root: &Node, qname: QualName) -> DomRoot<HTMLCollection> {
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
struct TagNameNSFilter {
qname: QualName
}
@ -193,7 +193,7 @@ impl HTMLCollection {
pub fn by_atomic_class_name(window: &Window, root: &Node, classes: Vec<Atom>)
-> DomRoot<HTMLCollection> {
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
struct ClassNameFilter {
classes: Vec<Atom>
}
@ -212,7 +212,7 @@ impl HTMLCollection {
}
pub fn children(window: &Window, root: &Node) -> DomRoot<HTMLCollection> {
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
struct ElementChildFilter;
impl CollectionFilter for ElementChildFilter {
fn filter(&self, elem: &Element, root: &Node) -> bool {

View file

@ -43,7 +43,7 @@ impl HTMLDataListElement {
impl HTMLDataListElementMethods for HTMLDataListElement {
// https://html.spec.whatwg.org/multipage/#dom-datalist-options
fn Options(&self) -> DomRoot<HTMLCollection> {
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
struct HTMLDataListOptionsFilter;
impl CollectionFilter for HTMLDataListOptionsFilter {
fn filter(&self, elem: &Element, _root: &Node) -> bool {

View file

@ -52,7 +52,7 @@ impl HTMLFieldSetElement {
impl HTMLFieldSetElementMethods for HTMLFieldSetElement {
// https://html.spec.whatwg.org/multipage/#dom-fieldset-elements
fn Elements(&self) -> DomRoot<HTMLCollection> {
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
struct ElementsFilter;
impl CollectionFilter for ElementsFilter {
fn filter<'a>(&self, elem: &'a Element, _root: &'a Node) -> bool {

View file

@ -57,7 +57,7 @@ use style::attr::AttrValue;
use style::str::split_html_space_chars;
use task_source::TaskSource;
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub struct GenerationId(u32);
#[dom_struct]
@ -166,7 +166,7 @@ impl HTMLFormElementMethods for HTMLFormElement {
// https://html.spec.whatwg.org/multipage/#dom-form-elements
fn Elements(&self) -> DomRoot<HTMLFormControlsCollection> {
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
struct ElementsFilter {
form: DomRoot<HTMLFormElement>
}
@ -235,13 +235,13 @@ impl HTMLFormElementMethods for HTMLFormElement {
}
}
#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
pub enum SubmittedFrom {
FromForm,
NotFromForm
}
#[derive(Clone, Copy, HeapSizeOf)]
#[derive(Clone, Copy, MallocSizeOf)]
pub enum ResetFrom {
FromForm,
NotFromForm
@ -674,14 +674,14 @@ impl HTMLFormElement {
}
}
#[derive(Clone, HeapSizeOf, JSTraceable)]
#[derive(Clone, JSTraceable, MallocSizeOf)]
pub enum FormDatumValue {
#[allow(dead_code)]
File(DomRoot<File>),
String(DOMString)
}
#[derive(Clone, HeapSizeOf, JSTraceable)]
#[derive(Clone, JSTraceable, MallocSizeOf)]
pub struct FormDatum {
pub ty: DOMString,
pub name: DOMString,
@ -701,21 +701,21 @@ impl FormDatum {
}
}
#[derive(Clone, Copy, HeapSizeOf)]
#[derive(Clone, Copy, MallocSizeOf)]
pub enum FormEncType {
TextPlainEncoded,
UrlEncoded,
FormDataEncoded
}
#[derive(Clone, Copy, HeapSizeOf)]
#[derive(Clone, Copy, MallocSizeOf)]
pub enum FormMethod {
FormGet,
FormPost,
FormDialog
}
#[derive(HeapSizeOf)]
#[derive(MallocSizeOf)]
#[allow(dead_code)]
pub enum FormSubmittableElement {
ButtonElement(DomRoot<HTMLButtonElement>),
@ -759,7 +759,7 @@ impl FormSubmittableElement {
}
}
#[derive(Clone, Copy, HeapSizeOf)]
#[derive(Clone, Copy, MallocSizeOf)]
pub enum FormSubmitter<'a> {
FormElement(&'a HTMLFormElement),
InputElement(&'a HTMLInputElement),

View file

@ -10,7 +10,7 @@ use dom::node::Node;
use dom_struct::dom_struct;
use html5ever::{LocalName, Prefix};
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
pub enum HeadingLevel {
Heading1,
Heading2,

View file

@ -56,7 +56,7 @@ use style::attr::{AttrValue, LengthOrPercentageOrAuto};
use task_source::TaskSource;
bitflags! {
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
flags SandboxAllowance: u8 {
const ALLOW_NOTHING = 0x00,
const ALLOW_SAME_ORIGIN = 0x01,

View file

@ -85,7 +85,7 @@ pub struct Descriptor {
pub den: Option<f64>,
}
#[derive(Clone, Copy, HeapSizeOf, JSTraceable)]
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
#[allow(dead_code)]
enum State {
Unavailable,
@ -100,19 +100,19 @@ pub struct Size {
pub length: Length,
}
#[derive(Clone, Copy, HeapSizeOf, JSTraceable)]
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
enum ImageRequestPhase {
Pending,
Current
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
struct ImageRequest {
state: State,
parsed_url: Option<ServoUrl>,
source_url: Option<DOMString>,
blocker: Option<LoadBlocker>,
#[ignore_heap_size_of = "Arc"]
#[ignore_malloc_size_of = "Arc"]
image: Option<Arc<Image>>,
metadata: Option<ImageMetadata>,
final_url: Option<ServoUrl>,
@ -695,7 +695,7 @@ impl HTMLImageElement {
}
#[derive(HeapSizeOf, JSTraceable)]
#[derive(JSTraceable, MallocSizeOf)]
pub enum ImageElementMicrotask {
StableStateUpdateImageDataTask {
elem: DomRoot<HTMLImageElement>,

View file

@ -62,7 +62,7 @@ const PASSWORD_REPLACEMENT_CHAR: char = '●';
#[derive(Clone, Copy, JSTraceable, PartialEq)]
#[allow(dead_code)]
#[derive(HeapSizeOf)]
#[derive(MallocSizeOf)]
enum InputType {
InputSubmit,
InputReset,
@ -93,7 +93,7 @@ pub struct HTMLInputElement {
size: Cell<u32>,
maxlength: Cell<i32>,
minlength: Cell<i32>,
#[ignore_heap_size_of = "#7193"]
#[ignore_malloc_size_of = "#7193"]
textinput: DomRefCell<TextInput<ScriptToConstellationChan>>,
activation_state: DomRefCell<InputActivationState>,
// https://html.spec.whatwg.org/multipage/#concept-input-value-dirty-flag
@ -105,7 +105,7 @@ pub struct HTMLInputElement {
#[derive(JSTraceable)]
#[must_root]
#[derive(HeapSizeOf)]
#[derive(MallocSizeOf)]
struct InputActivationState {
indeterminate: bool,
checked: bool,

Some files were not shown because too many files have changed in this diff Show more