mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
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:
parent
421baa854e
commit
4506f0d30c
269 changed files with 1418 additions and 1521 deletions
82
Cargo.lock
generated
82
Cargo.lock
generated
|
@ -327,10 +327,10 @@ version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cssparser 0.22.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)",
|
"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)",
|
"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)",
|
"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",
|
"nonzero 0.0.1",
|
||||||
"offscreen_gl_context 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"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 = [
|
dependencies = [
|
||||||
"cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"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)",
|
"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)",
|
"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)",
|
"phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -714,11 +713,11 @@ name = "devtools_traits"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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 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)",
|
"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)",
|
"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",
|
"msg 0.0.1",
|
||||||
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"servo_url 0.0.1",
|
"servo_url 0.0.1",
|
||||||
|
@ -1099,12 +1098,12 @@ dependencies = [
|
||||||
"freetype 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"freetype 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gfx_traits 0.0.1",
|
"gfx_traits 0.0.1",
|
||||||
"harfbuzz-sys 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"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)",
|
"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)",
|
"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)",
|
"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",
|
"msg 0.0.1",
|
||||||
"net_traits 0.0.1",
|
"net_traits 0.0.1",
|
||||||
"ordered-float 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ordered-float 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1142,8 +1141,8 @@ dependencies = [
|
||||||
name = "gfx_traits"
|
name = "gfx_traits"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"malloc_size_of 0.0.1",
|
||||||
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"malloc_size_of_derive 0.0.1",
|
||||||
"range 0.0.1",
|
"range 0.0.1",
|
||||||
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
@ -1244,7 +1243,6 @@ dependencies = [
|
||||||
name = "hashglobe"
|
name = "hashglobe"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
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)",
|
"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)",
|
"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)",
|
"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]]
|
[[package]]
|
||||||
name = "heartbeats-simple"
|
name = "heartbeats-simple"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
|
@ -1514,11 +1502,11 @@ dependencies = [
|
||||||
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gfx 0.0.1",
|
"gfx 0.0.1",
|
||||||
"gfx_traits 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)",
|
"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)",
|
"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)",
|
"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)",
|
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"malloc_size_of 0.0.1",
|
||||||
"msg 0.0.1",
|
"msg 0.0.1",
|
||||||
"net_traits 0.0.1",
|
"net_traits 0.0.1",
|
||||||
"ordered-float 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gfx 0.0.1",
|
"gfx 0.0.1",
|
||||||
"gfx_traits 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)",
|
"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)",
|
"ipc-channel 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"layout 0.0.1",
|
"layout 0.0.1",
|
||||||
|
@ -1570,6 +1557,7 @@ dependencies = [
|
||||||
"lazy_static 0.2.8 (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)",
|
"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)",
|
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"malloc_size_of 0.0.1",
|
||||||
"metrics 0.0.1",
|
"metrics 0.0.1",
|
||||||
"msg 0.0.1",
|
"msg 0.0.1",
|
||||||
"net_traits 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)",
|
"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)",
|
"euclid 0.15.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hashglobe 0.1.0",
|
"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",
|
"servo_arc 0.0.1",
|
||||||
"smallbitvec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"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]]
|
[[package]]
|
||||||
|
@ -1763,8 +1757,6 @@ name = "markup5ever"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
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 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)",
|
"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)",
|
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1914,8 +1906,8 @@ name = "msg"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"malloc_size_of 0.0.1",
|
||||||
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"malloc_size_of_derive 0.0.1",
|
||||||
"nonzero 0.0.1",
|
"nonzero 0.0.1",
|
||||||
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"webrender_api 0.52.1 (git+https://github.com/servo/webrender)",
|
"webrender_api 0.52.1 (git+https://github.com/servo/webrender)",
|
||||||
|
@ -2018,14 +2010,14 @@ name = "net_traits"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cookie 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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 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)",
|
"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)",
|
"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)",
|
"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)",
|
"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)",
|
"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",
|
"msg 0.0.1",
|
||||||
"num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -2452,8 +2444,8 @@ dependencies = [
|
||||||
name = "range"
|
name = "range"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"malloc_size_of 0.0.1",
|
||||||
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"malloc_size_of_derive 0.0.1",
|
||||||
"num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"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)",
|
"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)",
|
"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)",
|
"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)",
|
"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 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)",
|
"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)",
|
"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)",
|
"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)",
|
"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",
|
"metrics 0.0.1",
|
||||||
"mime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"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)",
|
"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)",
|
"euclid 0.15.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gfx_traits 0.0.1",
|
"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)",
|
"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)",
|
"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)",
|
"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)",
|
"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",
|
"metrics 0.0.1",
|
||||||
"msg 0.0.1",
|
"msg 0.0.1",
|
||||||
"net_traits 0.0.1",
|
"net_traits 0.0.1",
|
||||||
|
@ -2715,12 +2707,12 @@ dependencies = [
|
||||||
"devtools_traits 0.0.1",
|
"devtools_traits 0.0.1",
|
||||||
"euclid 0.15.3 (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",
|
"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 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)",
|
"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)",
|
"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)",
|
"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",
|
"msg 0.0.1",
|
||||||
"net_traits 0.0.1",
|
"net_traits 0.0.1",
|
||||||
"profile_traits 0.0.1",
|
"profile_traits 0.0.1",
|
||||||
|
@ -2933,7 +2925,6 @@ dependencies = [
|
||||||
name = "servo_arc"
|
name = "servo_arc"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
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)",
|
"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)",
|
"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)",
|
"stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -2979,7 +2970,8 @@ version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"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]]
|
[[package]]
|
||||||
|
@ -3011,8 +3003,8 @@ dependencies = [
|
||||||
name = "servo_url"
|
name = "servo_url"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"malloc_size_of 0.0.1",
|
||||||
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"malloc_size_of_derive 0.0.1",
|
||||||
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"servo_rand 0.0.1",
|
"servo_rand 0.0.1",
|
||||||
"url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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"
|
name = "smallvec"
|
||||||
version = "0.4.3"
|
version = "0.4.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
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]]
|
[[package]]
|
||||||
name = "stable_deref_trait"
|
name = "stable_deref_trait"
|
||||||
|
@ -3096,7 +3085,6 @@ version = "0.6.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"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)",
|
"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)",
|
"precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -3143,8 +3131,6 @@ dependencies = [
|
||||||
"fallible 0.0.1",
|
"fallible 0.0.1",
|
||||||
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hashglobe 0.1.0",
|
"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)",
|
"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)",
|
"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)",
|
"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)",
|
"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)",
|
"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)",
|
"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 0.0.1",
|
||||||
"malloc_size_of_derive 0.0.1",
|
"malloc_size_of_derive 0.0.1",
|
||||||
"selectors 0.19.0",
|
"selectors 0.19.0",
|
||||||
|
@ -3491,7 +3475,6 @@ version = "1.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"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)",
|
"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)",
|
"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 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 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 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 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 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"
|
"checksum html5ever 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5bfb46978eb757a603b7dfe2dafb1c62cb4dee3428d8ac1de734d83d6b022d06"
|
||||||
|
|
|
@ -10,7 +10,7 @@ build = "build.rs"
|
||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
string_cache = {version = "0.6", features = ["heapsize"]}
|
string_cache = {version = "0.6"}
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
string_cache_codegen = "0.4"
|
string_cache_codegen = "0.4"
|
||||||
|
|
|
@ -12,10 +12,10 @@ path = "lib.rs"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cssparser = "0.22.0"
|
cssparser = "0.22.0"
|
||||||
euclid = "0.15"
|
euclid = "0.15"
|
||||||
heapsize = "0.4"
|
|
||||||
heapsize_derive = "0.1"
|
|
||||||
ipc-channel = "0.9"
|
ipc-channel = "0.9"
|
||||||
lazy_static = "0.2"
|
lazy_static = "0.2"
|
||||||
|
malloc_size_of = { path = "../malloc_size_of" }
|
||||||
|
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||||
nonzero = {path = "../nonzero"}
|
nonzero = {path = "../nonzero"}
|
||||||
offscreen_gl_context = { version = "0.11", features = ["serde"] }
|
offscreen_gl_context = { version = "0.11", features = ["serde"] }
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
|
|
|
@ -82,13 +82,13 @@ pub enum FromScriptMsg {
|
||||||
SendPixels(IpcSender<Option<Vec<u8>>>),
|
SendPixels(IpcSender<Option<Vec<u8>>>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct CanvasGradientStop {
|
pub struct CanvasGradientStop {
|
||||||
pub offset: f64,
|
pub offset: f64,
|
||||||
pub color: RGBA,
|
pub color: RGBA,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct LinearGradientStyle {
|
pub struct LinearGradientStyle {
|
||||||
pub x0: f64,
|
pub x0: f64,
|
||||||
pub y0: f64,
|
pub y0: f64,
|
||||||
|
@ -110,7 +110,7 @@ impl LinearGradientStyle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct RadialGradientStyle {
|
pub struct RadialGradientStyle {
|
||||||
pub x0: f64,
|
pub x0: f64,
|
||||||
pub y0: f64,
|
pub y0: f64,
|
||||||
|
@ -165,7 +165,7 @@ pub enum FillOrStrokeStyle {
|
||||||
Surface(SurfaceStyle),
|
Surface(SurfaceStyle),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Deserialize, HeapSizeOf, PartialEq, Serialize)]
|
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
|
||||||
pub enum LineCapStyle {
|
pub enum LineCapStyle {
|
||||||
Butt = 0,
|
Butt = 0,
|
||||||
Round = 1,
|
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 {
|
pub enum LineJoinStyle {
|
||||||
Round = 0,
|
Round = 0,
|
||||||
Bevel = 1,
|
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 {
|
pub enum CompositionStyle {
|
||||||
SrcIn,
|
SrcIn,
|
||||||
SrcOut,
|
SrcOut,
|
||||||
|
@ -281,7 +281,7 @@ impl CompositionStyle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Deserialize, HeapSizeOf, PartialEq, Serialize)]
|
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
|
||||||
pub enum BlendingStyle {
|
pub enum BlendingStyle {
|
||||||
Multiply,
|
Multiply,
|
||||||
Screen,
|
Screen,
|
||||||
|
@ -347,7 +347,7 @@ impl BlendingStyle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Deserialize, HeapSizeOf, PartialEq, Serialize)]
|
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
|
||||||
pub enum CompositionOrBlending {
|
pub enum CompositionOrBlending {
|
||||||
Composition(CompositionStyle),
|
Composition(CompositionStyle),
|
||||||
Blending(BlendingStyle),
|
Blending(BlendingStyle),
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
|
|
||||||
extern crate cssparser;
|
extern crate cssparser;
|
||||||
extern crate euclid;
|
extern crate euclid;
|
||||||
extern crate heapsize;
|
|
||||||
#[macro_use] extern crate heapsize_derive;
|
|
||||||
extern crate ipc_channel;
|
extern crate ipc_channel;
|
||||||
#[macro_use] extern crate lazy_static;
|
#[macro_use] extern crate lazy_static;
|
||||||
|
extern crate malloc_size_of;
|
||||||
|
#[macro_use] extern crate malloc_size_of_derive;
|
||||||
extern crate nonzero;
|
extern crate nonzero;
|
||||||
extern crate offscreen_gl_context;
|
extern crate offscreen_gl_context;
|
||||||
#[macro_use] extern crate serde;
|
#[macro_use] extern crate serde;
|
||||||
|
|
|
@ -64,7 +64,7 @@ pub struct WebGLCreateContextResult {
|
||||||
pub share_mode: WebGLContextShareMode,
|
pub share_mode: WebGLContextShareMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Copy, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub enum WebGLContextShareMode {
|
pub enum WebGLContextShareMode {
|
||||||
/// Fast: a shared texture_id is used in WebRender.
|
/// Fast: a shared texture_id is used in WebRender.
|
||||||
SharedTexture,
|
SharedTexture,
|
||||||
|
@ -73,10 +73,10 @@ pub enum WebGLContextShareMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper struct to send WebGLCommands to a specific WebGLContext.
|
/// Helper struct to send WebGLCommands to a specific WebGLContext.
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct WebGLMsgSender {
|
pub struct WebGLMsgSender {
|
||||||
ctx_id: WebGLContextId,
|
ctx_id: WebGLContextId,
|
||||||
#[ignore_heap_size_of = "channels are hard"]
|
#[ignore_malloc_size_of = "channels are hard"]
|
||||||
sender: WebGLChan,
|
sender: WebGLChan,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,8 +313,8 @@ macro_rules! define_resource_id {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::heapsize::HeapSizeOf for $name {
|
impl ::malloc_size_of::MallocSizeOf for $name {
|
||||||
fn heap_size_of_children(&self) -> usize { 0 }
|
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!(WebGLShaderId);
|
||||||
define_resource_id!(WebGLVertexArrayId);
|
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);
|
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)]
|
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
|
||||||
pub enum WebGLError {
|
pub enum WebGLError {
|
||||||
InvalidEnum,
|
InvalidEnum,
|
||||||
|
|
|
@ -11,11 +11,11 @@ path = "lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bitflags = "0.7"
|
bitflags = "0.7"
|
||||||
heapsize = "0.4"
|
|
||||||
heapsize_derive = "0.1"
|
|
||||||
hyper = "0.10"
|
hyper = "0.10"
|
||||||
hyper_serde = "0.7"
|
hyper_serde = "0.7"
|
||||||
ipc-channel = "0.9"
|
ipc-channel = "0.9"
|
||||||
|
malloc_size_of = { path = "../malloc_size_of" }
|
||||||
|
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||||
msg = {path = "../msg"}
|
msg = {path = "../msg"}
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
servo_url = {path = "../url"}
|
servo_url = {path = "../url"}
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate bitflags;
|
extern crate bitflags;
|
||||||
extern crate heapsize;
|
|
||||||
#[macro_use] extern crate heapsize_derive;
|
|
||||||
extern crate hyper;
|
extern crate hyper;
|
||||||
extern crate ipc_channel;
|
extern crate ipc_channel;
|
||||||
|
extern crate malloc_size_of;
|
||||||
|
#[macro_use] extern crate malloc_size_of_derive;
|
||||||
extern crate msg;
|
extern crate msg;
|
||||||
#[macro_use] extern crate serde;
|
#[macro_use] extern crate serde;
|
||||||
extern crate servo_url;
|
extern crate servo_url;
|
||||||
|
@ -40,7 +40,7 @@ pub struct DevtoolsPageInfo {
|
||||||
pub url: ServoUrl,
|
pub url: ServoUrl,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct CSSError {
|
pub struct CSSError {
|
||||||
pub filename: String,
|
pub filename: String,
|
||||||
pub line: u32,
|
pub line: u32,
|
||||||
|
@ -144,7 +144,7 @@ pub struct TimelineMarker {
|
||||||
pub end_stack: Option<Vec<()>>,
|
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 {
|
pub enum TimelineMarkerType {
|
||||||
Reflow,
|
Reflow,
|
||||||
DOMEvent,
|
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);
|
pub struct WorkerId(pub u32);
|
||||||
|
|
|
@ -15,7 +15,7 @@ pub fn dom_struct(args: TokenStream, input: TokenStream) -> TokenStream {
|
||||||
panic!("#[dom_struct] takes no arguments");
|
panic!("#[dom_struct] takes no arguments");
|
||||||
}
|
}
|
||||||
let attributes = quote! {
|
let attributes = quote! {
|
||||||
#[derive(DenyPublicFields, DomObject, HeapSizeOf, JSTraceable)]
|
#[derive(DenyPublicFields, DomObject, JSTraceable, MallocSizeOf)]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,4 +12,5 @@ path = "lib.rs"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
app_units = "0.5"
|
app_units = "0.5"
|
||||||
euclid = "0.15"
|
euclid = "0.15"
|
||||||
heapsize = "0.4"
|
malloc_size_of = { path = "../malloc_size_of" }
|
||||||
|
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
extern crate app_units;
|
extern crate app_units;
|
||||||
extern crate euclid;
|
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 app_units::{Au, MAX_AU, MIN_AU};
|
||||||
use euclid::{Point2D, Rect, Size2D};
|
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
|
/// The ratio between DeviceIndependentPixel and DevicePixel for a given display be found by calling
|
||||||
/// `servo::windowing::WindowMethods::hidpi_factor`.
|
/// `servo::windowing::WindowMethods::hidpi_factor`.
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug, MallocSizeOf)]
|
||||||
pub enum DeviceIndependentPixel {}
|
pub enum DeviceIndependentPixel {}
|
||||||
|
|
||||||
known_heap_size!(0, DeviceIndependentPixel);
|
|
||||||
|
|
||||||
// An Au is an "App Unit" and represents 1/60th of a CSS pixel. It was
|
// 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.
|
// 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.
|
// See https://bugzilla.mozilla.org/show_bug.cgi?id=177805 for more info.
|
||||||
|
|
|
@ -21,12 +21,12 @@ fnv = "1.0"
|
||||||
fontsan = {git = "https://github.com/servo/fontsan"}
|
fontsan = {git = "https://github.com/servo/fontsan"}
|
||||||
gfx_traits = {path = "../gfx_traits"}
|
gfx_traits = {path = "../gfx_traits"}
|
||||||
harfbuzz-sys = "0.1"
|
harfbuzz-sys = "0.1"
|
||||||
heapsize = "0.4"
|
|
||||||
heapsize_derive = "0.1"
|
|
||||||
ipc-channel = "0.9"
|
ipc-channel = "0.9"
|
||||||
lazy_static = "0.2"
|
lazy_static = "0.2"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
log = "0.3.5"
|
log = "0.3.5"
|
||||||
|
malloc_size_of = { path = "../malloc_size_of" }
|
||||||
|
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||||
msg = {path = "../msg"}
|
msg = {path = "../msg"}
|
||||||
net_traits = {path = "../net_traits"}
|
net_traits = {path = "../net_traits"}
|
||||||
ordered-float = "0.4"
|
ordered-float = "0.4"
|
||||||
|
|
|
@ -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.
|
/// items that involve a blur. This ensures that the display item boundaries include all the ink.
|
||||||
pub static BLUR_INFLATION_FACTOR: i32 = 3;
|
pub static BLUR_INFLATION_FACTOR: i32 = 3;
|
||||||
|
|
||||||
#[derive(Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct DisplayList {
|
pub struct DisplayList {
|
||||||
pub list: Vec<DisplayItem>,
|
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
|
/// Display list sections that make up a stacking context. Each section here refers
|
||||||
/// to the steps in CSS 2.1 Appendix E.
|
/// 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 {
|
pub enum DisplayListSection {
|
||||||
BackgroundAndBorders,
|
BackgroundAndBorders,
|
||||||
BlockBackgroundsAndBorders,
|
BlockBackgroundsAndBorders,
|
||||||
|
@ -322,14 +322,14 @@ pub enum DisplayListSection {
|
||||||
Outlines,
|
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 {
|
pub enum StackingContextType {
|
||||||
Real,
|
Real,
|
||||||
PseudoPositioned,
|
PseudoPositioned,
|
||||||
PseudoFloat,
|
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.
|
/// Represents one CSS stacking context, which may or may not have a hardware layer.
|
||||||
pub struct StackingContext {
|
pub struct StackingContext {
|
||||||
/// The ID of this StackingContext for uniquely identifying it.
|
/// 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 {
|
pub enum ClipScrollNodeType {
|
||||||
ScrollFrame(ScrollSensitivity),
|
ScrollFrame(ScrollSensitivity),
|
||||||
StickyFrame(StickyFrameInfo),
|
StickyFrame(StickyFrameInfo),
|
||||||
|
@ -492,7 +492,7 @@ pub enum ClipScrollNodeType {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Defines a clip scroll node.
|
/// Defines a clip scroll node.
|
||||||
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct ClipScrollNode {
|
pub struct ClipScrollNode {
|
||||||
/// The WebRender clip id of this scroll root based on the source of this clip
|
/// The WebRender clip id of this scroll root based on the source of this clip
|
||||||
/// and information about the fragment.
|
/// and information about the fragment.
|
||||||
|
@ -522,7 +522,7 @@ impl ClipScrollNode {
|
||||||
|
|
||||||
|
|
||||||
/// One drawing command in the list.
|
/// One drawing command in the list.
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub enum DisplayItem {
|
pub enum DisplayItem {
|
||||||
SolidColor(Box<SolidColorDisplayItem>),
|
SolidColor(Box<SolidColorDisplayItem>),
|
||||||
Text(Box<TextDisplayItem>),
|
Text(Box<TextDisplayItem>),
|
||||||
|
@ -541,7 +541,7 @@ pub enum DisplayItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Information common to all display items.
|
/// Information common to all display items.
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct BaseDisplayItem {
|
pub struct BaseDisplayItem {
|
||||||
/// The boundaries of the display item, in layer coordinates.
|
/// The boundaries of the display item, in layer coordinates.
|
||||||
pub bounds: Rect<Au>,
|
pub bounds: Rect<Au>,
|
||||||
|
@ -600,7 +600,7 @@ impl BaseDisplayItem {
|
||||||
/// A clipping region for a display item. Currently, this can describe rectangles, rounded
|
/// 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
|
/// 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.
|
/// 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 {
|
pub struct ClippingRegion {
|
||||||
/// The main rectangular region. This does not include any corners.
|
/// The main rectangular region. This does not include any corners.
|
||||||
pub main: Rect<Au>,
|
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
|
/// 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
|
/// 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.
|
/// 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 {
|
pub struct ComplexClippingRegion {
|
||||||
/// The boundaries of the rectangle.
|
/// The boundaries of the rectangle.
|
||||||
pub rect: Rect<Au>,
|
pub rect: Rect<Au>,
|
||||||
|
@ -784,7 +784,7 @@ impl ComplexClippingRegion {
|
||||||
/// Metadata attached to each display item. This is useful for performing auxiliary threads with
|
/// 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
|
/// the display list involving hit testing: finding the originating DOM node and determining the
|
||||||
/// cursor to use when the element is hovered over.
|
/// cursor to use when the element is hovered over.
|
||||||
#[derive(Clone, Copy, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Copy, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct DisplayItemMetadata {
|
pub struct DisplayItemMetadata {
|
||||||
/// The DOM node from which this display item originated.
|
/// The DOM node from which this display item originated.
|
||||||
pub node: OpaqueNode,
|
pub node: OpaqueNode,
|
||||||
|
@ -794,7 +794,7 @@ pub struct DisplayItemMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Paints a solid color.
|
/// Paints a solid color.
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct SolidColorDisplayItem {
|
pub struct SolidColorDisplayItem {
|
||||||
/// Fields common to all display items.
|
/// Fields common to all display items.
|
||||||
pub base: BaseDisplayItem,
|
pub base: BaseDisplayItem,
|
||||||
|
@ -804,13 +804,13 @@ pub struct SolidColorDisplayItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Paints text.
|
/// Paints text.
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct TextDisplayItem {
|
pub struct TextDisplayItem {
|
||||||
/// Fields common to all display items.
|
/// Fields common to all display items.
|
||||||
pub base: BaseDisplayItem,
|
pub base: BaseDisplayItem,
|
||||||
|
|
||||||
/// The text run.
|
/// 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>,
|
pub text_run: Arc<TextRun>,
|
||||||
|
|
||||||
/// The range of text within the text run.
|
/// The range of text within the text run.
|
||||||
|
@ -826,7 +826,7 @@ pub struct TextDisplayItem {
|
||||||
pub orientation: TextOrientation,
|
pub orientation: TextOrientation,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Eq, HeapSizeOf, PartialEq, Serialize)]
|
#[derive(Clone, Deserialize, Eq, MallocSizeOf, PartialEq, Serialize)]
|
||||||
pub enum TextOrientation {
|
pub enum TextOrientation {
|
||||||
Upright,
|
Upright,
|
||||||
SidewaysLeft,
|
SidewaysLeft,
|
||||||
|
@ -834,13 +834,13 @@ pub enum TextOrientation {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Paints an image.
|
/// Paints an image.
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct ImageDisplayItem {
|
pub struct ImageDisplayItem {
|
||||||
pub base: BaseDisplayItem,
|
pub base: BaseDisplayItem,
|
||||||
|
|
||||||
pub webrender_image: WebRenderImageInfo,
|
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>>,
|
pub image_data: Option<Arc<IpcSharedMemory>>,
|
||||||
|
|
||||||
/// The dimensions to which the image display item should be stretched. If this is smaller than
|
/// 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,
|
pub image_rendering: image_rendering::T,
|
||||||
}
|
}
|
||||||
/// Paints an iframe.
|
/// Paints an iframe.
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct IframeDisplayItem {
|
pub struct IframeDisplayItem {
|
||||||
pub base: BaseDisplayItem,
|
pub base: BaseDisplayItem,
|
||||||
pub iframe: PipelineId,
|
pub iframe: PipelineId,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Paints a gradient.
|
/// Paints a gradient.
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct Gradient {
|
pub struct Gradient {
|
||||||
/// The start point of the gradient (computed during display list construction).
|
/// The start point of the gradient (computed during display list construction).
|
||||||
pub start_point: Point2D<Au>,
|
pub start_point: Point2D<Au>,
|
||||||
|
@ -879,7 +879,7 @@ pub struct Gradient {
|
||||||
pub repeating: bool,
|
pub repeating: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct GradientDisplayItem {
|
pub struct GradientDisplayItem {
|
||||||
/// Fields common to all display item.
|
/// Fields common to all display item.
|
||||||
pub base: BaseDisplayItem,
|
pub base: BaseDisplayItem,
|
||||||
|
@ -889,7 +889,7 @@ pub struct GradientDisplayItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Paints a radial gradient.
|
/// Paints a radial gradient.
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct RadialGradient {
|
pub struct RadialGradient {
|
||||||
/// The center point of the gradient.
|
/// The center point of the gradient.
|
||||||
pub center: Point2D<Au>,
|
pub center: Point2D<Au>,
|
||||||
|
@ -904,7 +904,7 @@ pub struct RadialGradient {
|
||||||
pub repeating: bool,
|
pub repeating: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct RadialGradientDisplayItem {
|
pub struct RadialGradientDisplayItem {
|
||||||
/// Fields common to all display item.
|
/// Fields common to all display item.
|
||||||
pub base: BaseDisplayItem,
|
pub base: BaseDisplayItem,
|
||||||
|
@ -914,7 +914,7 @@ pub struct RadialGradientDisplayItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A normal border, supporting CSS border styles.
|
/// A normal border, supporting CSS border styles.
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct NormalBorder {
|
pub struct NormalBorder {
|
||||||
/// Border colors.
|
/// Border colors.
|
||||||
pub color: SideOffsets2D<ColorF>,
|
pub color: SideOffsets2D<ColorF>,
|
||||||
|
@ -929,7 +929,7 @@ pub struct NormalBorder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A border that is made of image segments.
|
/// A border that is made of image segments.
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct ImageBorder {
|
pub struct ImageBorder {
|
||||||
/// The image this border uses, border-image-source.
|
/// The image this border uses, border-image-source.
|
||||||
pub image: WebRenderImageInfo,
|
pub image: WebRenderImageInfo,
|
||||||
|
@ -951,7 +951,7 @@ pub struct ImageBorder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A border that is made of linear gradient
|
/// A border that is made of linear gradient
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct GradientBorder {
|
pub struct GradientBorder {
|
||||||
/// The gradient info that this border uses, border-image-source.
|
/// The gradient info that this border uses, border-image-source.
|
||||||
pub gradient: Gradient,
|
pub gradient: Gradient,
|
||||||
|
@ -961,7 +961,7 @@ pub struct GradientBorder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A border that is made of radial gradient
|
/// A border that is made of radial gradient
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct RadialGradientBorder {
|
pub struct RadialGradientBorder {
|
||||||
/// The gradient info that this border uses, border-image-source.
|
/// The gradient info that this border uses, border-image-source.
|
||||||
pub gradient: RadialGradient,
|
pub gradient: RadialGradient,
|
||||||
|
@ -971,7 +971,7 @@ pub struct RadialGradientBorder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Specifies the type of border
|
/// Specifies the type of border
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub enum BorderDetails {
|
pub enum BorderDetails {
|
||||||
Normal(NormalBorder),
|
Normal(NormalBorder),
|
||||||
Image(ImageBorder),
|
Image(ImageBorder),
|
||||||
|
@ -980,7 +980,7 @@ pub enum BorderDetails {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Paints a border.
|
/// Paints a border.
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct BorderDisplayItem {
|
pub struct BorderDisplayItem {
|
||||||
/// Fields common to all display items.
|
/// Fields common to all display items.
|
||||||
pub base: BaseDisplayItem,
|
pub base: BaseDisplayItem,
|
||||||
|
@ -995,7 +995,7 @@ pub struct BorderDisplayItem {
|
||||||
/// Information about the border radii.
|
/// Information about the border radii.
|
||||||
///
|
///
|
||||||
/// TODO(pcwalton): Elliptical 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 struct BorderRadii<T> {
|
||||||
pub top_left: Size2D<T>,
|
pub top_left: Size2D<T>,
|
||||||
pub top_right: Size2D<T>,
|
pub top_right: Size2D<T>,
|
||||||
|
@ -1057,7 +1057,7 @@ impl<T> BorderRadii<T> where T: PartialEq + Zero + Clone {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Paints a line segment.
|
/// Paints a line segment.
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct LineDisplayItem {
|
pub struct LineDisplayItem {
|
||||||
pub base: BaseDisplayItem,
|
pub base: BaseDisplayItem,
|
||||||
|
|
||||||
|
@ -1065,12 +1065,12 @@ pub struct LineDisplayItem {
|
||||||
pub color: ColorF,
|
pub color: ColorF,
|
||||||
|
|
||||||
/// The line segment style.
|
/// 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,
|
pub style: webrender_api::LineStyle,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Paints a box shadow per CSS-BACKGROUNDS.
|
/// Paints a box shadow per CSS-BACKGROUNDS.
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct BoxShadowDisplayItem {
|
pub struct BoxShadowDisplayItem {
|
||||||
/// Fields common to all display items.
|
/// Fields common to all display items.
|
||||||
pub base: BaseDisplayItem,
|
pub base: BaseDisplayItem,
|
||||||
|
@ -1100,7 +1100,7 @@ pub struct BoxShadowDisplayItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Defines a text shadow that affects all items until the paired PopTextShadow.
|
/// 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 {
|
pub struct PushTextShadowDisplayItem {
|
||||||
/// Fields common to all display items.
|
/// Fields common to all display items.
|
||||||
pub base: BaseDisplayItem,
|
pub base: BaseDisplayItem,
|
||||||
|
@ -1116,14 +1116,14 @@ pub struct PushTextShadowDisplayItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Defines a text shadow that affects all items until the next PopTextShadow.
|
/// 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 {
|
pub struct PopAllTextShadowsDisplayItem {
|
||||||
/// Fields common to all display items.
|
/// Fields common to all display items.
|
||||||
pub base: BaseDisplayItem,
|
pub base: BaseDisplayItem,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Defines a stacking context.
|
/// Defines a stacking context.
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct PushStackingContextItem {
|
pub struct PushStackingContextItem {
|
||||||
/// Fields common to all display items.
|
/// Fields common to all display items.
|
||||||
pub base: BaseDisplayItem,
|
pub base: BaseDisplayItem,
|
||||||
|
@ -1132,7 +1132,7 @@ pub struct PushStackingContextItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Defines a stacking context.
|
/// Defines a stacking context.
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct PopStackingContextItem {
|
pub struct PopStackingContextItem {
|
||||||
/// Fields common to all display items.
|
/// Fields common to all display items.
|
||||||
pub base: BaseDisplayItem,
|
pub base: BaseDisplayItem,
|
||||||
|
@ -1141,7 +1141,7 @@ pub struct PopStackingContextItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Starts a group of items inside a particular scroll root.
|
/// Starts a group of items inside a particular scroll root.
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct DefineClipScrollNodeItem {
|
pub struct DefineClipScrollNodeItem {
|
||||||
/// Fields common to all display items.
|
/// Fields common to all display items.
|
||||||
pub base: BaseDisplayItem,
|
pub base: BaseDisplayItem,
|
||||||
|
@ -1151,7 +1151,7 @@ pub struct DefineClipScrollNodeItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// How a box shadow should be clipped.
|
/// 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 {
|
pub enum BoxShadowClipMode {
|
||||||
/// No special clipping should occur. This is used for (shadowed) text decorations.
|
/// No special clipping should occur. This is used for (shadowed) text decorations.
|
||||||
None,
|
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 struct WebRenderImageInfo {
|
||||||
pub width: u32,
|
pub width: u32,
|
||||||
pub height: u32,
|
pub height: u32,
|
||||||
|
|
|
@ -7,7 +7,7 @@ use fnv::FnvHasher;
|
||||||
use font::{Font, FontGroup, FontHandleMethods};
|
use font::{Font, FontGroup, FontHandleMethods};
|
||||||
use font_cache_thread::FontCacheThread;
|
use font_cache_thread::FontCacheThread;
|
||||||
use font_template::FontTemplateDescriptor;
|
use font_template::FontTemplateDescriptor;
|
||||||
use heapsize::HeapSizeOf;
|
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||||
use platform::font::FontHandle;
|
use platform::font::FontHandle;
|
||||||
use platform::font_context::FontContextHandle;
|
use platform::font_context::FontContextHandle;
|
||||||
use platform::font_template::FontTemplateData;
|
use platform::font_template::FontTemplateData;
|
||||||
|
@ -232,10 +232,10 @@ impl FontContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HeapSizeOf for FontContext {
|
impl MallocSizeOf for FontContext {
|
||||||
fn heap_size_of_children(&self) -> usize {
|
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||||
// FIXME(njn): Measure other fields eventually.
|
// FIXME(njn): Measure other fields eventually.
|
||||||
self.platform_handle.heap_size_of_children()
|
self.platform_handle.size_of(ops)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,14 +35,15 @@ extern crate gfx_traits;
|
||||||
// shapers. For now, however, this is a hard dependency.
|
// shapers. For now, however, this is a hard dependency.
|
||||||
extern crate harfbuzz_sys as harfbuzz;
|
extern crate harfbuzz_sys as harfbuzz;
|
||||||
|
|
||||||
extern crate heapsize;
|
|
||||||
#[macro_use] extern crate heapsize_derive;
|
|
||||||
extern crate ipc_channel;
|
extern crate ipc_channel;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
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 msg;
|
||||||
extern crate net_traits;
|
extern crate net_traits;
|
||||||
extern crate ordered_float;
|
extern crate ordered_float;
|
||||||
|
|
|
@ -8,7 +8,7 @@ use freetype::freetype::FT_Library;
|
||||||
use freetype::freetype::FT_Memory;
|
use freetype::freetype::FT_Memory;
|
||||||
use freetype::freetype::FT_MemoryRec_;
|
use freetype::freetype::FT_MemoryRec_;
|
||||||
use freetype::freetype::FT_New_Library;
|
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::mem;
|
||||||
use std::os::raw::{c_long, c_void};
|
use std::os::raw::{c_long, c_void};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
@ -31,7 +31,7 @@ extern fn ft_alloc(mem: FT_Memory, req_size: c_long) -> *mut c_void {
|
||||||
mem::forget(vec);
|
mem::forget(vec);
|
||||||
|
|
||||||
unsafe {
|
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;
|
let user = (*mem).user as *mut User;
|
||||||
(*user).size += actual_size;
|
(*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) {
|
extern fn ft_free(mem: FT_Memory, ptr: *mut c_void) {
|
||||||
unsafe {
|
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;
|
let user = (*mem).user as *mut User;
|
||||||
(*user).size -= actual_size;
|
(*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 old_actual_size;
|
||||||
let mut vec;
|
let mut vec;
|
||||||
unsafe {
|
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);
|
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);
|
mem::forget(vec);
|
||||||
|
|
||||||
unsafe {
|
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;
|
let user = (*mem).user as *mut User;
|
||||||
(*user).size += new_actual_size;
|
(*user).size += new_actual_size;
|
||||||
(*user).size -= old_actual_size;
|
(*user).size -= old_actual_size;
|
||||||
|
@ -104,13 +104,13 @@ impl Drop for FreeTypeLibraryHandle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HeapSizeOf for FreeTypeLibraryHandle {
|
impl MallocSizeOf for FreeTypeLibraryHandle {
|
||||||
fn heap_size_of_children(&self) -> usize {
|
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||||
unsafe {
|
unsafe {
|
||||||
(*self.user).size +
|
(*self.user).size +
|
||||||
heap_size_of(self.ctx as *const _) +
|
ops.malloc_size_of(self.ctx as *const _) +
|
||||||
heap_size_of(self.mem as *const _) +
|
ops.malloc_size_of(self.mem as *const _) +
|
||||||
heap_size_of(self.user as *const _)
|
ops.malloc_size_of(self.user as *const _)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,9 +123,9 @@ pub struct FontContextHandle {
|
||||||
pub ctx: Rc<FreeTypeLibraryHandle>,
|
pub ctx: Rc<FreeTypeLibraryHandle>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HeapSizeOf for FontContextHandle {
|
impl MallocSizeOf for FontContextHandle {
|
||||||
fn heap_size_of_children(&self) -> usize {
|
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||||
self.ctx.heap_size_of_children()
|
self.ctx.size_of(ops)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use heapsize::HeapSizeOf;
|
#[derive(Clone, Debug, MallocSizeOf)]
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
|
||||||
pub struct FontContextHandle {
|
pub struct FontContextHandle {
|
||||||
ctx: ()
|
ctx: ()
|
||||||
}
|
}
|
||||||
|
@ -15,9 +13,3 @@ impl FontContextHandle {
|
||||||
FontContextHandle { ctx: () }
|
FontContextHandle { ctx: () }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HeapSizeOf for FontContextHandle {
|
|
||||||
fn heap_size_of_children(&self) -> usize {
|
|
||||||
0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use heapsize::HeapSizeOf;
|
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct FontContextHandle;
|
pub struct FontContextHandle;
|
||||||
|
|
||||||
|
@ -14,8 +12,4 @@ impl FontContextHandle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HeapSizeOf for FontContextHandle {
|
malloc_size_of_is_0!(FontContextHandle);
|
||||||
fn heap_size_of_children(&self) -> usize {
|
|
||||||
0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ name = "gfx_traits"
|
||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
heapsize = "0.4"
|
malloc_size_of = { path = "../malloc_size_of" }
|
||||||
heapsize_derive = "0.1"
|
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||||
range = {path = "../range"}
|
range = {path = "../range"}
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
|
|
||||||
extern crate heapsize;
|
extern crate malloc_size_of;
|
||||||
#[macro_use] extern crate heapsize_derive;
|
#[macro_use] extern crate malloc_size_of_derive;
|
||||||
#[macro_use] extern crate range;
|
#[macro_use] extern crate range;
|
||||||
#[macro_use] extern crate serde;
|
#[macro_use] extern crate serde;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ impl Epoch {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A unique ID for every stacking context.
|
/// 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(
|
pub struct StackingContextId(
|
||||||
/// The identifier for this StackingContext, derived from the Flow's memory address
|
/// 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.
|
/// and fragment type. As a space optimization, these are combined into a single word.
|
||||||
|
@ -53,7 +53,7 @@ int_range_index! {
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
#[doc = "An index that refers to a byte offset in a text run. This could \
|
#[doc = "An index that refers to a byte offset in a text run. This could \
|
||||||
point to the middle of a glyph."]
|
point to the middle of a glyph."]
|
||||||
#[derive(HeapSizeOf)]
|
#[derive(MallocSizeOf)]
|
||||||
struct ByteIndex(isize)
|
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
|
/// 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
|
/// into the lower 2 bits of the `StackingContextId`, which otherwise contains a 32-bit-aligned
|
||||||
/// heap address.
|
/// 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 {
|
pub enum FragmentType {
|
||||||
/// A StackingContext for the fragment body itself.
|
/// A StackingContext for the fragment body itself.
|
||||||
FragmentBody,
|
FragmentBody,
|
||||||
|
|
|
@ -11,7 +11,6 @@ readme = "README.md"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
heapsize = "0.4"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rand = "0.3"
|
rand = "0.3"
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
//! These methods are a lie. They are not actually fallible. This is just to make
|
//! 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.
|
//! it smooth to switch between hashmap impls in a codebase.
|
||||||
|
|
||||||
use heapsize::HeapSizeOf;
|
|
||||||
use std::collections::HashMap as StdMap;
|
use std::collections::HashMap as StdMap;
|
||||||
use std::collections::HashSet as StdSet;
|
use std::collections::HashSet as StdSet;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
@ -161,14 +160,6 @@ impl<T, S> HashSet<T, S>
|
||||||
// Pass through trait impls
|
// Pass through trait impls
|
||||||
// We can't derive these since the bounds are not obvious to the derive macro
|
// 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> {
|
impl<K: Hash + Eq, V, S: BuildHasher + Default> Default for HashMap<K, V, S> {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
HashMap(Default::default())
|
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> {
|
impl<T: Eq + Hash, S: BuildHasher + Default> Default for HashSet<T, S> {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
HashSet(Default::default())
|
HashSet(Default::default())
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
extern crate heapsize;
|
|
||||||
|
|
||||||
pub mod alloc;
|
pub mod alloc;
|
||||||
pub mod diagnostic;
|
pub mod diagnostic;
|
||||||
pub mod hash_map;
|
pub mod hash_map;
|
||||||
|
|
|
@ -18,11 +18,11 @@ euclid = "0.15"
|
||||||
fnv = "1.0"
|
fnv = "1.0"
|
||||||
gfx = {path = "../gfx"}
|
gfx = {path = "../gfx"}
|
||||||
gfx_traits = {path = "../gfx_traits"}
|
gfx_traits = {path = "../gfx_traits"}
|
||||||
heapsize = "0.4"
|
|
||||||
html5ever = "0.20.0"
|
html5ever = "0.20.0"
|
||||||
ipc-channel = "0.9"
|
ipc-channel = "0.9"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
log = "0.3.5"
|
log = "0.3.5"
|
||||||
|
malloc_size_of = { path = "../malloc_size_of" }
|
||||||
msg = {path = "../msg"}
|
msg = {path = "../msg"}
|
||||||
net_traits = {path = "../net_traits"}
|
net_traits = {path = "../net_traits"}
|
||||||
ordered-float = "0.4"
|
ordered-float = "0.4"
|
||||||
|
|
|
@ -8,7 +8,7 @@ use fnv::FnvHasher;
|
||||||
use gfx::display_list::{WebRenderImageInfo, OpaqueNode};
|
use gfx::display_list::{WebRenderImageInfo, OpaqueNode};
|
||||||
use gfx::font_cache_thread::FontCacheThread;
|
use gfx::font_cache_thread::FontCacheThread;
|
||||||
use gfx::font_context::FontContext;
|
use gfx::font_context::FontContext;
|
||||||
use heapsize::HeapSizeOf;
|
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||||
use msg::constellation_msg::PipelineId;
|
use msg::constellation_msg::PipelineId;
|
||||||
use net_traits::image_cache::{CanRequestImages, ImageCache, ImageState};
|
use net_traits::image_cache::{CanRequestImages, ImageCache, ImageState};
|
||||||
use net_traits::image_cache::{ImageOrMetadataAvailable, UsePlaceholder};
|
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| {
|
FONT_CONTEXT_KEY.with(|r| {
|
||||||
if let Some(ref context) = *r.borrow() {
|
if let Some(ref context) = *r.borrow() {
|
||||||
context.heap_size_of_children()
|
context.size_of(ops)
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,12 @@ extern crate euclid;
|
||||||
extern crate fnv;
|
extern crate fnv;
|
||||||
extern crate gfx;
|
extern crate gfx;
|
||||||
extern crate gfx_traits;
|
extern crate gfx_traits;
|
||||||
extern crate heapsize;
|
|
||||||
#[macro_use] extern crate html5ever;
|
#[macro_use] extern crate html5ever;
|
||||||
extern crate ipc_channel;
|
extern crate ipc_channel;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
extern crate malloc_size_of;
|
||||||
extern crate msg;
|
extern crate msg;
|
||||||
extern crate net_traits;
|
extern crate net_traits;
|
||||||
extern crate ordered_float;
|
extern crate ordered_float;
|
||||||
|
|
|
@ -19,7 +19,6 @@ euclid = "0.15"
|
||||||
fnv = "1.0"
|
fnv = "1.0"
|
||||||
gfx = {path = "../gfx"}
|
gfx = {path = "../gfx"}
|
||||||
gfx_traits = {path = "../gfx_traits"}
|
gfx_traits = {path = "../gfx_traits"}
|
||||||
heapsize = "0.4"
|
|
||||||
html5ever = "0.20.0"
|
html5ever = "0.20.0"
|
||||||
ipc-channel = "0.9"
|
ipc-channel = "0.9"
|
||||||
layout = {path = "../layout"}
|
layout = {path = "../layout"}
|
||||||
|
@ -27,6 +26,7 @@ layout_traits = {path = "../layout_traits"}
|
||||||
lazy_static = "0.2"
|
lazy_static = "0.2"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
log = "0.3.5"
|
log = "0.3.5"
|
||||||
|
malloc_size_of = { path = "../malloc_size_of" }
|
||||||
metrics = {path = "../metrics"}
|
metrics = {path = "../metrics"}
|
||||||
msg = {path = "../msg"}
|
msg = {path = "../msg"}
|
||||||
net_traits = {path = "../net_traits"}
|
net_traits = {path = "../net_traits"}
|
||||||
|
|
|
@ -13,7 +13,6 @@ extern crate euclid;
|
||||||
extern crate fnv;
|
extern crate fnv;
|
||||||
extern crate gfx;
|
extern crate gfx;
|
||||||
extern crate gfx_traits;
|
extern crate gfx_traits;
|
||||||
extern crate heapsize;
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate html5ever;
|
extern crate html5ever;
|
||||||
extern crate ipc_channel;
|
extern crate ipc_channel;
|
||||||
|
@ -25,6 +24,7 @@ extern crate lazy_static;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
extern crate malloc_size_of;
|
||||||
extern crate metrics;
|
extern crate metrics;
|
||||||
extern crate msg;
|
extern crate msg;
|
||||||
extern crate net_traits;
|
extern crate net_traits;
|
||||||
|
@ -60,7 +60,6 @@ use gfx::font;
|
||||||
use gfx::font_cache_thread::FontCacheThread;
|
use gfx::font_cache_thread::FontCacheThread;
|
||||||
use gfx::font_context;
|
use gfx::font_context;
|
||||||
use gfx_traits::{Epoch, node_id_from_clip_id};
|
use gfx_traits::{Epoch, node_id_from_clip_id};
|
||||||
use heapsize::HeapSizeOf;
|
|
||||||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||||
use ipc_channel::router::ROUTER;
|
use ipc_channel::router::ROUTER;
|
||||||
use layout::animation;
|
use layout::animation;
|
||||||
|
@ -68,7 +67,7 @@ use layout::construct::ConstructionResult;
|
||||||
use layout::context::LayoutContext;
|
use layout::context::LayoutContext;
|
||||||
use layout::context::RegisteredPainter;
|
use layout::context::RegisteredPainter;
|
||||||
use layout::context::RegisteredPainters;
|
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::display_list_builder::ToGfxColor;
|
||||||
use layout::flow::{self, Flow, ImmutableFlowUtils, MutableOwnedFlowUtils};
|
use layout::flow::{self, Flow, ImmutableFlowUtils, MutableOwnedFlowUtils};
|
||||||
use layout::flow_ref::FlowRef;
|
use layout::flow_ref::FlowRef;
|
||||||
|
@ -85,6 +84,7 @@ use layout::webrender_helpers::WebRenderDisplayListConverter;
|
||||||
use layout::wrapper::LayoutNodeLayoutData;
|
use layout::wrapper::LayoutNodeLayoutData;
|
||||||
use layout_traits::LayoutThreadFactory;
|
use layout_traits::LayoutThreadFactory;
|
||||||
use libc::c_void;
|
use libc::c_void;
|
||||||
|
use malloc_size_of::{malloc_size_of, MallocSizeOf, MallocSizeOfOps};
|
||||||
use metrics::{PaintTimeMetrics, ProfilerMetadataFactory};
|
use metrics::{PaintTimeMetrics, ProfilerMetadataFactory};
|
||||||
use msg::constellation_msg::PipelineId;
|
use msg::constellation_msg::PipelineId;
|
||||||
use msg::constellation_msg::TopLevelBrowsingContextId;
|
use msg::constellation_msg::TopLevelBrowsingContextId;
|
||||||
|
@ -773,6 +773,9 @@ impl LayoutThread {
|
||||||
reports_chan: ReportsChan,
|
reports_chan: ReportsChan,
|
||||||
possibly_locked_rw_data: &mut RwData<'a, 'b>) {
|
possibly_locked_rw_data: &mut RwData<'a, 'b>) {
|
||||||
let mut reports = vec![];
|
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.
|
// FIXME(njn): Just measuring the display tree for now.
|
||||||
let rw_data = possibly_locked_rw_data.lock();
|
let rw_data = possibly_locked_rw_data.lock();
|
||||||
|
@ -781,20 +784,20 @@ impl LayoutThread {
|
||||||
reports.push(Report {
|
reports.push(Report {
|
||||||
path: path![formatted_url, "layout-thread", "display-list"],
|
path: path![formatted_url, "layout-thread", "display-list"],
|
||||||
kind: ReportKind::ExplicitJemallocHeapSize,
|
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 {
|
reports.push(Report {
|
||||||
path: path![formatted_url, "layout-thread", "stylist"],
|
path: path![formatted_url, "layout-thread", "stylist"],
|
||||||
kind: ReportKind::ExplicitJemallocHeapSize,
|
kind: ReportKind::ExplicitJemallocHeapSize,
|
||||||
size: self.stylist.heap_size_of_children(),
|
size: self.stylist.size_of(&mut ops),
|
||||||
});
|
});
|
||||||
|
|
||||||
// The LayoutThread has data in Persistent TLS...
|
// The LayoutThread has data in Persistent TLS...
|
||||||
reports.push(Report {
|
reports.push(Report {
|
||||||
path: path![formatted_url, "layout-thread", "local-context"],
|
path: path![formatted_url, "layout-thread", "local-context"],
|
||||||
kind: ReportKind::ExplicitJemallocHeapSize,
|
kind: ReportKind::ExplicitJemallocHeapSize,
|
||||||
size: heap_size_of_persistent_local_context(),
|
size: malloc_size_of_persistent_local_context(&mut ops),
|
||||||
});
|
});
|
||||||
|
|
||||||
reports_chan.send(reports);
|
reports_chan.send(reports);
|
||||||
|
|
|
@ -8,11 +8,22 @@ publish = false
|
||||||
[lib]
|
[lib]
|
||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
|
|
||||||
|
[target.'cfg(windows)'.dependencies]
|
||||||
|
kernel32-sys = "0.2.1"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
servo = ["js", "string_cache", "url", "webrender_api", "xml5ever"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
app_units = "0.5.5"
|
app_units = "0.5.5"
|
||||||
cssparser = "0.22.0"
|
cssparser = "0.22.0"
|
||||||
euclid = "0.15"
|
euclid = "0.15"
|
||||||
hashglobe = { path = "../hashglobe" }
|
hashglobe = { path = "../hashglobe" }
|
||||||
|
js = { git = "https://github.com/servo/rust-mozjs", features = ["promises"], optional = true }
|
||||||
servo_arc = { path = "../servo_arc" }
|
servo_arc = { path = "../servo_arc" }
|
||||||
smallbitvec = "1.0.3"
|
smallbitvec = "1.0.3"
|
||||||
smallvec = "0.4"
|
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 }
|
||||||
|
|
|
@ -10,28 +10,15 @@
|
||||||
|
|
||||||
//! A crate for measuring the heap usage of data structures in a way that
|
//! A crate for measuring the heap usage of data structures in a way that
|
||||||
//! integrates with Firefox's memory reporting, particularly the use of
|
//! integrates with Firefox's memory reporting, particularly the use of
|
||||||
//! mozjemalloc and DMD.
|
//! mozjemalloc and DMD. In particular, it has the following features.
|
||||||
//!
|
//! - It isn't bound to a particular heap allocator.
|
||||||
//! 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.
|
|
||||||
//! - It provides traits for both "shallow" and "deep" measurement, which gives
|
//! - 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
|
//! - It allows for measuring blocks even when only an interior pointer can be
|
||||||
//! obtained for heap allocations, e.g. `HashSet` and `HashMap`. (This relies
|
//! obtained for heap allocations, e.g. `HashSet` and `HashMap`. (This relies
|
||||||
//! on the heap allocator having suitable support, which mozjemalloc has.)
|
//! on the heap allocator having suitable support, which mozjemalloc has.)
|
||||||
//! - It allows handling of types like `Rc` and `Arc` by providing special
|
//! - It allows handling of types like `Rc` and `Arc` by providing traits that
|
||||||
//! traits that are different to the ones for non-graph structures.
|
//! are different to the ones for non-graph structures.
|
||||||
//!
|
//!
|
||||||
//! Suggested uses are as follows.
|
//! Suggested uses are as follows.
|
||||||
//! - When possible, use the `MallocSizeOf` trait. (Deriving support is
|
//! - When possible, use the `MallocSizeOf` trait. (Deriving support is
|
||||||
|
@ -60,11 +47,26 @@ extern crate app_units;
|
||||||
extern crate cssparser;
|
extern crate cssparser;
|
||||||
extern crate euclid;
|
extern crate euclid;
|
||||||
extern crate hashglobe;
|
extern crate hashglobe;
|
||||||
|
#[cfg(feature = "servo")]
|
||||||
|
extern crate js;
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
extern crate kernel32;
|
||||||
extern crate servo_arc;
|
extern crate servo_arc;
|
||||||
extern crate smallbitvec;
|
extern crate smallbitvec;
|
||||||
extern crate smallvec;
|
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::hash::{BuildHasher, Hash};
|
||||||
|
use std::mem::size_of;
|
||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
use std::os::raw::c_void;
|
use std::os::raw::c_void;
|
||||||
|
|
||||||
|
@ -79,8 +81,11 @@ pub struct MallocSizeOfOps {
|
||||||
/// A function that returns the size of a heap allocation.
|
/// A function that returns the size of a heap allocation.
|
||||||
size_of_op: VoidPtrToSizeFn,
|
size_of_op: VoidPtrToSizeFn,
|
||||||
|
|
||||||
/// Like `size_of_op`, but can take an interior pointer.
|
/// Like `size_of_op`, but can take an interior pointer. Optional because
|
||||||
enclosing_size_of_op: VoidPtrToSizeFn,
|
/// 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.
|
/// 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
|
/// Useful when measuring `Rc`s and `Arc`s. Optional, because many places
|
||||||
|
@ -89,7 +94,8 @@ pub struct MallocSizeOfOps {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl 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 {
|
have_seen_ptr: Option<Box<VoidPtrToBoolFnMut>>) -> Self {
|
||||||
MallocSizeOfOps {
|
MallocSizeOfOps {
|
||||||
size_of_op: size_of,
|
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 {
|
pub unsafe fn malloc_enclosing_size_of<T>(&self, ptr: *const T) -> usize {
|
||||||
assert!(!MallocSizeOfOps::is_empty(ptr));
|
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`.
|
/// 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
|
/// Trait for measuring the "deep" heap usage of a data structure. This is the
|
||||||
/// most commonly-used of the traits.
|
/// most commonly-used of the traits.
|
||||||
pub trait MallocSizeOf {
|
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> {
|
impl<T: ?Sized> MallocShallowSizeOf for Box<T> {
|
||||||
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||||
unsafe { ops.malloc_size_of(&**self) }
|
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 {
|
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||||
self.0.size_of(ops) + self.1.size_of(ops)
|
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> {
|
impl<T: MallocSizeOf> MallocSizeOf for Option<T> {
|
||||||
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||||
if let Some(val) = self.as_ref() {
|
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] {
|
impl<T: MallocSizeOf> MallocSizeOf for [T] {
|
||||||
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||||
let mut n = 0;
|
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> {
|
impl<A: smallvec::Array> MallocShallowSizeOf for smallvec::SmallVec<A> {
|
||||||
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||||
if self.spilled() {
|
if self.spilled() {
|
||||||
|
@ -270,11 +399,16 @@ impl<T, S> MallocShallowSizeOf for std::collections::HashSet<T, S>
|
||||||
S: BuildHasher
|
S: BuildHasher
|
||||||
{
|
{
|
||||||
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||||
// The first value from the iterator gives us an interior pointer.
|
if ops.has_malloc_enclosing_size_of() {
|
||||||
// `ops.malloc_enclosing_size_of()` then gives us the storage size.
|
// The first value from the iterator gives us an interior pointer.
|
||||||
// This assumes that the `HashSet`'s contents (values and hashes) are
|
// `ops.malloc_enclosing_size_of()` then gives us the storage size.
|
||||||
// all stored in a single contiguous heap allocation.
|
// This assumes that the `HashSet`'s contents (values and hashes)
|
||||||
self.iter().next().map_or(0, |t| unsafe { ops.malloc_enclosing_size_of(t) })
|
// 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 {
|
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||||
// See the implementation for std::collections::HashSet for details.
|
// 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>
|
impl<K, V, S> MallocShallowSizeOf for hashglobe::hash_map::HashMap<K, V, S>
|
||||||
where K: Eq + Hash,
|
where K: Eq + Hash,
|
||||||
S: BuildHasher
|
S: BuildHasher
|
||||||
{
|
{
|
||||||
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||||
// See the implementation for std::collections::HashSet for details.
|
// 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
|
// 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.
|
// trait bounds are ever allowed, this code should be uncommented.
|
||||||
// (We do have a compile-fail test for this:
|
// (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> {
|
impl<T: MallocSizeOf, U> MallocSizeOf for euclid::TypedSize2D<T, U> {
|
||||||
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||||
self.width.size_of(ops) + self.height.size_of(ops)
|
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.
|
/// For use on types where size_of() returns 0.
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! malloc_size_of_is_0(
|
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!(i8, i16, i32, i64, isize);
|
||||||
malloc_size_of_is_0!(f32, f64);
|
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<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<i8>, Range<i16>, Range<i32>, Range<i64>, Range<isize>);
|
||||||
malloc_size_of_is_0!(Range<f32>, Range<f64>);
|
malloc_size_of_is_0!(Range<f32>, Range<f64>);
|
||||||
|
|
||||||
malloc_size_of_is_0!(app_units::Au);
|
malloc_size_of_is_0!(app_units::Au);
|
||||||
|
|
||||||
malloc_size_of_is_0!(cssparser::RGBA, cssparser::TokenSerializationType);
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -14,8 +14,8 @@ unstable = ["nonzero/unstable"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bitflags = "0.7"
|
bitflags = "0.7"
|
||||||
heapsize = "0.4"
|
malloc_size_of = { path = "../malloc_size_of" }
|
||||||
heapsize_derive = "0.1"
|
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||||
nonzero = {path = "../nonzero"}
|
nonzero = {path = "../nonzero"}
|
||||||
serde = "1.0.14"
|
serde = "1.0.14"
|
||||||
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
|
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
|
||||||
|
|
|
@ -18,7 +18,7 @@ pub enum KeyState {
|
||||||
}
|
}
|
||||||
|
|
||||||
//N.B. Based on the glutin key enum
|
//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 {
|
pub enum Key {
|
||||||
Space,
|
Space,
|
||||||
Apostrophe,
|
Apostrophe,
|
||||||
|
@ -217,14 +217,14 @@ impl PipelineNamespace {
|
||||||
|
|
||||||
thread_local!(pub static PIPELINE_NAMESPACE: Cell<Option<PipelineNamespace>> = Cell::new(None));
|
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);
|
pub struct PipelineNamespaceId(pub u32);
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
|
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
|
||||||
pub struct PipelineIndex(pub NonZero<u32>);
|
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 struct PipelineId {
|
||||||
pub namespace_id: PipelineNamespaceId,
|
pub namespace_id: PipelineNamespaceId,
|
||||||
pub index: PipelineIndex
|
pub index: PipelineIndex
|
||||||
|
@ -276,9 +276,9 @@ impl fmt::Display for PipelineId {
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
|
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
|
||||||
pub struct BrowsingContextIndex(pub NonZero<u32>);
|
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 struct BrowsingContextId {
|
||||||
pub namespace_id: PipelineNamespaceId,
|
pub namespace_id: PipelineNamespaceId,
|
||||||
pub index: BrowsingContextIndex,
|
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));
|
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);
|
pub struct TopLevelBrowsingContextId(BrowsingContextId);
|
||||||
|
|
||||||
impl TopLevelBrowsingContextId {
|
impl TopLevelBrowsingContextId {
|
||||||
|
@ -362,7 +362,7 @@ pub const TEST_BROWSING_CONTEXT_INDEX: BrowsingContextIndex =
|
||||||
pub const TEST_BROWSING_CONTEXT_ID: BrowsingContextId =
|
pub const TEST_BROWSING_CONTEXT_ID: BrowsingContextId =
|
||||||
BrowsingContextId { namespace_id: TEST_NAMESPACE, index: TEST_BROWSING_CONTEXT_INDEX };
|
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 {
|
pub enum FrameType {
|
||||||
IFrame,
|
IFrame,
|
||||||
MozBrowserIFrame,
|
MozBrowserIFrame,
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate bitflags;
|
extern crate bitflags;
|
||||||
#[macro_use] extern crate heapsize;
|
#[macro_use] extern crate malloc_size_of;
|
||||||
#[macro_use] extern crate heapsize_derive;
|
#[macro_use] extern crate malloc_size_of_derive;
|
||||||
extern crate nonzero;
|
extern crate nonzero;
|
||||||
#[macro_use] extern crate serde;
|
#[macro_use] extern crate serde;
|
||||||
extern crate webrender_api;
|
extern crate webrender_api;
|
||||||
|
|
|
@ -38,7 +38,7 @@ servo-websocket = "0.19"
|
||||||
threadpool = "1.0"
|
threadpool = "1.0"
|
||||||
time = "0.1.17"
|
time = "0.1.17"
|
||||||
unicase = "1.4.0"
|
unicase = "1.4.0"
|
||||||
url = {version = "1.2", features = ["heap_size"]}
|
url = "1.2"
|
||||||
uuid = {version = "0.5", features = ["v4"]}
|
uuid = {version = "0.5", features = ["v4"]}
|
||||||
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
|
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
|
||||||
|
|
||||||
|
|
|
@ -11,19 +11,19 @@ path = "lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cookie = "0.6"
|
cookie = "0.6"
|
||||||
heapsize = "0.4"
|
|
||||||
heapsize_derive = "0.1"
|
|
||||||
hyper = "0.10"
|
hyper = "0.10"
|
||||||
hyper_serde = "0.7"
|
hyper_serde = "0.7"
|
||||||
image = "0.16"
|
image = "0.16"
|
||||||
ipc-channel = "0.9"
|
ipc-channel = "0.9"
|
||||||
lazy_static = "0.2"
|
lazy_static = "0.2"
|
||||||
log = "0.3.5"
|
log = "0.3.5"
|
||||||
|
malloc_size_of = { path = "../malloc_size_of" }
|
||||||
|
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||||
msg = {path = "../msg"}
|
msg = {path = "../msg"}
|
||||||
num-traits = "0.1.32"
|
num-traits = "0.1.32"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
servo_config = {path = "../config"}
|
servo_config = {path = "../config"}
|
||||||
servo_url = {path = "../url"}
|
servo_url = {path = "../url"}
|
||||||
url = {version = "1.2", features = ["heap_size"]}
|
url = "1.2"
|
||||||
uuid = {version = "0.5", features = ["v4", "serde"]}
|
uuid = {version = "0.5", features = ["v4", "serde"]}
|
||||||
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
|
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
|
||||||
|
|
|
@ -7,7 +7,7 @@ use piston_image::{self, DynamicImage, ImageFormat};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use webrender_api;
|
use webrender_api;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, HeapSizeOf, PartialEq, Serialize)]
|
#[derive(Clone, Copy, Debug, Deserialize, Eq, MallocSizeOf, PartialEq, Serialize)]
|
||||||
pub enum PixelFormat {
|
pub enum PixelFormat {
|
||||||
/// Luminance channel only
|
/// Luminance channel only
|
||||||
K8,
|
K8,
|
||||||
|
@ -19,14 +19,14 @@ pub enum PixelFormat {
|
||||||
BGRA8,
|
BGRA8,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct Image {
|
pub struct Image {
|
||||||
pub width: u32,
|
pub width: u32,
|
||||||
pub height: u32,
|
pub height: u32,
|
||||||
pub format: PixelFormat,
|
pub format: PixelFormat,
|
||||||
#[ignore_heap_size_of = "Defined in ipc-channel"]
|
#[ignore_malloc_size_of = "Defined in ipc-channel"]
|
||||||
pub bytes: IpcSharedMemory,
|
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>,
|
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 struct ImageMetadata {
|
||||||
pub width: u32,
|
pub width: u32,
|
||||||
pub height: u32,
|
pub height: u32,
|
||||||
|
|
|
@ -23,9 +23,9 @@ pub enum CanRequestImages {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Indicating either entire image or just metadata availability
|
/// Indicating either entire image or just metadata availability
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub enum ImageOrMetadataAvailable {
|
pub enum ImageOrMetadataAvailable {
|
||||||
ImageAvailable(Arc<Image>, ServoUrl),
|
ImageAvailable(#[ignore_malloc_size_of = "Arc"] Arc<Image>, ServoUrl),
|
||||||
MetadataAvailable(ImageMetadata),
|
MetadataAvailable(ImageMetadata),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,14 +60,14 @@ impl ImageResponder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The returned image.
|
/// The returned image.
|
||||||
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub enum ImageResponse {
|
pub enum ImageResponse {
|
||||||
/// The requested image was loaded.
|
/// The requested image was loaded.
|
||||||
Loaded(Arc<Image>, ServoUrl),
|
Loaded(#[ignore_malloc_size_of = "Arc"] Arc<Image>, ServoUrl),
|
||||||
/// The request image metadata was loaded.
|
/// The request image metadata was loaded.
|
||||||
MetadataLoaded(ImageMetadata),
|
MetadataLoaded(ImageMetadata),
|
||||||
/// The requested image failed to load, so a placeholder was loaded instead.
|
/// 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.
|
/// Neither the requested image nor the placeholder could be loaded.
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ pub enum ImageState {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The unique id for an image that has previously been requested.
|
/// 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);
|
pub struct PendingImageId(pub u64);
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
|
|
||||||
extern crate cookie as cookie_rs;
|
extern crate cookie as cookie_rs;
|
||||||
extern crate heapsize;
|
|
||||||
#[macro_use] extern crate heapsize_derive;
|
|
||||||
extern crate hyper;
|
extern crate hyper;
|
||||||
extern crate hyper_serde;
|
extern crate hyper_serde;
|
||||||
extern crate image as piston_image;
|
extern crate image as piston_image;
|
||||||
extern crate ipc_channel;
|
extern crate ipc_channel;
|
||||||
#[macro_use] extern crate lazy_static;
|
#[macro_use] extern crate lazy_static;
|
||||||
#[macro_use] extern crate log;
|
#[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 msg;
|
||||||
extern crate num_traits;
|
extern crate num_traits;
|
||||||
#[macro_use] extern crate serde;
|
#[macro_use] extern crate serde;
|
||||||
|
@ -25,7 +25,6 @@ extern crate webrender_api;
|
||||||
|
|
||||||
use cookie_rs::Cookie;
|
use cookie_rs::Cookie;
|
||||||
use filemanager_thread::FileManagerThreadMsg;
|
use filemanager_thread::FileManagerThreadMsg;
|
||||||
use heapsize::HeapSizeOf;
|
|
||||||
use hyper::Error as HyperError;
|
use hyper::Error as HyperError;
|
||||||
use hyper::header::{ContentType, Headers, ReferrerPolicy as ReferrerPolicyHeader};
|
use hyper::header::{ContentType, Headers, ReferrerPolicy as ReferrerPolicyHeader};
|
||||||
use hyper::http::RawStatus;
|
use hyper::http::RawStatus;
|
||||||
|
@ -60,7 +59,7 @@ pub mod image {
|
||||||
|
|
||||||
/// A loading context, for context-specific sniffing, as defined in
|
/// A loading context, for context-specific sniffing, as defined in
|
||||||
/// <https://mimesniff.spec.whatwg.org/#context-specific-sniffing>
|
/// <https://mimesniff.spec.whatwg.org/#context-specific-sniffing>
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub enum LoadContext {
|
pub enum LoadContext {
|
||||||
Browsing,
|
Browsing,
|
||||||
Image,
|
Image,
|
||||||
|
@ -73,13 +72,13 @@ pub enum LoadContext {
|
||||||
CacheManifest,
|
CacheManifest,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct CustomResponse {
|
pub struct CustomResponse {
|
||||||
#[ignore_heap_size_of = "Defined in hyper"]
|
#[ignore_malloc_size_of = "Defined in hyper"]
|
||||||
#[serde(deserialize_with = "::hyper_serde::deserialize",
|
#[serde(deserialize_with = "::hyper_serde::deserialize",
|
||||||
serialize_with = "::hyper_serde::serialize")]
|
serialize_with = "::hyper_serde::serialize")]
|
||||||
pub headers: Headers,
|
pub headers: Headers,
|
||||||
#[ignore_heap_size_of = "Defined in hyper"]
|
#[ignore_malloc_size_of = "Defined in hyper"]
|
||||||
#[serde(deserialize_with = "::hyper_serde::deserialize",
|
#[serde(deserialize_with = "::hyper_serde::deserialize",
|
||||||
serialize_with = "::hyper_serde::serialize")]
|
serialize_with = "::hyper_serde::serialize")]
|
||||||
pub raw_status: RawStatus,
|
pub raw_status: RawStatus,
|
||||||
|
@ -104,7 +103,7 @@ pub struct CustomResponseMediator {
|
||||||
|
|
||||||
/// [Policies](https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-states)
|
/// [Policies](https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-states)
|
||||||
/// for providing a referrer header for a request
|
/// 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 {
|
pub enum ReferrerPolicy {
|
||||||
/// "no-referrer"
|
/// "no-referrer"
|
||||||
NoReferrer,
|
NoReferrer,
|
||||||
|
@ -310,11 +309,7 @@ impl IpcSend<StorageThreadMsg> for ResourceThreads {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore the sub-fields
|
// Ignore the sub-fields
|
||||||
impl HeapSizeOf for ResourceThreads {
|
malloc_size_of_is_0!(ResourceThreads);
|
||||||
fn heap_size_of_children(&self) -> usize {
|
|
||||||
0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Deserialize, PartialEq, Serialize)]
|
#[derive(Clone, Copy, Deserialize, PartialEq, Serialize)]
|
||||||
pub enum IncludeSubdomains {
|
pub enum IncludeSubdomains {
|
||||||
|
@ -322,7 +317,7 @@ pub enum IncludeSubdomains {
|
||||||
NotIncluded,
|
NotIncluded,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub enum MessageData {
|
pub enum MessageData {
|
||||||
Text(String),
|
Text(String),
|
||||||
Binary(Vec<u8>),
|
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();
|
core_resource_thread.send(CoreResourceMsg::Fetch(request, action_sender)).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct ResourceCorsData {
|
pub struct ResourceCorsData {
|
||||||
/// CORS Preflight flag
|
/// CORS Preflight flag
|
||||||
pub preflight: bool,
|
pub preflight: bool,
|
||||||
|
@ -404,7 +399,7 @@ pub struct ResourceCorsData {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Metadata about a loaded resource, such as is obtained from HTTP headers.
|
/// 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 {
|
pub struct Metadata {
|
||||||
/// Final URL after redirects.
|
/// Final URL after redirects.
|
||||||
pub final_url: ServoUrl,
|
pub final_url: ServoUrl,
|
||||||
|
@ -412,14 +407,14 @@ pub struct Metadata {
|
||||||
/// Location URL from the response headers.
|
/// Location URL from the response headers.
|
||||||
pub location_url: Option<Result<ServoUrl, String>>,
|
pub location_url: Option<Result<ServoUrl, String>>,
|
||||||
|
|
||||||
#[ignore_heap_size_of = "Defined in hyper"]
|
#[ignore_malloc_size_of = "Defined in hyper"]
|
||||||
/// MIME type / subtype.
|
/// MIME type / subtype.
|
||||||
pub content_type: Option<Serde<ContentType>>,
|
pub content_type: Option<Serde<ContentType>>,
|
||||||
|
|
||||||
/// Character set.
|
/// Character set.
|
||||||
pub charset: Option<String>,
|
pub charset: Option<String>,
|
||||||
|
|
||||||
#[ignore_heap_size_of = "Defined in hyper"]
|
#[ignore_malloc_size_of = "Defined in hyper"]
|
||||||
/// Headers
|
/// Headers
|
||||||
pub headers: Option<Serde<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
|
/// 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);
|
pub struct ResourceId(pub u32);
|
||||||
|
|
||||||
/// Network errors that have to be exported out of the loaders
|
/// 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 {
|
pub enum NetworkError {
|
||||||
/// Could be any of the internal errors, like unsupported scheme, connection errors, etc.
|
/// Could be any of the internal errors, like unsupported scheme, connection errors, etc.
|
||||||
Internal(String),
|
Internal(String),
|
||||||
|
|
|
@ -10,7 +10,7 @@ use servo_url::{ImmutableOrigin, ServoUrl};
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
|
|
||||||
/// An [initiator](https://fetch.spec.whatwg.org/#concept-request-initiator)
|
/// An [initiator](https://fetch.spec.whatwg.org/#concept-request-initiator)
|
||||||
#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
|
#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
|
||||||
pub enum Initiator {
|
pub enum Initiator {
|
||||||
None,
|
None,
|
||||||
Download,
|
Download,
|
||||||
|
@ -20,7 +20,7 @@ pub enum Initiator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A request [type](https://fetch.spec.whatwg.org/#concept-request-type)
|
/// 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 {
|
pub enum Type {
|
||||||
None,
|
None,
|
||||||
Audio,
|
Audio,
|
||||||
|
@ -33,7 +33,7 @@ pub enum Type {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A request [destination](https://fetch.spec.whatwg.org/#concept-request-destination)
|
/// 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 {
|
pub enum Destination {
|
||||||
None,
|
None,
|
||||||
Document,
|
Document,
|
||||||
|
@ -53,14 +53,14 @@ pub enum Destination {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A request [origin](https://fetch.spec.whatwg.org/#concept-request-origin)
|
/// 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 {
|
pub enum Origin {
|
||||||
Client,
|
Client,
|
||||||
Origin(ImmutableOrigin),
|
Origin(ImmutableOrigin),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A [referer](https://fetch.spec.whatwg.org/#concept-request-referrer)
|
/// 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 {
|
pub enum Referrer {
|
||||||
NoReferrer,
|
NoReferrer,
|
||||||
/// Default referrer if nothing is specified
|
/// Default referrer if nothing is specified
|
||||||
|
@ -69,7 +69,7 @@ pub enum Referrer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A [request mode](https://fetch.spec.whatwg.org/#concept-request-mode)
|
/// 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 {
|
pub enum RequestMode {
|
||||||
Navigate,
|
Navigate,
|
||||||
SameOrigin,
|
SameOrigin,
|
||||||
|
@ -79,7 +79,7 @@ pub enum RequestMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Request [credentials mode](https://fetch.spec.whatwg.org/#concept-request-credentials-mode)
|
/// 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 {
|
pub enum CredentialsMode {
|
||||||
Omit,
|
Omit,
|
||||||
CredentialsSameOrigin,
|
CredentialsSameOrigin,
|
||||||
|
@ -87,7 +87,7 @@ pub enum CredentialsMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [Cache mode](https://fetch.spec.whatwg.org/#concept-request-cache-mode)
|
/// [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 {
|
pub enum CacheMode {
|
||||||
Default,
|
Default,
|
||||||
NoStore,
|
NoStore,
|
||||||
|
@ -98,7 +98,7 @@ pub enum CacheMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [Service-workers mode](https://fetch.spec.whatwg.org/#request-service-workers-mode)
|
/// [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 {
|
pub enum ServiceWorkersMode {
|
||||||
All,
|
All,
|
||||||
Foreign,
|
Foreign,
|
||||||
|
@ -106,7 +106,7 @@ pub enum ServiceWorkersMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [Redirect mode](https://fetch.spec.whatwg.org/#concept-request-redirect-mode)
|
/// [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 {
|
pub enum RedirectMode {
|
||||||
Follow,
|
Follow,
|
||||||
Error,
|
Error,
|
||||||
|
@ -114,7 +114,7 @@ pub enum RedirectMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [Response tainting](https://fetch.spec.whatwg.org/#concept-request-response-tainting)
|
/// [Response tainting](https://fetch.spec.whatwg.org/#concept-request-response-tainting)
|
||||||
#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
|
#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
|
||||||
pub enum ResponseTainting {
|
pub enum ResponseTainting {
|
||||||
Basic,
|
Basic,
|
||||||
CorsTainting,
|
CorsTainting,
|
||||||
|
@ -122,7 +122,7 @@ pub enum ResponseTainting {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [Window](https://fetch.spec.whatwg.org/#concept-request-window)
|
/// [Window](https://fetch.spec.whatwg.org/#concept-request-window)
|
||||||
#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
|
#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
|
||||||
pub enum Window {
|
pub enum Window {
|
||||||
NoWindow,
|
NoWindow,
|
||||||
Client, // TODO: Environmental settings object
|
Client, // TODO: Environmental settings object
|
||||||
|
@ -135,16 +135,16 @@ pub enum CorsSettings {
|
||||||
UseCredentials,
|
UseCredentials,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct RequestInit {
|
pub struct RequestInit {
|
||||||
#[serde(deserialize_with = "::hyper_serde::deserialize",
|
#[serde(deserialize_with = "::hyper_serde::deserialize",
|
||||||
serialize_with = "::hyper_serde::serialize")]
|
serialize_with = "::hyper_serde::serialize")]
|
||||||
#[ignore_heap_size_of = "Defined in hyper"]
|
#[ignore_malloc_size_of = "Defined in hyper"]
|
||||||
pub method: Method,
|
pub method: Method,
|
||||||
pub url: ServoUrl,
|
pub url: ServoUrl,
|
||||||
#[serde(deserialize_with = "::hyper_serde::deserialize",
|
#[serde(deserialize_with = "::hyper_serde::deserialize",
|
||||||
serialize_with = "::hyper_serde::serialize")]
|
serialize_with = "::hyper_serde::serialize")]
|
||||||
#[ignore_heap_size_of = "Defined in hyper"]
|
#[ignore_malloc_size_of = "Defined in hyper"]
|
||||||
pub headers: Headers,
|
pub headers: Headers,
|
||||||
pub unsafe_request: bool,
|
pub unsafe_request: bool,
|
||||||
pub body: Option<Vec<u8>>,
|
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
|
/// A [Request](https://fetch.spec.whatwg.org/#concept-request) as defined by
|
||||||
/// the Fetch spec.
|
/// the Fetch spec.
|
||||||
#[derive(Clone, HeapSizeOf)]
|
#[derive(Clone, MallocSizeOf)]
|
||||||
pub struct Request {
|
pub struct Request {
|
||||||
/// <https://fetch.spec.whatwg.org/#concept-request-method>
|
/// <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,
|
pub method: Method,
|
||||||
/// <https://fetch.spec.whatwg.org/#local-urls-only-flag>
|
/// <https://fetch.spec.whatwg.org/#local-urls-only-flag>
|
||||||
pub local_urls_only: bool,
|
pub local_urls_only: bool,
|
||||||
/// <https://fetch.spec.whatwg.org/#sandboxed-storage-area-urls-flag>
|
/// <https://fetch.spec.whatwg.org/#sandboxed-storage-area-urls-flag>
|
||||||
pub sandboxed_storage_area_urls: bool,
|
pub sandboxed_storage_area_urls: bool,
|
||||||
/// <https://fetch.spec.whatwg.org/#concept-request-header-list>
|
/// <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,
|
pub headers: Headers,
|
||||||
/// <https://fetch.spec.whatwg.org/#unsafe-request-flag>
|
/// <https://fetch.spec.whatwg.org/#unsafe-request-flag>
|
||||||
pub unsafe_request: bool,
|
pub unsafe_request: bool,
|
||||||
|
|
|
@ -13,7 +13,7 @@ use std::ascii::AsciiExt;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
/// [Response type](https://fetch.spec.whatwg.org/#concept-response-type)
|
/// [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 {
|
pub enum ResponseType {
|
||||||
Basic,
|
Basic,
|
||||||
Cors,
|
Cors,
|
||||||
|
@ -24,7 +24,7 @@ pub enum ResponseType {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [Response termination reason](https://fetch.spec.whatwg.org/#concept-response-termination-reason)
|
/// [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 {
|
pub enum TerminationReason {
|
||||||
EndUserAbort,
|
EndUserAbort,
|
||||||
Fatal,
|
Fatal,
|
||||||
|
@ -33,7 +33,7 @@ pub enum TerminationReason {
|
||||||
|
|
||||||
/// The response body can still be pushed to after fetch
|
/// The response body can still be pushed to after fetch
|
||||||
/// This provides a way to store unfinished response bodies
|
/// This provides a way to store unfinished response bodies
|
||||||
#[derive(Clone, Debug, HeapSizeOf, PartialEq)]
|
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
|
||||||
pub enum ResponseBody {
|
pub enum ResponseBody {
|
||||||
Empty, // XXXManishearth is this necessary, or is Done(vec![]) enough?
|
Empty, // XXXManishearth is this necessary, or is Done(vec![]) enough?
|
||||||
Receiving(Vec<u8>),
|
Receiving(Vec<u8>),
|
||||||
|
@ -52,7 +52,7 @@ impl ResponseBody {
|
||||||
|
|
||||||
|
|
||||||
/// [Cache state](https://fetch.spec.whatwg.org/#concept-response-cache-state)
|
/// [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 {
|
pub enum CacheState {
|
||||||
None,
|
None,
|
||||||
Local,
|
Local,
|
||||||
|
@ -61,7 +61,7 @@ pub enum CacheState {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [Https state](https://fetch.spec.whatwg.org/#concept-response-https-state)
|
/// [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 {
|
pub enum HttpsState {
|
||||||
None,
|
None,
|
||||||
Deprecated,
|
Deprecated,
|
||||||
|
@ -74,31 +74,31 @@ pub enum ResponseMsg {
|
||||||
Errored,
|
Errored,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct ResponseInit {
|
pub struct ResponseInit {
|
||||||
pub url: ServoUrl,
|
pub url: ServoUrl,
|
||||||
#[serde(deserialize_with = "::hyper_serde::deserialize",
|
#[serde(deserialize_with = "::hyper_serde::deserialize",
|
||||||
serialize_with = "::hyper_serde::serialize")]
|
serialize_with = "::hyper_serde::serialize")]
|
||||||
#[ignore_heap_size_of = "Defined in hyper"]
|
#[ignore_malloc_size_of = "Defined in hyper"]
|
||||||
pub headers: Headers,
|
pub headers: Headers,
|
||||||
pub referrer: Option<ServoUrl>,
|
pub referrer: Option<ServoUrl>,
|
||||||
pub location_url: Option<Result<ServoUrl, String>>,
|
pub location_url: Option<Result<ServoUrl, String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A [Response](https://fetch.spec.whatwg.org/#concept-response) as defined by the Fetch spec
|
/// 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 struct Response {
|
||||||
pub response_type: ResponseType,
|
pub response_type: ResponseType,
|
||||||
pub termination_reason: Option<TerminationReason>,
|
pub termination_reason: Option<TerminationReason>,
|
||||||
url: Option<ServoUrl>,
|
url: Option<ServoUrl>,
|
||||||
pub url_list: Vec<ServoUrl>,
|
pub url_list: Vec<ServoUrl>,
|
||||||
/// `None` can be considered a StatusCode of `0`.
|
/// `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 status: Option<StatusCode>,
|
||||||
pub raw_status: Option<(u16, Vec<u8>)>,
|
pub raw_status: Option<(u16, Vec<u8>)>,
|
||||||
#[ignore_heap_size_of = "Defined in hyper"]
|
#[ignore_malloc_size_of = "Defined in hyper"]
|
||||||
pub headers: Headers,
|
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 body: Arc<Mutex<ResponseBody>>,
|
||||||
pub cache_state: CacheState,
|
pub cache_state: CacheState,
|
||||||
pub https_state: HttpsState,
|
pub https_state: HttpsState,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Copy, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub enum StorageType {
|
pub enum StorageType {
|
||||||
Session,
|
Session,
|
||||||
Local,
|
Local,
|
||||||
|
|
|
@ -79,7 +79,7 @@ impl ProfilerChan {
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub enum ReportKind {
|
pub enum ReportKind {
|
||||||
/// A size measurement for an explicit allocation on the jemalloc heap. This should be used
|
/// 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,
|
ExplicitJemallocHeapSize,
|
||||||
|
|
||||||
/// A size measurement for an explicit allocation on the system heap. Only likely to be used
|
/// A size measurement for an explicit allocation on the system heap. Only likely to be used
|
||||||
|
|
|
@ -11,7 +11,7 @@ name = "range"
|
||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
heapsize = "0.4"
|
malloc_size_of = { path = "../malloc_size_of" }
|
||||||
heapsize_derive = "0.1"
|
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||||
num-traits = "0.1.32"
|
num-traits = "0.1.32"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
|
|
||||||
extern crate heapsize;
|
extern crate malloc_size_of;
|
||||||
#[macro_use] extern crate heapsize_derive;
|
#[macro_use] extern crate malloc_size_of_derive;
|
||||||
extern crate num_traits;
|
extern crate num_traits;
|
||||||
#[macro_use] extern crate serde;
|
#[macro_use] extern crate serde;
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ macro_rules! int_range_index {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A range of indices
|
/// A range of indices
|
||||||
#[derive(Clone, Copy, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Copy, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct Range<I> {
|
pub struct Range<I> {
|
||||||
begin: I,
|
begin: I,
|
||||||
length: I,
|
length: I,
|
||||||
|
|
|
@ -44,9 +44,7 @@ euclid = "0.15"
|
||||||
fnv = "1.0"
|
fnv = "1.0"
|
||||||
gleam = "0.4"
|
gleam = "0.4"
|
||||||
half = "1.0"
|
half = "1.0"
|
||||||
heapsize = "0.4"
|
html5ever = "0.20"
|
||||||
heapsize_derive = "0.1"
|
|
||||||
html5ever = {version = "0.20", features = ["heap_size"]}
|
|
||||||
hyper = "0.10"
|
hyper = "0.10"
|
||||||
hyper_serde = "0.7"
|
hyper_serde = "0.7"
|
||||||
image = "0.16"
|
image = "0.16"
|
||||||
|
@ -56,6 +54,8 @@ jstraceable_derive = {path = "../jstraceable_derive"}
|
||||||
lazy_static = "0.2"
|
lazy_static = "0.2"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
log = "0.3.5"
|
log = "0.3.5"
|
||||||
|
malloc_size_of = { path = "../malloc_size_of" }
|
||||||
|
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||||
metrics = {path = "../metrics"}
|
metrics = {path = "../metrics"}
|
||||||
mitochondria = "1.1.2"
|
mitochondria = "1.1.2"
|
||||||
mime = "0.2.1"
|
mime = "0.2.1"
|
||||||
|
@ -89,7 +89,7 @@ style_traits = {path = "../style_traits"}
|
||||||
swapper = "0.1"
|
swapper = "0.1"
|
||||||
time = "0.1.12"
|
time = "0.1.12"
|
||||||
unicode-segmentation = "1.1.0"
|
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"
|
utf-8 = "0.7"
|
||||||
uuid = {version = "0.5", features = ["v4"]}
|
uuid = {version = "0.5", features = ["v4"]}
|
||||||
xml5ever = {version = "0.10"}
|
xml5ever = {version = "0.10"}
|
||||||
|
|
|
@ -22,7 +22,7 @@ use std::rc::Rc;
|
||||||
use std::str;
|
use std::str;
|
||||||
use url::form_urlencoded;
|
use url::form_urlencoded;
|
||||||
|
|
||||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable)]
|
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
|
||||||
pub enum BodyType {
|
pub enum BodyType {
|
||||||
Blob,
|
Blob,
|
||||||
FormData,
|
FormData,
|
||||||
|
|
|
@ -14,7 +14,7 @@ use net_traits::request::RequestInit;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
#[derive(Clone, Debug, HeapSizeOf, JSTraceable, PartialEq)]
|
#[derive(Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
|
||||||
pub enum LoadType {
|
pub enum LoadType {
|
||||||
Image(ServoUrl),
|
Image(ServoUrl),
|
||||||
Script(ServoUrl),
|
Script(ServoUrl),
|
||||||
|
@ -40,7 +40,7 @@ impl LoadType {
|
||||||
/// Canary value ensuring that manually added blocking loads (ie. ones that weren't
|
/// Canary value ensuring that manually added blocking loads (ie. ones that weren't
|
||||||
/// created via DocumentLoader::fetch_async) are always removed by the time
|
/// created via DocumentLoader::fetch_async) are always removed by the time
|
||||||
/// that the owner is destroyed.
|
/// that the owner is destroyed.
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
pub struct LoadBlocker {
|
pub struct LoadBlocker {
|
||||||
/// The document whose load event is blocked by this object existing.
|
/// 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 {
|
pub struct DocumentLoader {
|
||||||
resource_threads: ResourceThreads,
|
resource_threads: ResourceThreads,
|
||||||
blocking_loads: Vec<LoadType>,
|
blocking_loads: Vec<LoadType>,
|
||||||
|
|
|
@ -11,7 +11,7 @@ use style::thread_state;
|
||||||
///
|
///
|
||||||
/// This extends the API of `std::cell::RefCell` to allow unsafe access in
|
/// This extends the API of `std::cell::RefCell` to allow unsafe access in
|
||||||
/// certain situations, with dynamic checking in debug builds.
|
/// certain situations, with dynamic checking in debug builds.
|
||||||
#[derive(Clone, Debug, Default, HeapSizeOf, PartialEq)]
|
#[derive(Clone, Debug, Default, MallocSizeOf, PartialEq)]
|
||||||
pub struct DomRefCell<T> {
|
pub struct DomRefCell<T> {
|
||||||
value: RefCell<T>,
|
value: RefCell<T>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -2029,7 +2029,7 @@ def DOMClass(descriptor):
|
||||||
# padding.
|
# padding.
|
||||||
protoList.extend(['PrototypeList::ID::Last'] * (descriptor.config.maxProtoChainLength - len(protoList)))
|
protoList.extend(['PrototypeList::ID::Last'] * (descriptor.config.maxProtoChainLength - len(protoList)))
|
||||||
prototypeChainString = ', '.join(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():
|
if descriptor.isGlobal():
|
||||||
globals_ = camel_to_upper_snake(descriptor.name)
|
globals_ = camel_to_upper_snake(descriptor.name)
|
||||||
else:
|
else:
|
||||||
|
@ -2038,9 +2038,9 @@ def DOMClass(descriptor):
|
||||||
DOMClass {
|
DOMClass {
|
||||||
interface_chain: [ %s ],
|
interface_chain: [ %s ],
|
||||||
type_id: %s,
|
type_id: %s,
|
||||||
heap_size_of: %s as unsafe fn(_) -> _,
|
malloc_size_of: %s as unsafe fn(&mut _, _) -> _,
|
||||||
global: InterfaceObjectMap::%s,
|
global: InterfaceObjectMap::%s,
|
||||||
}""" % (prototypeChainString, DOMClassTypeId(descriptor), heapSizeOf, globals_)
|
}""" % (prototypeChainString, DOMClassTypeId(descriptor), mallocSizeOf, globals_)
|
||||||
|
|
||||||
|
|
||||||
class CGDOMJSClass(CGThing):
|
class CGDOMJSClass(CGThing):
|
||||||
|
@ -4005,7 +4005,7 @@ class CGEnum(CGThing):
|
||||||
ident = enum.identifier.name
|
ident = enum.identifier.name
|
||||||
decl = """\
|
decl = """\
|
||||||
#[repr(usize)]
|
#[repr(usize)]
|
||||||
#[derive(JSTraceable, PartialEq, Copy, Clone, HeapSizeOf, Debug)]
|
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
|
||||||
pub enum %s {
|
pub enum %s {
|
||||||
%s
|
%s
|
||||||
}
|
}
|
||||||
|
@ -5794,7 +5794,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
|
||||||
'dom::bindings::weakref::WeakReferenceable',
|
'dom::bindings::weakref::WeakReferenceable',
|
||||||
'dom::windowproxy::WindowProxy',
|
'dom::windowproxy::WindowProxy',
|
||||||
'dom::globalscope::GlobalScope',
|
'dom::globalscope::GlobalScope',
|
||||||
'mem::heap_size_of_raw_self_and_children',
|
'mem::malloc_size_of_including_raw_self',
|
||||||
'libc',
|
'libc',
|
||||||
'servo_config::prefs::PREFS',
|
'servo_config::prefs::PREFS',
|
||||||
'std::borrow::ToOwned',
|
'std::borrow::ToOwned',
|
||||||
|
|
|
@ -25,7 +25,7 @@ use libc::c_uint;
|
||||||
use std::slice::from_raw_parts;
|
use std::slice::from_raw_parts;
|
||||||
|
|
||||||
/// DOM exceptions that can be thrown by a native DOM method.
|
/// DOM exceptions that can be thrown by a native DOM method.
|
||||||
#[derive(Clone, Debug, HeapSizeOf)]
|
#[derive(Clone, Debug, MallocSizeOf)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// IndexSizeError DOMException
|
/// IndexSizeError DOMException
|
||||||
IndexSize,
|
IndexSize,
|
||||||
|
|
|
@ -22,7 +22,7 @@ use std::cell::Cell;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
/// The values that an iterator will iterate over.
|
/// The values that an iterator will iterate over.
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
pub enum IteratorType {
|
pub enum IteratorType {
|
||||||
/// The keys of the iterable object.
|
/// The keys of the iterable object.
|
||||||
Keys,
|
Keys,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
//! The `Finite<T>` struct.
|
//! The `Finite<T>` struct.
|
||||||
|
|
||||||
use heapsize::HeapSizeOf;
|
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||||
use num_traits::Float;
|
use num_traits::Float;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
@ -41,9 +41,9 @@ impl<T: Float> Deref for Finite<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Float + HeapSizeOf> HeapSizeOf for Finite<T> {
|
impl<T: Float + MallocSizeOf> MallocSizeOf for Finite<T> {
|
||||||
fn heap_size_of_children(&self) -> usize {
|
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||||
(**self).heap_size_of_children()
|
(**self).size_of(ops)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,11 +27,11 @@ pub fn reflect_dom_object<T, U>(
|
||||||
|
|
||||||
/// A struct to store a reference to the reflector of a DOM object.
|
/// A struct to store a reference to the reflector of a DOM object.
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
#[derive(HeapSizeOf)]
|
#[derive(MallocSizeOf)]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
// If you're renaming or moving this field, update the path in plugins::reflector as well
|
// If you're renaming or moving this field, update the path in plugins::reflector as well
|
||||||
pub struct Reflector {
|
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>,
|
object: Heap<*mut JSObject>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,9 @@ use dom::bindings::reflector::{DomObject, Reflector};
|
||||||
use dom::bindings::trace::JSTraceable;
|
use dom::bindings::trace::JSTraceable;
|
||||||
use dom::bindings::trace::trace_reflector;
|
use dom::bindings::trace::trace_reflector;
|
||||||
use dom::node::Node;
|
use dom::node::Node;
|
||||||
use heapsize::HeapSizeOf;
|
|
||||||
use js::jsapi::{JSObject, JSTracer, Heap};
|
use js::jsapi::{JSObject, JSTracer, Heap};
|
||||||
use js::rust::GCMethods;
|
use js::rust::GCMethods;
|
||||||
|
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||||
use mitochondria::OnceCell;
|
use mitochondria::OnceCell;
|
||||||
use nonzero::NonZero;
|
use nonzero::NonZero;
|
||||||
use script_layout_interface::TrustedNodeAddress;
|
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
|
where
|
||||||
T: DomObject + HeapSizeOf,
|
T: DomObject + MallocSizeOf,
|
||||||
{
|
{
|
||||||
fn heap_size_of_children(&self) -> usize {
|
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||||
(**self).heap_size_of_children()
|
(**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.
|
// 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.
|
// For now, we choose not to follow any such pointers.
|
||||||
impl<T> HeapSizeOf for Dom<T> {
|
impl<T> MallocSizeOf for Dom<T> {
|
||||||
fn heap_size_of_children(&self) -> usize {
|
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -516,9 +516,9 @@ impl<T: DomObject> MutDom<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: DomObject> HeapSizeOf for MutDom<T> {
|
impl<T: DomObject> MallocSizeOf for MutDom<T> {
|
||||||
fn heap_size_of_children(&self) -> usize {
|
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
|
||||||
// See comment on HeapSizeOf for Dom<T>.
|
// See comment on MallocSizeOf for Dom<T>.
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -635,9 +635,9 @@ impl<T: DomObject> Default for MutNullableDom<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: DomObject> HeapSizeOf for MutNullableDom<T> {
|
impl<T: DomObject> MallocSizeOf for MutNullableDom<T> {
|
||||||
fn heap_size_of_children(&self) -> usize {
|
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
|
||||||
// See comment on HeapSizeOf for Dom<T>.
|
// See comment on MallocSizeOf for Dom<T>.
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -678,9 +678,9 @@ impl<T: DomObject> Default for DomOnceCell<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: DomObject> HeapSizeOf for DomOnceCell<T> {
|
impl<T: DomObject> MallocSizeOf for DomOnceCell<T> {
|
||||||
fn heap_size_of_children(&self) -> usize {
|
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
|
||||||
// See comment on HeapSizeOf for Dom<T>.
|
// See comment on MallocSizeOf for Dom<T>.
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ use std::str;
|
||||||
use std::str::{Bytes, FromStr};
|
use std::str::{Bytes, FromStr};
|
||||||
|
|
||||||
/// Encapsulates the IDL `ByteString` type.
|
/// 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>);
|
pub struct ByteString(Vec<u8>);
|
||||||
|
|
||||||
impl ByteString {
|
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
|
/// A string that is constructed from a UCS-2 buffer by replacing invalid code
|
||||||
/// points with the replacement character.
|
/// points with the replacement character.
|
||||||
#[derive(Clone, Default, HeapSizeOf)]
|
#[derive(Clone, Default, MallocSizeOf)]
|
||||||
pub struct USVString(pub String);
|
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
|
/// This type is currently `!Send`, in order to help with an independent
|
||||||
/// experiment to store `JSString`s rather than Rust `String`s.
|
/// 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 ()>);
|
pub struct DOMString(String, PhantomData<*const ()>);
|
||||||
|
|
||||||
impl DOMString {
|
impl DOMString {
|
||||||
|
|
|
@ -13,7 +13,6 @@ use dom::bindings::inheritance::TopTypeId;
|
||||||
use dom::bindings::str::DOMString;
|
use dom::bindings::str::DOMString;
|
||||||
use dom::bindings::trace::trace_object;
|
use dom::bindings::trace::trace_object;
|
||||||
use dom::windowproxy;
|
use dom::windowproxy;
|
||||||
use heapsize::HeapSizeOf;
|
|
||||||
use js;
|
use js;
|
||||||
use js::JS_CALLEE;
|
use js::JS_CALLEE;
|
||||||
use js::glue::{CallJitGetterOp, CallJitMethodOp, CallJitSetterOp, IsWrapper};
|
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::jsval::{JSVal, UndefinedValue};
|
||||||
use js::rust::{GCMethods, ToString, get_object_class, is_dom_class};
|
use js::rust::{GCMethods, ToString, get_object_class, is_dom_class};
|
||||||
use libc;
|
use libc;
|
||||||
|
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
use std::os::raw::{c_char, c_void};
|
use std::os::raw::{c_char, c_void};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
@ -40,14 +40,14 @@ use std::slice;
|
||||||
/// Proxy handler for a WindowProxy.
|
/// Proxy handler for a WindowProxy.
|
||||||
pub struct WindowProxyHandler(pub *const libc::c_void);
|
pub struct WindowProxyHandler(pub *const libc::c_void);
|
||||||
|
|
||||||
impl HeapSizeOf for WindowProxyHandler {
|
impl MallocSizeOf for WindowProxyHandler {
|
||||||
fn heap_size_of_children(&self) -> usize {
|
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
|
||||||
// FIXME(#6907) this is a pointer to memory allocated by `new` in NewProxyHandler in rust-mozjs.
|
// FIXME(#6907) this is a pointer to memory allocated by `new` in NewProxyHandler in rust-mozjs.
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
/// Static data associated with a global object.
|
/// Static data associated with a global object.
|
||||||
pub struct GlobalStaticData {
|
pub struct GlobalStaticData {
|
||||||
/// The WindowProxy proxy handler for this global.
|
/// The WindowProxy proxy handler for this global.
|
||||||
|
@ -88,8 +88,8 @@ pub struct DOMClass {
|
||||||
/// The type ID of that interface.
|
/// The type ID of that interface.
|
||||||
pub type_id: TopTypeId,
|
pub type_id: TopTypeId,
|
||||||
|
|
||||||
/// The HeapSizeOf function wrapper for that interface.
|
/// The MallocSizeOf function wrapper for that interface.
|
||||||
pub heap_size_of: unsafe fn(*const c_void) -> usize,
|
pub malloc_size_of: unsafe fn(ops: &mut MallocSizeOfOps, *const c_void) -> usize,
|
||||||
|
|
||||||
/// The `Globals` flag for this global interface, if any.
|
/// The `Globals` flag for this global interface, if any.
|
||||||
pub global: InterfaceObjectMap::Globals,
|
pub global: InterfaceObjectMap::Globals,
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
use dom::bindings::reflector::DomObject;
|
use dom::bindings::reflector::DomObject;
|
||||||
use dom::bindings::root::DomRoot;
|
use dom::bindings::root::DomRoot;
|
||||||
use dom::bindings::trace::JSTraceable;
|
use dom::bindings::trace::JSTraceable;
|
||||||
use heapsize::HeapSizeOf;
|
|
||||||
use js::jsapi::{JSTracer, JS_GetReservedSlot, JS_SetReservedSlot};
|
use js::jsapi::{JSTracer, JS_GetReservedSlot, JS_SetReservedSlot};
|
||||||
use js::jsval::PrivateValue;
|
use js::jsval::PrivateValue;
|
||||||
use libc::c_void;
|
use libc::c_void;
|
||||||
|
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||||
use nonzero::NonZero;
|
use nonzero::NonZero;
|
||||||
use std::cell::{Cell, UnsafeCell};
|
use std::cell::{Cell, UnsafeCell};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
@ -110,8 +110,8 @@ impl<T: WeakReferenceable> Clone for WeakRef<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: WeakReferenceable> HeapSizeOf for WeakRef<T> {
|
impl<T: WeakReferenceable> MallocSizeOf for WeakRef<T> {
|
||||||
fn heap_size_of_children(&self) -> usize {
|
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,8 +188,8 @@ impl<T: WeakReferenceable> MutableWeakRef<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: WeakReferenceable> HeapSizeOf for MutableWeakRef<T> {
|
impl<T: WeakReferenceable> MallocSizeOf for MutableWeakRef<T> {
|
||||||
fn heap_size_of_children(&self) -> usize {
|
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ unsafe impl<T: WeakReferenceable> JSTraceable for MutableWeakRef<T> {
|
||||||
/// A vector of weak references. On tracing, the vector retains
|
/// A vector of weak references. On tracing, the vector retains
|
||||||
/// only references which still point to live objects.
|
/// only references which still point to live objects.
|
||||||
#[allow_unrooted_interior]
|
#[allow_unrooted_interior]
|
||||||
#[derive(HeapSizeOf)]
|
#[derive(MallocSizeOf)]
|
||||||
pub struct WeakRefVec<T: WeakReferenceable> {
|
pub struct WeakRefVec<T: WeakReferenceable> {
|
||||||
vec: Vec<WeakRef<T>>,
|
vec: Vec<WeakRef<T>>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ impl BlobImpl {
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct Blob {
|
pub struct Blob {
|
||||||
reflector_: Reflector,
|
reflector_: Reflector,
|
||||||
#[ignore_heap_size_of = "No clear owner"]
|
#[ignore_malloc_size_of = "No clear owner"]
|
||||||
blob_impl: DomRefCell<BlobImpl>,
|
blob_impl: DomRefCell<BlobImpl>,
|
||||||
/// content-type string
|
/// content-type string
|
||||||
type_string: String,
|
type_string: String,
|
||||||
|
|
|
@ -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.";
|
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";
|
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 struct AllowedBluetoothDevice {
|
||||||
pub deviceId: DOMString,
|
pub deviceId: DOMString,
|
||||||
pub mayUseGATT: bool,
|
pub mayUseGATT: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
pub struct BluetoothExtraPermissionData {
|
pub struct BluetoothExtraPermissionData {
|
||||||
allowed_devices: DomRefCell<Vec<AllowedBluetoothDevice>>,
|
allowed_devices: DomRefCell<Vec<AllowedBluetoothDevice>>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ pub struct CanvasGradient {
|
||||||
stops: DomRefCell<Vec<CanvasGradientStop>>,
|
stops: DomRefCell<Vec<CanvasGradientStop>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||||
pub enum CanvasGradientStyle {
|
pub enum CanvasGradientStyle {
|
||||||
Linear(LinearGradientStyle),
|
Linear(LinearGradientStyle),
|
||||||
Radial(RadialGradientStyle),
|
Radial(RadialGradientStyle),
|
||||||
|
|
|
@ -51,7 +51,7 @@ use std::sync::Arc;
|
||||||
use unpremultiplytable::UNPREMULTIPLY_TABLE;
|
use unpremultiplytable::UNPREMULTIPLY_TABLE;
|
||||||
|
|
||||||
#[must_root]
|
#[must_root]
|
||||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
enum CanvasFillOrStrokeStyle {
|
enum CanvasFillOrStrokeStyle {
|
||||||
Color(RGBA),
|
Color(RGBA),
|
||||||
|
@ -63,12 +63,12 @@ enum CanvasFillOrStrokeStyle {
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct CanvasRenderingContext2D {
|
pub struct CanvasRenderingContext2D {
|
||||||
reflector_: Reflector,
|
reflector_: Reflector,
|
||||||
#[ignore_heap_size_of = "Defined in ipc-channel"]
|
#[ignore_malloc_size_of = "Defined in ipc-channel"]
|
||||||
ipc_renderer: IpcSender<CanvasMsg>,
|
ipc_renderer: IpcSender<CanvasMsg>,
|
||||||
/// For rendering contexts created by an HTML canvas element, this is Some,
|
/// For rendering contexts created by an HTML canvas element, this is Some,
|
||||||
/// for ones created by a paint worklet, this is None.
|
/// for ones created by a paint worklet, this is None.
|
||||||
canvas: Option<Dom<HTMLCanvasElement>>,
|
canvas: Option<Dom<HTMLCanvasElement>>,
|
||||||
#[ignore_heap_size_of = "Arc"]
|
#[ignore_malloc_size_of = "Arc"]
|
||||||
image_cache: Arc<ImageCache>,
|
image_cache: Arc<ImageCache>,
|
||||||
/// Any missing image URLs.
|
/// Any missing image URLs.
|
||||||
missing_image_urls: DomRefCell<Vec<ServoUrl>>,
|
missing_image_urls: DomRefCell<Vec<ServoUrl>>,
|
||||||
|
@ -81,7 +81,7 @@ pub struct CanvasRenderingContext2D {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[must_root]
|
#[must_root]
|
||||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||||
struct CanvasContextState {
|
struct CanvasContextState {
|
||||||
global_alpha: f64,
|
global_alpha: f64,
|
||||||
global_composition: CompositionOrBlending,
|
global_composition: CompositionOrBlending,
|
||||||
|
|
|
@ -20,7 +20,7 @@ pub struct Client {
|
||||||
active_worker: MutNullableDom<ServiceWorker>,
|
active_worker: MutNullableDom<ServiceWorker>,
|
||||||
url: ServoUrl,
|
url: ServoUrl,
|
||||||
frame_type: FrameType,
|
frame_type: FrameType,
|
||||||
#[ignore_heap_size_of = "Defined in uuid"]
|
#[ignore_malloc_size_of = "Defined in uuid"]
|
||||||
id: Uuid
|
id: Uuid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ unsafe_no_jsmanaged_fields!(ServoRng);
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct Crypto {
|
pub struct Crypto {
|
||||||
reflector_: Reflector,
|
reflector_: Reflector,
|
||||||
#[ignore_heap_size_of = "Defined in rand"]
|
#[ignore_malloc_size_of = "Defined in rand"]
|
||||||
rng: DomRefCell<ServoRng>,
|
rng: DomRefCell<ServoRng>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ use style::stylesheets::FontFaceRule;
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct CSSFontFaceRule {
|
pub struct CSSFontFaceRule {
|
||||||
cssrule: CSSRule,
|
cssrule: CSSRule,
|
||||||
#[ignore_heap_size_of = "Arc"]
|
#[ignore_malloc_size_of = "Arc"]
|
||||||
fontfacerule: Arc<Locked<FontFaceRule>>,
|
fontfacerule: Arc<Locked<FontFaceRule>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ use style::stylesheets::CssRules as StyleCssRules;
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct CSSGroupingRule {
|
pub struct CSSGroupingRule {
|
||||||
cssrule: CSSRule,
|
cssrule: CSSRule,
|
||||||
#[ignore_heap_size_of = "Arc"]
|
#[ignore_malloc_size_of = "Arc"]
|
||||||
rules: Arc<Locked<StyleCssRules>>,
|
rules: Arc<Locked<StyleCssRules>>,
|
||||||
rulelist: MutNullableDom<CSSRuleList>,
|
rulelist: MutNullableDom<CSSRuleList>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ use style::stylesheets::ImportRule;
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct CSSImportRule {
|
pub struct CSSImportRule {
|
||||||
cssrule: CSSRule,
|
cssrule: CSSRule,
|
||||||
#[ignore_heap_size_of = "Arc"]
|
#[ignore_malloc_size_of = "Arc"]
|
||||||
import_rule: Arc<Locked<ImportRule>>,
|
import_rule: Arc<Locked<ImportRule>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ use style::stylesheets::keyframes_rule::Keyframe;
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct CSSKeyframeRule {
|
pub struct CSSKeyframeRule {
|
||||||
cssrule: CSSRule,
|
cssrule: CSSRule,
|
||||||
#[ignore_heap_size_of = "Arc"]
|
#[ignore_malloc_size_of = "Arc"]
|
||||||
keyframerule: Arc<Locked<Keyframe>>,
|
keyframerule: Arc<Locked<Keyframe>>,
|
||||||
style_decl: MutNullableDom<CSSStyleDeclaration>,
|
style_decl: MutNullableDom<CSSStyleDeclaration>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ use style::values::KeyframesName;
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct CSSKeyframesRule {
|
pub struct CSSKeyframesRule {
|
||||||
cssrule: CSSRule,
|
cssrule: CSSRule,
|
||||||
#[ignore_heap_size_of = "Arc"]
|
#[ignore_malloc_size_of = "Arc"]
|
||||||
keyframesrule: Arc<Locked<KeyframesRule>>,
|
keyframesrule: Arc<Locked<KeyframesRule>>,
|
||||||
rulelist: MutNullableDom<CSSRuleList>,
|
rulelist: MutNullableDom<CSSRuleList>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ use style_traits::{PARSING_MODE_DEFAULT, ToCss};
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct CSSMediaRule {
|
pub struct CSSMediaRule {
|
||||||
cssconditionrule: CSSConditionRule,
|
cssconditionrule: CSSConditionRule,
|
||||||
#[ignore_heap_size_of = "Arc"]
|
#[ignore_malloc_size_of = "Arc"]
|
||||||
mediarule: Arc<Locked<MediaRule>>,
|
mediarule: Arc<Locked<MediaRule>>,
|
||||||
medialist: MutNullableDom<MediaList>,
|
medialist: MutNullableDom<MediaList>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ use style::stylesheets::NamespaceRule;
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct CSSNamespaceRule {
|
pub struct CSSNamespaceRule {
|
||||||
cssrule: CSSRule,
|
cssrule: CSSRule,
|
||||||
#[ignore_heap_size_of = "Arc"]
|
#[ignore_malloc_size_of = "Arc"]
|
||||||
namespacerule: Arc<Locked<NamespaceRule>>,
|
namespacerule: Arc<Locked<NamespaceRule>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ impl From<RulesMutateError> for Error {
|
||||||
pub struct CSSRuleList {
|
pub struct CSSRuleList {
|
||||||
reflector_: Reflector,
|
reflector_: Reflector,
|
||||||
parent_stylesheet: Dom<CSSStyleSheet>,
|
parent_stylesheet: Dom<CSSStyleSheet>,
|
||||||
#[ignore_heap_size_of = "Arc"]
|
#[ignore_malloc_size_of = "Arc"]
|
||||||
rules: RulesSource,
|
rules: RulesSource,
|
||||||
dom_rules: DomRefCell<Vec<MutNullableDom<CSSRule>>>
|
dom_rules: DomRefCell<Vec<MutNullableDom<CSSRule>>>
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,12 +33,12 @@ pub struct CSSStyleDeclaration {
|
||||||
pseudo: Option<PseudoElement>,
|
pseudo: Option<PseudoElement>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
pub enum CSSStyleOwner {
|
pub enum CSSStyleOwner {
|
||||||
Element(Dom<Element>),
|
Element(Dom<Element>),
|
||||||
CSSRule(Dom<CSSRule>,
|
CSSRule(Dom<CSSRule>,
|
||||||
#[ignore_heap_size_of = "Arc"]
|
#[ignore_malloc_size_of = "Arc"]
|
||||||
Arc<Locked<PropertyDeclarationBlock>>),
|
Arc<Locked<PropertyDeclarationBlock>>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ impl CSSStyleOwner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, PartialEq)]
|
#[derive(MallocSizeOf, PartialEq)]
|
||||||
pub enum CSSModificationAccess {
|
pub enum CSSModificationAccess {
|
||||||
ReadWrite,
|
ReadWrite,
|
||||||
Readonly,
|
Readonly,
|
||||||
|
|
|
@ -25,7 +25,7 @@ use style::stylesheets::{StyleRule, Origin};
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct CSSStyleRule {
|
pub struct CSSStyleRule {
|
||||||
cssrule: CSSRule,
|
cssrule: CSSRule,
|
||||||
#[ignore_heap_size_of = "Arc"]
|
#[ignore_malloc_size_of = "Arc"]
|
||||||
stylerule: Arc<Locked<StyleRule>>,
|
stylerule: Arc<Locked<StyleRule>>,
|
||||||
style_decl: MutNullableDom<CSSStyleDeclaration>,
|
style_decl: MutNullableDom<CSSStyleDeclaration>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ pub struct CSSStyleSheet {
|
||||||
stylesheet: StyleSheet,
|
stylesheet: StyleSheet,
|
||||||
owner: Dom<Element>,
|
owner: Dom<Element>,
|
||||||
rulelist: MutNullableDom<CSSRuleList>,
|
rulelist: MutNullableDom<CSSRuleList>,
|
||||||
#[ignore_heap_size_of = "Arc"]
|
#[ignore_malloc_size_of = "Arc"]
|
||||||
style_stylesheet: Arc<StyleStyleSheet>,
|
style_stylesheet: Arc<StyleStyleSheet>,
|
||||||
origin_clean: Cell<bool>,
|
origin_clean: Cell<bool>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ use style_traits::{PARSING_MODE_DEFAULT, ToCss};
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct CSSSupportsRule {
|
pub struct CSSSupportsRule {
|
||||||
cssconditionrule: CSSConditionRule,
|
cssconditionrule: CSSConditionRule,
|
||||||
#[ignore_heap_size_of = "Arc"]
|
#[ignore_malloc_size_of = "Arc"]
|
||||||
supportsrule: Arc<Locked<SupportsRule>>,
|
supportsrule: Arc<Locked<SupportsRule>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ use style::stylesheets::ViewportRule;
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct CSSViewportRule {
|
pub struct CSSViewportRule {
|
||||||
cssrule: CSSRule,
|
cssrule: CSSRule,
|
||||||
#[ignore_heap_size_of = "Arc"]
|
#[ignore_malloc_size_of = "Arc"]
|
||||||
viewportrule: Arc<Locked<ViewportRule>>,
|
viewportrule: Arc<Locked<ViewportRule>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,12 +47,12 @@ pub struct CustomElementRegistry {
|
||||||
|
|
||||||
window: Dom<Window>,
|
window: Dom<Window>,
|
||||||
|
|
||||||
#[ignore_heap_size_of = "Rc"]
|
#[ignore_malloc_size_of = "Rc"]
|
||||||
when_defined: DomRefCell<HashMap<LocalName, Rc<Promise>>>,
|
when_defined: DomRefCell<HashMap<LocalName, Rc<Promise>>>,
|
||||||
|
|
||||||
element_definition_is_running: Cell<bool>,
|
element_definition_is_running: Cell<bool>,
|
||||||
|
|
||||||
#[ignore_heap_size_of = "Rc"]
|
#[ignore_malloc_size_of = "Rc"]
|
||||||
definitions: DomRefCell<HashMap<LocalName, Rc<CustomElementDefinition>>>,
|
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 {
|
pub struct LifecycleCallbacks {
|
||||||
#[ignore_heap_size_of = "Rc"]
|
#[ignore_malloc_size_of = "Rc"]
|
||||||
connected_callback: Option<Rc<Function>>,
|
connected_callback: Option<Rc<Function>>,
|
||||||
|
|
||||||
#[ignore_heap_size_of = "Rc"]
|
#[ignore_malloc_size_of = "Rc"]
|
||||||
disconnected_callback: Option<Rc<Function>>,
|
disconnected_callback: Option<Rc<Function>>,
|
||||||
|
|
||||||
#[ignore_heap_size_of = "Rc"]
|
#[ignore_malloc_size_of = "Rc"]
|
||||||
adopted_callback: Option<Rc<Function>>,
|
adopted_callback: Option<Rc<Function>>,
|
||||||
|
|
||||||
#[ignore_heap_size_of = "Rc"]
|
#[ignore_malloc_size_of = "Rc"]
|
||||||
attribute_changed_callback: Option<Rc<Function>>,
|
attribute_changed_callback: Option<Rc<Function>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||||
pub enum ConstructionStackEntry {
|
pub enum ConstructionStackEntry {
|
||||||
Element(DomRoot<Element>),
|
Element(DomRoot<Element>),
|
||||||
AlreadyConstructedMarker,
|
AlreadyConstructedMarker,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://html.spec.whatwg.org/multipage/#custom-element-definition>
|
/// <https://html.spec.whatwg.org/multipage/#custom-element-definition>
|
||||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||||
pub struct CustomElementDefinition {
|
pub struct CustomElementDefinition {
|
||||||
pub name: LocalName,
|
pub name: LocalName,
|
||||||
|
|
||||||
pub local_name: LocalName,
|
pub local_name: LocalName,
|
||||||
|
|
||||||
#[ignore_heap_size_of = "Rc"]
|
#[ignore_malloc_size_of = "Rc"]
|
||||||
pub constructor: Rc<Function>,
|
pub constructor: Rc<Function>,
|
||||||
|
|
||||||
pub observed_attributes: Vec<DOMString>,
|
pub observed_attributes: Vec<DOMString>,
|
||||||
|
@ -580,15 +580,15 @@ pub fn try_upgrade_element(element: &Element) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
pub enum CustomElementReaction {
|
pub enum CustomElementReaction {
|
||||||
Upgrade(
|
Upgrade(
|
||||||
#[ignore_heap_size_of = "Rc"]
|
#[ignore_malloc_size_of = "Rc"]
|
||||||
Rc<CustomElementDefinition>
|
Rc<CustomElementDefinition>
|
||||||
),
|
),
|
||||||
Callback(
|
Callback(
|
||||||
#[ignore_heap_size_of = "Rc"]
|
#[ignore_malloc_size_of = "Rc"]
|
||||||
Rc<Function>,
|
Rc<Function>,
|
||||||
Box<[Heap<JSVal>]>
|
Box<[Heap<JSVal>]>
|
||||||
),
|
),
|
||||||
|
@ -617,14 +617,14 @@ pub enum CallbackReaction {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://html.spec.whatwg.org/multipage/#processing-the-backup-element-queue>
|
/// <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 {
|
enum BackupElementQueueFlag {
|
||||||
Processing,
|
Processing,
|
||||||
NotProcessing,
|
NotProcessing,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://html.spec.whatwg.org/multipage/#custom-element-reactions-stack>
|
/// <https://html.spec.whatwg.org/multipage/#custom-element-reactions-stack>
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
pub struct CustomElementReactionStack {
|
pub struct CustomElementReactionStack {
|
||||||
stack: DomRefCell<Vec<ElementQueue>>,
|
stack: DomRefCell<Vec<ElementQueue>>,
|
||||||
|
@ -773,7 +773,7 @@ impl CustomElementReactionStack {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://html.spec.whatwg.org/multipage/#element-queue>
|
/// <https://html.spec.whatwg.org/multipage/#element-queue>
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
struct ElementQueue {
|
struct ElementQueue {
|
||||||
queue: DomRefCell<VecDeque<Dom<Element>>>,
|
queue: DomRefCell<VecDeque<Dom<Element>>>,
|
||||||
|
|
|
@ -22,7 +22,7 @@ use servo_atoms::Atom;
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct CustomEvent {
|
pub struct CustomEvent {
|
||||||
event: Event,
|
event: Event,
|
||||||
#[ignore_heap_size_of = "Defined in rust-mozjs"]
|
#[ignore_malloc_size_of = "Defined in rust-mozjs"]
|
||||||
detail: Heap<JSVal>,
|
detail: Heap<JSVal>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,15 +80,15 @@ enum MixedMessage {
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct DedicatedWorkerGlobalScope {
|
pub struct DedicatedWorkerGlobalScope {
|
||||||
workerglobalscope: WorkerGlobalScope,
|
workerglobalscope: WorkerGlobalScope,
|
||||||
#[ignore_heap_size_of = "Defined in std"]
|
#[ignore_malloc_size_of = "Defined in std"]
|
||||||
receiver: Receiver<(TrustedWorkerAddress, WorkerScriptMsg)>,
|
receiver: Receiver<(TrustedWorkerAddress, WorkerScriptMsg)>,
|
||||||
#[ignore_heap_size_of = "Defined in std"]
|
#[ignore_malloc_size_of = "Defined in std"]
|
||||||
own_sender: Sender<(TrustedWorkerAddress, WorkerScriptMsg)>,
|
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)>,
|
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>>,
|
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.
|
/// Sender to the parent thread.
|
||||||
parent_sender: Box<ScriptChan + Send>,
|
parent_sender: Box<ScriptChan + Send>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,13 +158,13 @@ pub enum TouchEventResult {
|
||||||
Forwarded,
|
Forwarded,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
|
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
|
||||||
pub enum IsHTMLDocument {
|
pub enum IsHTMLDocument {
|
||||||
HTMLDocument,
|
HTMLDocument,
|
||||||
NonHTMLDocument,
|
NonHTMLDocument,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HeapSizeOf)]
|
#[derive(Debug, MallocSizeOf)]
|
||||||
pub struct PendingRestyle {
|
pub struct PendingRestyle {
|
||||||
/// If this element had a state or attribute change since the last restyle, track
|
/// If this element had a state or attribute change since the last restyle, track
|
||||||
/// the original condition of the element.
|
/// the original condition of the element.
|
||||||
|
@ -187,10 +187,10 @@ impl PendingRestyle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
struct StyleSheetInDocument {
|
struct StyleSheetInDocument {
|
||||||
#[ignore_heap_size_of = "Arc"]
|
#[ignore_malloc_size_of = "Arc"]
|
||||||
sheet: Arc<Stylesheet>,
|
sheet: Arc<Stylesheet>,
|
||||||
owner: Dom<Element>,
|
owner: Dom<Element>,
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ pub struct Document {
|
||||||
is_html_document: bool,
|
is_html_document: bool,
|
||||||
activity: Cell<DocumentActivity>,
|
activity: Cell<DocumentActivity>,
|
||||||
url: DomRefCell<ServoUrl>,
|
url: DomRefCell<ServoUrl>,
|
||||||
#[ignore_heap_size_of = "defined in selectors"]
|
#[ignore_malloc_size_of = "defined in selectors"]
|
||||||
quirks_mode: Cell<QuirksMode>,
|
quirks_mode: Cell<QuirksMode>,
|
||||||
/// Caches for the getElement methods
|
/// Caches for the getElement methods
|
||||||
id_map: DomRefCell<HashMap<Atom, Vec<Dom<Element>>>>,
|
id_map: DomRefCell<HashMap<Atom, Vec<Dom<Element>>>>,
|
||||||
|
@ -321,7 +321,7 @@ pub struct Document {
|
||||||
/// <https://html.spec.whatwg.org/multipage/#target-element>
|
/// <https://html.spec.whatwg.org/multipage/#target-element>
|
||||||
target_element: MutNullableDom<Element>,
|
target_element: MutNullableDom<Element>,
|
||||||
/// <https://w3c.github.io/uievents/#event-type-dblclick>
|
/// <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>)>>,
|
last_click_info: DomRefCell<Option<(Instant, Point2D<f32>)>>,
|
||||||
/// <https://html.spec.whatwg.org/multipage/#ignore-destructive-writes-counter>
|
/// <https://html.spec.whatwg.org/multipage/#ignore-destructive-writes-counter>
|
||||||
ignore_destructive_writes_counter: Cell<u32>,
|
ignore_destructive_writes_counter: Cell<u32>,
|
||||||
|
@ -346,7 +346,7 @@ pub struct Document {
|
||||||
form_id_listener_map: DomRefCell<HashMap<Atom, HashSet<Dom<Element>>>>,
|
form_id_listener_map: DomRefCell<HashMap<Atom, HashSet<Dom<Element>>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
struct ImagesFilter;
|
struct ImagesFilter;
|
||||||
impl CollectionFilter for ImagesFilter {
|
impl CollectionFilter for ImagesFilter {
|
||||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||||
|
@ -354,7 +354,7 @@ impl CollectionFilter for ImagesFilter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
struct EmbedsFilter;
|
struct EmbedsFilter;
|
||||||
impl CollectionFilter for EmbedsFilter {
|
impl CollectionFilter for EmbedsFilter {
|
||||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||||
|
@ -362,7 +362,7 @@ impl CollectionFilter for EmbedsFilter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
struct LinksFilter;
|
struct LinksFilter;
|
||||||
impl CollectionFilter for LinksFilter {
|
impl CollectionFilter for LinksFilter {
|
||||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||||
|
@ -371,7 +371,7 @@ impl CollectionFilter for LinksFilter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
struct FormsFilter;
|
struct FormsFilter;
|
||||||
impl CollectionFilter for FormsFilter {
|
impl CollectionFilter for FormsFilter {
|
||||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||||
|
@ -379,7 +379,7 @@ impl CollectionFilter for FormsFilter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
struct ScriptsFilter;
|
struct ScriptsFilter;
|
||||||
impl CollectionFilter for ScriptsFilter {
|
impl CollectionFilter for ScriptsFilter {
|
||||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||||
|
@ -387,7 +387,7 @@ impl CollectionFilter for ScriptsFilter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
struct AnchorsFilter;
|
struct AnchorsFilter;
|
||||||
impl CollectionFilter for AnchorsFilter {
|
impl CollectionFilter for AnchorsFilter {
|
||||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||||
|
@ -395,7 +395,7 @@ impl CollectionFilter for AnchorsFilter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
struct AppletsFilter;
|
struct AppletsFilter;
|
||||||
impl CollectionFilter for AppletsFilter {
|
impl CollectionFilter for AppletsFilter {
|
||||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||||
|
@ -1978,7 +1978,7 @@ impl Document {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, PartialEq)]
|
#[derive(MallocSizeOf, PartialEq)]
|
||||||
pub enum DocumentSource {
|
pub enum DocumentSource {
|
||||||
FromParser,
|
FromParser,
|
||||||
NotFromParser,
|
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 {
|
pub enum HasBrowsingContext {
|
||||||
No,
|
No,
|
||||||
Yes,
|
Yes,
|
||||||
|
@ -3470,7 +3470,7 @@ impl DocumentMethods for Document {
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:dom-document-nameditem-filter
|
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:dom-document-nameditem-filter
|
||||||
unsafe fn NamedGetter(&self, _cx: *mut JSContext, name: DOMString) -> Option<NonNullJSObjectPtr> {
|
unsafe fn NamedGetter(&self, _cx: *mut JSContext, name: DOMString) -> Option<NonNullJSObjectPtr> {
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
struct NamedElementFilter {
|
struct NamedElementFilter {
|
||||||
name: Atom,
|
name: Atom,
|
||||||
}
|
}
|
||||||
|
@ -3945,10 +3945,10 @@ pub enum FocusEventType {
|
||||||
/// If the page is observed to be using `requestAnimationFrame()` for non-animation purposes (i.e.
|
/// 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
|
/// without mutating the DOM), then we fall back to simple timeouts to save energy over video
|
||||||
/// refresh.
|
/// refresh.
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
pub struct FakeRequestAnimationFrameCallback {
|
pub struct FakeRequestAnimationFrameCallback {
|
||||||
/// The document.
|
/// The document.
|
||||||
#[ignore_heap_size_of = "non-owning"]
|
#[ignore_malloc_size_of = "non-owning"]
|
||||||
document: Trusted<Document>,
|
document: Trusted<Document>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3959,11 +3959,11 @@ impl FakeRequestAnimationFrameCallback {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
pub enum AnimationFrameCallback {
|
pub enum AnimationFrameCallback {
|
||||||
DevtoolsFramerateTick { actor_name: String },
|
DevtoolsFramerateTick { actor_name: String },
|
||||||
FrameRequestCallback {
|
FrameRequestCallback {
|
||||||
#[ignore_heap_size_of = "Rc is hard"]
|
#[ignore_malloc_size_of = "Rc is hard"]
|
||||||
callback: Rc<FrameRequestCallback>
|
callback: Rc<FrameRequestCallback>
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -3985,7 +3985,7 @@ impl AnimationFrameCallback {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, HeapSizeOf, JSTraceable)]
|
#[derive(Default, JSTraceable, MallocSizeOf)]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
struct PendingInOrderScriptVec {
|
struct PendingInOrderScriptVec {
|
||||||
scripts: DomRefCell<VecDeque<PendingScript>>,
|
scripts: DomRefCell<VecDeque<PendingScript>>,
|
||||||
|
@ -4021,7 +4021,7 @@ impl PendingInOrderScriptVec {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
struct PendingScript {
|
struct PendingScript {
|
||||||
element: Dom<HTMLScriptElement>,
|
element: Dom<HTMLScriptElement>,
|
||||||
|
|
|
@ -12,7 +12,7 @@ use dom::globalscope::GlobalScope;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
|
||||||
#[repr(u16)]
|
#[repr(u16)]
|
||||||
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable)]
|
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf)]
|
||||||
pub enum DOMErrorName {
|
pub enum DOMErrorName {
|
||||||
IndexSizeError = DOMExceptionConstants::INDEX_SIZE_ERR,
|
IndexSizeError = DOMExceptionConstants::INDEX_SIZE_ERR,
|
||||||
HierarchyRequestError = DOMExceptionConstants::HIERARCHY_REQUEST_ERR,
|
HierarchyRequestError = DOMExceptionConstants::HIERARCHY_REQUEST_ERR,
|
||||||
|
|
|
@ -140,7 +140,7 @@ pub struct Element {
|
||||||
attrs: DomRefCell<Vec<Dom<Attr>>>,
|
attrs: DomRefCell<Vec<Dom<Attr>>>,
|
||||||
id_attribute: DomRefCell<Option<Atom>>,
|
id_attribute: DomRefCell<Option<Atom>>,
|
||||||
is: DomRefCell<Option<LocalName>>,
|
is: DomRefCell<Option<LocalName>>,
|
||||||
#[ignore_heap_size_of = "Arc"]
|
#[ignore_malloc_size_of = "Arc"]
|
||||||
style_attribute: DomRefCell<Option<Arc<Locked<PropertyDeclarationBlock>>>>,
|
style_attribute: DomRefCell<Option<Arc<Locked<PropertyDeclarationBlock>>>>,
|
||||||
attr_list: MutNullableDom<NamedNodeMap>,
|
attr_list: MutNullableDom<NamedNodeMap>,
|
||||||
class_list: MutNullableDom<DOMTokenList>,
|
class_list: MutNullableDom<DOMTokenList>,
|
||||||
|
@ -149,12 +149,12 @@ pub struct Element {
|
||||||
/// operations may require restyling this element or its descendants. The
|
/// operations may require restyling this element or its descendants. The
|
||||||
/// flags are not atomic, so the style system takes care of only set them
|
/// flags are not atomic, so the style system takes care of only set them
|
||||||
/// when it has exclusive access to the element.
|
/// 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>,
|
selector_flags: Cell<ElementSelectorFlags>,
|
||||||
/// <https://html.spec.whatwg.org/multipage/#custom-element-reaction-queue>
|
/// <https://html.spec.whatwg.org/multipage/#custom-element-reaction-queue>
|
||||||
custom_element_reaction_queue: DomRefCell<Vec<CustomElementReaction>>,
|
custom_element_reaction_queue: DomRefCell<Vec<CustomElementReaction>>,
|
||||||
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-definition>
|
/// <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>>>,
|
custom_element_definition: DomRefCell<Option<Rc<CustomElementDefinition>>>,
|
||||||
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-state>
|
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-state>
|
||||||
custom_element_state: Cell<CustomElementState>,
|
custom_element_state: Cell<CustomElementState>,
|
||||||
|
@ -176,7 +176,7 @@ impl fmt::Debug for DomRoot<Element> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, PartialEq)]
|
#[derive(MallocSizeOf, PartialEq)]
|
||||||
pub enum ElementCreator {
|
pub enum ElementCreator {
|
||||||
ParserCreated(u64),
|
ParserCreated(u64),
|
||||||
ScriptCreated,
|
ScriptCreated,
|
||||||
|
@ -188,7 +188,7 @@ pub enum CustomElementCreationMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-state>
|
/// <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 {
|
pub enum CustomElementState {
|
||||||
Undefined,
|
Undefined,
|
||||||
Failed,
|
Failed,
|
||||||
|
@ -3025,7 +3025,7 @@ impl<'a> AttributeMutation<'a> {
|
||||||
/// A holder for an element's "tag name", which will be lazily
|
/// A holder for an element's "tag name", which will be lazily
|
||||||
/// resolved and cached. Should be reset when the document
|
/// resolved and cached. Should be reset when the document
|
||||||
/// owner changes.
|
/// owner changes.
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
struct TagName {
|
struct TagName {
|
||||||
ptr: DomRefCell<Option<LocalName>>,
|
ptr: DomRefCell<Option<LocalName>>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ pub struct ErrorEvent {
|
||||||
filename: DomRefCell<DOMString>,
|
filename: DomRefCell<DOMString>,
|
||||||
lineno: Cell<u32>,
|
lineno: Cell<u32>,
|
||||||
colno: Cell<u32>,
|
colno: Cell<u32>,
|
||||||
#[ignore_heap_size_of = "Defined in rust-mozjs"]
|
#[ignore_malloc_size_of = "Defined in rust-mozjs"]
|
||||||
error: Heap<JSVal>,
|
error: Heap<JSVal>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,7 @@ impl EventMethods for Event {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
|
#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
|
||||||
pub enum EventBubbles {
|
pub enum EventBubbles {
|
||||||
Bubbles,
|
Bubbles,
|
||||||
DoesNotBubble
|
DoesNotBubble
|
||||||
|
@ -318,7 +318,7 @@ impl From<EventBubbles> for bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
|
#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
|
||||||
pub enum EventCancelable {
|
pub enum EventCancelable {
|
||||||
Cancelable,
|
Cancelable,
|
||||||
NotCancelable
|
NotCancelable
|
||||||
|
@ -344,7 +344,7 @@ impl From<EventCancelable> for bool {
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, JSTraceable, PartialEq)]
|
#[derive(Clone, Copy, Debug, Eq, JSTraceable, PartialEq)]
|
||||||
#[repr(u16)]
|
#[repr(u16)]
|
||||||
#[derive(HeapSizeOf)]
|
#[derive(MallocSizeOf)]
|
||||||
pub enum EventPhase {
|
pub enum EventPhase {
|
||||||
None = EventConstants::NONE,
|
None = EventConstants::NONE,
|
||||||
Capturing = EventConstants::CAPTURING_PHASE,
|
Capturing = EventConstants::CAPTURING_PHASE,
|
||||||
|
@ -363,7 +363,7 @@ pub enum EventPhase {
|
||||||
///
|
///
|
||||||
/// [msg]: https://doc.servo.org/script_traits/enum.ConstellationMsg.html#variant.KeyEvent
|
/// [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 {
|
pub enum EventDefault {
|
||||||
/// The default action of the event is allowed (constructor's default)
|
/// The default action of the event is allowed (constructor's default)
|
||||||
Allowed,
|
Allowed,
|
||||||
|
|
|
@ -41,10 +41,10 @@ header! { (LastEventId, "Last-Event-ID") => [String] }
|
||||||
|
|
||||||
const DEFAULT_RECONNECTION_TIME: u64 = 5000;
|
const DEFAULT_RECONNECTION_TIME: u64 = 5000;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
|
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
|
||||||
struct GenerationId(u32);
|
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>
|
/// <https://html.spec.whatwg.org/multipage/#dom-eventsource-readystate>
|
||||||
enum ReadyState {
|
enum ReadyState {
|
||||||
Connecting = 0,
|
Connecting = 0,
|
||||||
|
@ -528,11 +528,11 @@ impl EventSourceMethods for EventSource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
pub struct EventSourceTimeoutCallback {
|
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>,
|
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>,
|
action_sender: ipc::IpcSender<FetchResponseMsg>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ use dom::virtualmethods::VirtualMethods;
|
||||||
use dom::window::Window;
|
use dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use fnv::FnvHasher;
|
use fnv::FnvHasher;
|
||||||
use heapsize::HeapSizeOf;
|
|
||||||
use js::jsapi::{CompileFunction, JS_GetFunctionObject, JSAutoCompartment};
|
use js::jsapi::{CompileFunction, JS_GetFunctionObject, JSAutoCompartment};
|
||||||
use js::rust::{AutoObjectVectorWrapper, CompileOptionsWrapper};
|
use js::rust::{AutoObjectVectorWrapper, CompileOptionsWrapper};
|
||||||
use libc::{c_char, size_t};
|
use libc::{c_char, size_t};
|
||||||
|
@ -48,11 +47,19 @@ use std::ops::{Deref, DerefMut};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
#[derive(Clone, JSTraceable, PartialEq)]
|
#[derive(Clone, JSTraceable, MallocSizeOf, PartialEq)]
|
||||||
pub enum CommonEventHandler {
|
pub enum CommonEventHandler {
|
||||||
EventHandler(Rc<EventHandlerNonNull>),
|
EventHandler(
|
||||||
ErrorEventHandler(Rc<OnErrorEventHandlerNonNull>),
|
#[ignore_malloc_size_of = "Rc"]
|
||||||
BeforeUnloadEventHandler(Rc<OnBeforeUnloadEventHandlerNonNull>),
|
Rc<EventHandlerNonNull>),
|
||||||
|
|
||||||
|
ErrorEventHandler(
|
||||||
|
#[ignore_malloc_size_of = "Rc"]
|
||||||
|
Rc<OnErrorEventHandlerNonNull>),
|
||||||
|
|
||||||
|
BeforeUnloadEventHandler(
|
||||||
|
#[ignore_malloc_size_of = "Rc"]
|
||||||
|
Rc<OnBeforeUnloadEventHandlerNonNull>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CommonEventHandler {
|
impl CommonEventHandler {
|
||||||
|
@ -65,14 +72,14 @@ impl CommonEventHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
|
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
|
||||||
pub enum ListenerPhase {
|
pub enum ListenerPhase {
|
||||||
Capturing,
|
Capturing,
|
||||||
Bubbling,
|
Bubbling,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://html.spec.whatwg.org/multipage/#internal-raw-uncompiled-handler>
|
/// <https://html.spec.whatwg.org/multipage/#internal-raw-uncompiled-handler>
|
||||||
#[derive(Clone, JSTraceable, PartialEq)]
|
#[derive(Clone, JSTraceable, MallocSizeOf, PartialEq)]
|
||||||
struct InternalRawUncompiledHandler {
|
struct InternalRawUncompiledHandler {
|
||||||
source: DOMString,
|
source: DOMString,
|
||||||
url: ServoUrl,
|
url: ServoUrl,
|
||||||
|
@ -80,7 +87,7 @@ struct InternalRawUncompiledHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A representation of an event handler, either compiled or uncompiled raw source, or null.
|
/// 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 {
|
enum InlineEventListener {
|
||||||
Uncompiled(InternalRawUncompiledHandler),
|
Uncompiled(InternalRawUncompiledHandler),
|
||||||
Compiled(CommonEventHandler),
|
Compiled(CommonEventHandler),
|
||||||
|
@ -110,19 +117,12 @@ impl InlineEventListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, JSTraceable, PartialEq)]
|
#[derive(Clone, JSTraceable, MallocSizeOf, PartialEq)]
|
||||||
enum EventListenerType {
|
enum EventListenerType {
|
||||||
Additive(Rc<EventListener>),
|
Additive(#[ignore_malloc_size_of = "Rc"] Rc<EventListener>),
|
||||||
Inline(InlineEventListener),
|
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 {
|
impl EventListenerType {
|
||||||
fn get_compiled_listener(&mut self, owner: &EventTarget, ty: &Atom)
|
fn get_compiled_listener(&mut self, owner: &EventTarget, ty: &Atom)
|
||||||
-> Option<CompiledEventListener> {
|
-> 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.
|
/// A listener in a collection of event listeners.
|
||||||
struct EventListenerEntry {
|
struct EventListenerEntry {
|
||||||
phase: ListenerPhase,
|
phase: ListenerPhase,
|
||||||
listener: EventListenerType
|
listener: EventListenerType
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
/// A mix of potentially uncompiled and compiled event listeners of the same type.
|
/// A mix of potentially uncompiled and compiled event listeners of the same type.
|
||||||
struct EventListeners(Vec<EventListenerEntry>);
|
struct EventListeners(Vec<EventListenerEntry>);
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ use task::TaskCanceller;
|
||||||
use task_source::TaskSource;
|
use task_source::TaskSource;
|
||||||
use task_source::file_reading::{FileReadingTask, FileReadingTaskSource};
|
use task_source::file_reading::{FileReadingTask, FileReadingTaskSource};
|
||||||
|
|
||||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
|
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
|
||||||
pub enum FileReaderFunction {
|
pub enum FileReaderFunction {
|
||||||
ReadAsText,
|
ReadAsText,
|
||||||
ReadAsDataUrl,
|
ReadAsDataUrl,
|
||||||
|
@ -48,7 +48,7 @@ pub enum FileReaderFunction {
|
||||||
|
|
||||||
pub type TrustedFileReader = Trusted<FileReader>;
|
pub type TrustedFileReader = Trusted<FileReader>;
|
||||||
|
|
||||||
#[derive(Clone, HeapSizeOf)]
|
#[derive(Clone, MallocSizeOf)]
|
||||||
pub struct ReadMetaData {
|
pub struct ReadMetaData {
|
||||||
pub blobtype: String,
|
pub blobtype: String,
|
||||||
pub label: Option<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);
|
pub struct GenerationId(u32);
|
||||||
|
|
||||||
#[repr(u16)]
|
#[repr(u16)]
|
||||||
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
|
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
|
||||||
pub enum FileReaderReadyState {
|
pub enum FileReaderReadyState {
|
||||||
Empty = FileReaderConstants::EMPTY,
|
Empty = FileReaderConstants::EMPTY,
|
||||||
Loading = FileReaderConstants::LOADING,
|
Loading = FileReaderConstants::LOADING,
|
||||||
Done = FileReaderConstants::DONE,
|
Done = FileReaderConstants::DONE,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
pub enum FileReaderResult {
|
pub enum FileReaderResult {
|
||||||
ArrayBuffer(Heap<JSVal>),
|
ArrayBuffer(Heap<JSVal>),
|
||||||
String(DOMString),
|
String(DOMString),
|
||||||
|
|
|
@ -35,7 +35,7 @@ pub struct Gamepad {
|
||||||
axes: Heap<*mut JSObject>,
|
axes: Heap<*mut JSObject>,
|
||||||
buttons: Dom<GamepadButtonList>,
|
buttons: Dom<GamepadButtonList>,
|
||||||
pose: Option<Dom<VRPose>>,
|
pose: Option<Dom<VRPose>>,
|
||||||
#[ignore_heap_size_of = "Defined in rust-webvr"]
|
#[ignore_malloc_size_of = "Defined in rust-webvr"]
|
||||||
hand: WebVRGamepadHand,
|
hand: WebVRGamepadHand,
|
||||||
display_id: u32
|
display_id: u32
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,22 +72,22 @@ pub struct GlobalScope {
|
||||||
console_timers: DomRefCell<HashMap<DOMString, u64>>,
|
console_timers: DomRefCell<HashMap<DOMString, u64>>,
|
||||||
|
|
||||||
/// For providing instructions to an optional devtools server.
|
/// 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>>,
|
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
||||||
|
|
||||||
/// For sending messages to the memory profiler.
|
/// 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,
|
mem_profiler_chan: mem::ProfilerChan,
|
||||||
|
|
||||||
/// For sending messages to the time profiler.
|
/// 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,
|
time_profiler_chan: time::ProfilerChan,
|
||||||
|
|
||||||
/// A handle for communicating messages to the constellation thread.
|
/// 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,
|
script_to_constellation_chan: ScriptToConstellationChan,
|
||||||
|
|
||||||
#[ignore_heap_size_of = "channels are hard"]
|
#[ignore_malloc_size_of = "channels are hard"]
|
||||||
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
||||||
|
|
||||||
/// <https://html.spec.whatwg.org/multipage/#in-error-reporting-mode>
|
/// <https://html.spec.whatwg.org/multipage/#in-error-reporting-mode>
|
||||||
|
@ -108,7 +108,7 @@ pub struct GlobalScope {
|
||||||
/// same microtask queue.
|
/// same microtask queue.
|
||||||
///
|
///
|
||||||
/// <https://html.spec.whatwg.org/multipage/#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>,
|
microtask_queue: Rc<MicrotaskQueue>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,12 @@ use std::str;
|
||||||
pub struct Headers {
|
pub struct Headers {
|
||||||
reflector_: Reflector,
|
reflector_: Reflector,
|
||||||
guard: Cell<Guard>,
|
guard: Cell<Guard>,
|
||||||
#[ignore_heap_size_of = "Defined in hyper"]
|
#[ignore_malloc_size_of = "Defined in hyper"]
|
||||||
header_list: DomRefCell<HyperHeaders>
|
header_list: DomRefCell<HyperHeaders>
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#concept-headers-guard
|
// https://fetch.spec.whatwg.org/#concept-headers-guard
|
||||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
|
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
|
||||||
pub enum Guard {
|
pub enum Guard {
|
||||||
Immutable,
|
Immutable,
|
||||||
Request,
|
Request,
|
||||||
|
|
|
@ -30,7 +30,7 @@ use std::default::Default;
|
||||||
use style::element_state::*;
|
use style::element_state::*;
|
||||||
|
|
||||||
#[derive(Clone, Copy, JSTraceable, PartialEq)]
|
#[derive(Clone, Copy, JSTraceable, PartialEq)]
|
||||||
#[derive(HeapSizeOf)]
|
#[derive(MallocSizeOf)]
|
||||||
enum ButtonType {
|
enum ButtonType {
|
||||||
Submit,
|
Submit,
|
||||||
Reset,
|
Reset,
|
||||||
|
|
|
@ -42,7 +42,7 @@ const DEFAULT_WIDTH: u32 = 300;
|
||||||
const DEFAULT_HEIGHT: u32 = 150;
|
const DEFAULT_HEIGHT: u32 = 150;
|
||||||
|
|
||||||
#[must_root]
|
#[must_root]
|
||||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||||
pub enum CanvasContext {
|
pub enum CanvasContext {
|
||||||
Context2d(Dom<CanvasRenderingContext2D>),
|
Context2d(Dom<CanvasRenderingContext2D>),
|
||||||
WebGL(Dom<WebGLRenderingContext>),
|
WebGL(Dom<WebGLRenderingContext>),
|
||||||
|
|
|
@ -26,7 +26,7 @@ pub trait CollectionFilter : JSTraceable {
|
||||||
// An optional u32, using maxint to represent None.
|
// An optional u32, using maxint to represent None.
|
||||||
// It would be nicer just to use Option<u32> for this, but that would produce word
|
// It would be nicer just to use Option<u32> for this, but that would produce word
|
||||||
// alignment issues since Option<u32> uses 33 bits.
|
// alignment issues since Option<u32> uses 33 bits.
|
||||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable)]
|
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
|
||||||
struct OptionU32 {
|
struct OptionU32 {
|
||||||
bits: u32,
|
bits: u32,
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ impl OptionU32 {
|
||||||
pub struct HTMLCollection {
|
pub struct HTMLCollection {
|
||||||
reflector_: Reflector,
|
reflector_: Reflector,
|
||||||
root: Dom<Node>,
|
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>,
|
filter: Box<CollectionFilter + 'static>,
|
||||||
// We cache the version of the root node and all its decendents,
|
// We cache the version of the root node and all its decendents,
|
||||||
// the length of the collection, and a cursor into the collection.
|
// the length of the collection, and a cursor into the collection.
|
||||||
|
@ -119,7 +119,7 @@ impl HTMLCollection {
|
||||||
-> DomRoot<HTMLCollection> {
|
-> DomRoot<HTMLCollection> {
|
||||||
// case 1
|
// case 1
|
||||||
if qualified_name == local_name!("*") {
|
if qualified_name == local_name!("*") {
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
struct AllFilter;
|
struct AllFilter;
|
||||||
impl CollectionFilter for AllFilter {
|
impl CollectionFilter for AllFilter {
|
||||||
fn filter(&self, _elem: &Element, _root: &Node) -> bool {
|
fn filter(&self, _elem: &Element, _root: &Node) -> bool {
|
||||||
|
@ -129,7 +129,7 @@ impl HTMLCollection {
|
||||||
return HTMLCollection::create(window, root, Box::new(AllFilter));
|
return HTMLCollection::create(window, root, Box::new(AllFilter));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
struct HtmlDocumentFilter {
|
struct HtmlDocumentFilter {
|
||||||
qualified_name: LocalName,
|
qualified_name: LocalName,
|
||||||
ascii_lower_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> {
|
pub fn by_qual_tag_name(window: &Window, root: &Node, qname: QualName) -> DomRoot<HTMLCollection> {
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
struct TagNameNSFilter {
|
struct TagNameNSFilter {
|
||||||
qname: QualName
|
qname: QualName
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ impl HTMLCollection {
|
||||||
|
|
||||||
pub fn by_atomic_class_name(window: &Window, root: &Node, classes: Vec<Atom>)
|
pub fn by_atomic_class_name(window: &Window, root: &Node, classes: Vec<Atom>)
|
||||||
-> DomRoot<HTMLCollection> {
|
-> DomRoot<HTMLCollection> {
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
struct ClassNameFilter {
|
struct ClassNameFilter {
|
||||||
classes: Vec<Atom>
|
classes: Vec<Atom>
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ impl HTMLCollection {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn children(window: &Window, root: &Node) -> DomRoot<HTMLCollection> {
|
pub fn children(window: &Window, root: &Node) -> DomRoot<HTMLCollection> {
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
struct ElementChildFilter;
|
struct ElementChildFilter;
|
||||||
impl CollectionFilter for ElementChildFilter {
|
impl CollectionFilter for ElementChildFilter {
|
||||||
fn filter(&self, elem: &Element, root: &Node) -> bool {
|
fn filter(&self, elem: &Element, root: &Node) -> bool {
|
||||||
|
|
|
@ -43,7 +43,7 @@ impl HTMLDataListElement {
|
||||||
impl HTMLDataListElementMethods for HTMLDataListElement {
|
impl HTMLDataListElementMethods for HTMLDataListElement {
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-datalist-options
|
// https://html.spec.whatwg.org/multipage/#dom-datalist-options
|
||||||
fn Options(&self) -> DomRoot<HTMLCollection> {
|
fn Options(&self) -> DomRoot<HTMLCollection> {
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
struct HTMLDataListOptionsFilter;
|
struct HTMLDataListOptionsFilter;
|
||||||
impl CollectionFilter for HTMLDataListOptionsFilter {
|
impl CollectionFilter for HTMLDataListOptionsFilter {
|
||||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||||
|
|
|
@ -52,7 +52,7 @@ impl HTMLFieldSetElement {
|
||||||
impl HTMLFieldSetElementMethods for HTMLFieldSetElement {
|
impl HTMLFieldSetElementMethods for HTMLFieldSetElement {
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-fieldset-elements
|
// https://html.spec.whatwg.org/multipage/#dom-fieldset-elements
|
||||||
fn Elements(&self) -> DomRoot<HTMLCollection> {
|
fn Elements(&self) -> DomRoot<HTMLCollection> {
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
struct ElementsFilter;
|
struct ElementsFilter;
|
||||||
impl CollectionFilter for ElementsFilter {
|
impl CollectionFilter for ElementsFilter {
|
||||||
fn filter<'a>(&self, elem: &'a Element, _root: &'a Node) -> bool {
|
fn filter<'a>(&self, elem: &'a Element, _root: &'a Node) -> bool {
|
||||||
|
|
|
@ -57,7 +57,7 @@ use style::attr::AttrValue;
|
||||||
use style::str::split_html_space_chars;
|
use style::str::split_html_space_chars;
|
||||||
use task_source::TaskSource;
|
use task_source::TaskSource;
|
||||||
|
|
||||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
|
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
|
||||||
pub struct GenerationId(u32);
|
pub struct GenerationId(u32);
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -166,7 +166,7 @@ impl HTMLFormElementMethods for HTMLFormElement {
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-form-elements
|
// https://html.spec.whatwg.org/multipage/#dom-form-elements
|
||||||
fn Elements(&self) -> DomRoot<HTMLFormControlsCollection> {
|
fn Elements(&self) -> DomRoot<HTMLFormControlsCollection> {
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
struct ElementsFilter {
|
struct ElementsFilter {
|
||||||
form: DomRoot<HTMLFormElement>
|
form: DomRoot<HTMLFormElement>
|
||||||
}
|
}
|
||||||
|
@ -235,13 +235,13 @@ impl HTMLFormElementMethods for HTMLFormElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
|
#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
|
||||||
pub enum SubmittedFrom {
|
pub enum SubmittedFrom {
|
||||||
FromForm,
|
FromForm,
|
||||||
NotFromForm
|
NotFromForm
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, HeapSizeOf)]
|
#[derive(Clone, Copy, MallocSizeOf)]
|
||||||
pub enum ResetFrom {
|
pub enum ResetFrom {
|
||||||
FromForm,
|
FromForm,
|
||||||
NotFromForm
|
NotFromForm
|
||||||
|
@ -674,14 +674,14 @@ impl HTMLFormElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||||
pub enum FormDatumValue {
|
pub enum FormDatumValue {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
File(DomRoot<File>),
|
File(DomRoot<File>),
|
||||||
String(DOMString)
|
String(DOMString)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||||
pub struct FormDatum {
|
pub struct FormDatum {
|
||||||
pub ty: DOMString,
|
pub ty: DOMString,
|
||||||
pub name: DOMString,
|
pub name: DOMString,
|
||||||
|
@ -701,21 +701,21 @@ impl FormDatum {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, HeapSizeOf)]
|
#[derive(Clone, Copy, MallocSizeOf)]
|
||||||
pub enum FormEncType {
|
pub enum FormEncType {
|
||||||
TextPlainEncoded,
|
TextPlainEncoded,
|
||||||
UrlEncoded,
|
UrlEncoded,
|
||||||
FormDataEncoded
|
FormDataEncoded
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, HeapSizeOf)]
|
#[derive(Clone, Copy, MallocSizeOf)]
|
||||||
pub enum FormMethod {
|
pub enum FormMethod {
|
||||||
FormGet,
|
FormGet,
|
||||||
FormPost,
|
FormPost,
|
||||||
FormDialog
|
FormDialog
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf)]
|
#[derive(MallocSizeOf)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub enum FormSubmittableElement {
|
pub enum FormSubmittableElement {
|
||||||
ButtonElement(DomRoot<HTMLButtonElement>),
|
ButtonElement(DomRoot<HTMLButtonElement>),
|
||||||
|
@ -759,7 +759,7 @@ impl FormSubmittableElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, HeapSizeOf)]
|
#[derive(Clone, Copy, MallocSizeOf)]
|
||||||
pub enum FormSubmitter<'a> {
|
pub enum FormSubmitter<'a> {
|
||||||
FormElement(&'a HTMLFormElement),
|
FormElement(&'a HTMLFormElement),
|
||||||
InputElement(&'a HTMLInputElement),
|
InputElement(&'a HTMLInputElement),
|
||||||
|
|
|
@ -10,7 +10,7 @@ use dom::node::Node;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
pub enum HeadingLevel {
|
pub enum HeadingLevel {
|
||||||
Heading1,
|
Heading1,
|
||||||
Heading2,
|
Heading2,
|
||||||
|
|
|
@ -56,7 +56,7 @@ use style::attr::{AttrValue, LengthOrPercentageOrAuto};
|
||||||
use task_source::TaskSource;
|
use task_source::TaskSource;
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
flags SandboxAllowance: u8 {
|
flags SandboxAllowance: u8 {
|
||||||
const ALLOW_NOTHING = 0x00,
|
const ALLOW_NOTHING = 0x00,
|
||||||
const ALLOW_SAME_ORIGIN = 0x01,
|
const ALLOW_SAME_ORIGIN = 0x01,
|
||||||
|
|
|
@ -85,7 +85,7 @@ pub struct Descriptor {
|
||||||
pub den: Option<f64>,
|
pub den: Option<f64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable)]
|
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
enum State {
|
enum State {
|
||||||
Unavailable,
|
Unavailable,
|
||||||
|
@ -100,19 +100,19 @@ pub struct Size {
|
||||||
pub length: Length,
|
pub length: Length,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable)]
|
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
|
||||||
enum ImageRequestPhase {
|
enum ImageRequestPhase {
|
||||||
Pending,
|
Pending,
|
||||||
Current
|
Current
|
||||||
}
|
}
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
struct ImageRequest {
|
struct ImageRequest {
|
||||||
state: State,
|
state: State,
|
||||||
parsed_url: Option<ServoUrl>,
|
parsed_url: Option<ServoUrl>,
|
||||||
source_url: Option<DOMString>,
|
source_url: Option<DOMString>,
|
||||||
blocker: Option<LoadBlocker>,
|
blocker: Option<LoadBlocker>,
|
||||||
#[ignore_heap_size_of = "Arc"]
|
#[ignore_malloc_size_of = "Arc"]
|
||||||
image: Option<Arc<Image>>,
|
image: Option<Arc<Image>>,
|
||||||
metadata: Option<ImageMetadata>,
|
metadata: Option<ImageMetadata>,
|
||||||
final_url: Option<ServoUrl>,
|
final_url: Option<ServoUrl>,
|
||||||
|
@ -695,7 +695,7 @@ impl HTMLImageElement {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
pub enum ImageElementMicrotask {
|
pub enum ImageElementMicrotask {
|
||||||
StableStateUpdateImageDataTask {
|
StableStateUpdateImageDataTask {
|
||||||
elem: DomRoot<HTMLImageElement>,
|
elem: DomRoot<HTMLImageElement>,
|
||||||
|
|
|
@ -62,7 +62,7 @@ const PASSWORD_REPLACEMENT_CHAR: char = '●';
|
||||||
|
|
||||||
#[derive(Clone, Copy, JSTraceable, PartialEq)]
|
#[derive(Clone, Copy, JSTraceable, PartialEq)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[derive(HeapSizeOf)]
|
#[derive(MallocSizeOf)]
|
||||||
enum InputType {
|
enum InputType {
|
||||||
InputSubmit,
|
InputSubmit,
|
||||||
InputReset,
|
InputReset,
|
||||||
|
@ -93,7 +93,7 @@ pub struct HTMLInputElement {
|
||||||
size: Cell<u32>,
|
size: Cell<u32>,
|
||||||
maxlength: Cell<i32>,
|
maxlength: Cell<i32>,
|
||||||
minlength: Cell<i32>,
|
minlength: Cell<i32>,
|
||||||
#[ignore_heap_size_of = "#7193"]
|
#[ignore_malloc_size_of = "#7193"]
|
||||||
textinput: DomRefCell<TextInput<ScriptToConstellationChan>>,
|
textinput: DomRefCell<TextInput<ScriptToConstellationChan>>,
|
||||||
activation_state: DomRefCell<InputActivationState>,
|
activation_state: DomRefCell<InputActivationState>,
|
||||||
// https://html.spec.whatwg.org/multipage/#concept-input-value-dirty-flag
|
// https://html.spec.whatwg.org/multipage/#concept-input-value-dirty-flag
|
||||||
|
@ -105,7 +105,7 @@ pub struct HTMLInputElement {
|
||||||
|
|
||||||
#[derive(JSTraceable)]
|
#[derive(JSTraceable)]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
#[derive(HeapSizeOf)]
|
#[derive(MallocSizeOf)]
|
||||||
struct InputActivationState {
|
struct InputActivationState {
|
||||||
indeterminate: bool,
|
indeterminate: bool,
|
||||||
checked: bool,
|
checked: bool,
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue