aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2017-10-18 10:42:01 +1100
committerNicholas Nethercote <nnethercote@mozilla.com>2017-10-18 22:20:37 +1100
commit4506f0d30cbbb02df32e9c16135ef288ad6b7e2e (patch)
tree9a3de6bfdfabc6dee92352fb18df31e2468acf07 /components/script
parent421baa854ea40c7b1a3d1e75acac14da04a3fbcc (diff)
downloadservo-4506f0d30cbbb02df32e9c16135ef288ad6b7e2e.tar.gz
servo-4506f0d30cbbb02df32e9c16135ef288ad6b7e2e.zip
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`.
Diffstat (limited to 'components/script')
-rw-r--r--components/script/Cargo.toml8
-rw-r--r--components/script/body.rs2
-rw-r--r--components/script/document_loader.rs6
-rw-r--r--components/script/dom/bindings/cell.rs2
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py10
-rw-r--r--components/script/dom/bindings/error.rs2
-rw-r--r--components/script/dom/bindings/iterable.rs2
-rw-r--r--components/script/dom/bindings/num.rs8
-rw-r--r--components/script/dom/bindings/reflector.rs4
-rw-r--r--components/script/dom/bindings/root.rs32
-rw-r--r--components/script/dom/bindings/str.rs6
-rw-r--r--components/script/dom/bindings/utils.rs12
-rw-r--r--components/script/dom/bindings/weakref.rs12
-rw-r--r--components/script/dom/blob.rs2
-rw-r--r--components/script/dom/bluetooth.rs4
-rw-r--r--components/script/dom/canvasgradient.rs2
-rw-r--r--components/script/dom/canvasrenderingcontext2d.rs8
-rw-r--r--components/script/dom/client.rs2
-rw-r--r--components/script/dom/crypto.rs2
-rw-r--r--components/script/dom/cssfontfacerule.rs2
-rw-r--r--components/script/dom/cssgroupingrule.rs2
-rw-r--r--components/script/dom/cssimportrule.rs2
-rw-r--r--components/script/dom/csskeyframerule.rs2
-rw-r--r--components/script/dom/csskeyframesrule.rs2
-rw-r--r--components/script/dom/cssmediarule.rs2
-rw-r--r--components/script/dom/cssnamespacerule.rs2
-rw-r--r--components/script/dom/cssrulelist.rs2
-rw-r--r--components/script/dom/cssstyledeclaration.rs6
-rw-r--r--components/script/dom/cssstylerule.rs2
-rw-r--r--components/script/dom/cssstylesheet.rs2
-rw-r--r--components/script/dom/csssupportsrule.rs2
-rw-r--r--components/script/dom/cssviewportrule.rs2
-rw-r--r--components/script/dom/customelementregistry.rs32
-rw-r--r--components/script/dom/customevent.rs2
-rw-r--r--components/script/dom/dedicatedworkerglobalscope.rs10
-rw-r--r--components/script/dom/document.rs44
-rw-r--r--components/script/dom/domexception.rs2
-rw-r--r--components/script/dom/element.rs12
-rw-r--r--components/script/dom/errorevent.rs2
-rw-r--r--components/script/dom/event.rs8
-rw-r--r--components/script/dom/eventsource.rs10
-rw-r--r--components/script/dom/eventtarget.rs38
-rw-r--r--components/script/dom/filereader.rs10
-rw-r--r--components/script/dom/gamepad.rs2
-rw-r--r--components/script/dom/globalscope.rs12
-rw-r--r--components/script/dom/headers.rs4
-rwxr-xr-xcomponents/script/dom/htmlbuttonelement.rs2
-rw-r--r--components/script/dom/htmlcanvaselement.rs2
-rw-r--r--components/script/dom/htmlcollection.rs14
-rw-r--r--components/script/dom/htmldatalistelement.rs2
-rw-r--r--components/script/dom/htmlfieldsetelement.rs2
-rwxr-xr-xcomponents/script/dom/htmlformelement.rs20
-rw-r--r--components/script/dom/htmlheadingelement.rs2
-rw-r--r--components/script/dom/htmliframeelement.rs2
-rw-r--r--components/script/dom/htmlimageelement.rs10
-rwxr-xr-xcomponents/script/dom/htmlinputelement.rs6
-rw-r--r--components/script/dom/htmllinkelement.rs4
-rw-r--r--components/script/dom/htmlmediaelement.rs10
-rw-r--r--components/script/dom/htmlmetaelement.rs2
-rwxr-xr-xcomponents/script/dom/htmlobjectelement.rs2
-rw-r--r--components/script/dom/htmlscriptelement.rs2
-rwxr-xr-xcomponents/script/dom/htmlselectelement.rs2
-rw-r--r--components/script/dom/htmlstyleelement.rs2
-rw-r--r--components/script/dom/htmltableelement.rs2
-rwxr-xr-xcomponents/script/dom/htmltextareaelement.rs2
-rw-r--r--components/script/dom/keyboardevent.rs2
-rw-r--r--components/script/dom/medialist.rs2
-rw-r--r--components/script/dom/mediaquerylist.rs2
-rw-r--r--components/script/dom/mutationobserver.rs6
-rw-r--r--components/script/dom/node.rs16
-rw-r--r--components/script/dom/nodeiterator.rs4
-rw-r--r--components/script/dom/nodelist.rs6
-rw-r--r--components/script/dom/paintworkletglobalscope.rs4
-rw-r--r--components/script/dom/performance.rs4
-rw-r--r--components/script/dom/performanceobserver.rs2
-rw-r--r--components/script/dom/popstateevent.rs2
-rw-r--r--components/script/dom/promise.rs2
-rw-r--r--components/script/dom/promisenativehandler.rs4
-rw-r--r--components/script/dom/range.rs10
-rw-r--r--components/script/dom/request.rs2
-rw-r--r--components/script/dom/response.rs4
-rw-r--r--components/script/dom/serviceworkerglobalscope.rs8
-rw-r--r--components/script/dom/servoparser/async_html.rs30
-rw-r--r--components/script/dom/servoparser/html.rs4
-rw-r--r--components/script/dom/servoparser/mod.rs12
-rw-r--r--components/script/dom/servoparser/xml.rs4
-rw-r--r--components/script/dom/testbinding.rs8
-rw-r--r--components/script/dom/textdecoder.rs2
-rw-r--r--components/script/dom/treewalker.rs2
-rw-r--r--components/script/dom/urlhelper.rs2
-rwxr-xr-xcomponents/script/dom/validitystate.rs2
-rw-r--r--components/script/dom/vrdisplay.rs14
-rw-r--r--components/script/dom/vrdisplaycapabilities.rs2
-rw-r--r--components/script/dom/vreyeparameters.rs2
-rw-r--r--components/script/dom/vrfieldofview.rs2
-rw-r--r--components/script/dom/vrstageparameters.rs2
-rw-r--r--components/script/dom/webgl_extensions/extensions.rs18
-rw-r--r--components/script/dom/webgl_extensions/wrapper.rs12
-rw-r--r--components/script/dom/webgl_validations/types.rs2
-rw-r--r--components/script/dom/webglbuffer.rs2
-rw-r--r--components/script/dom/webglframebuffer.rs4
-rw-r--r--components/script/dom/webglprogram.rs2
-rw-r--r--components/script/dom/webglrenderbuffer.rs2
-rw-r--r--components/script/dom/webglrenderingcontext.rs18
-rw-r--r--components/script/dom/webglshader.rs4
-rw-r--r--components/script/dom/webgltexture.rs6
-rw-r--r--components/script/dom/websocket.rs4
-rw-r--r--components/script/dom/window.rs42
-rw-r--r--components/script/dom/worker.rs5
-rw-r--r--components/script/dom/workerglobalscope.rs8
-rw-r--r--components/script/dom/worklet.rs6
-rw-r--r--components/script/dom/workletglobalscope.rs4
-rw-r--r--components/script/dom/xmlhttprequest.rs22
-rw-r--r--components/script/lib.rs4
-rw-r--r--components/script/mem.rs16
-rw-r--r--components/script/microtask.rs8
-rw-r--r--components/script/script_thread.rs10
-rw-r--r--components/script/textinput.rs8
-rw-r--r--components/script/timers.rs40
119 files changed, 428 insertions, 421 deletions
diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml
index 7e0c4068cec..8c9e9613ede 100644
--- a/components/script/Cargo.toml
+++ b/components/script/Cargo.toml
@@ -44,9 +44,7 @@ euclid = "0.15"
fnv = "1.0"
gleam = "0.4"
half = "1.0"
-heapsize = "0.4"
-heapsize_derive = "0.1"
-html5ever = {version = "0.20", features = ["heap_size"]}
+html5ever = "0.20"
hyper = "0.10"
hyper_serde = "0.7"
image = "0.16"
@@ -56,6 +54,8 @@ jstraceable_derive = {path = "../jstraceable_derive"}
lazy_static = "0.2"
libc = "0.2"
log = "0.3.5"
+malloc_size_of = { path = "../malloc_size_of" }
+malloc_size_of_derive = { path = "../malloc_size_of_derive" }
metrics = {path = "../metrics"}
mitochondria = "1.1.2"
mime = "0.2.1"
@@ -89,7 +89,7 @@ style_traits = {path = "../style_traits"}
swapper = "0.1"
time = "0.1.12"
unicode-segmentation = "1.1.0"
-url = {version = "1.2", features = ["heap_size", "query_encoding"]}
+url = {version = "1.2", features = ["query_encoding"]}
utf-8 = "0.7"
uuid = {version = "0.5", features = ["v4"]}
xml5ever = {version = "0.10"}
diff --git a/components/script/body.rs b/components/script/body.rs
index bdeff81e163..21c4d49b58c 100644
--- a/components/script/body.rs
+++ b/components/script/body.rs
@@ -22,7 +22,7 @@ use std::rc::Rc;
use std::str;
use url::form_urlencoded;
-#[derive(Clone, Copy, HeapSizeOf, JSTraceable)]
+#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
pub enum BodyType {
Blob,
FormData,
diff --git a/components/script/document_loader.rs b/components/script/document_loader.rs
index f9a4325fbad..a50cea265fd 100644
--- a/components/script/document_loader.rs
+++ b/components/script/document_loader.rs
@@ -14,7 +14,7 @@ use net_traits::request::RequestInit;
use servo_url::ServoUrl;
use std::thread;
-#[derive(Clone, Debug, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum LoadType {
Image(ServoUrl),
Script(ServoUrl),
@@ -40,7 +40,7 @@ impl LoadType {
/// Canary value ensuring that manually added blocking loads (ie. ones that weren't
/// created via DocumentLoader::fetch_async) are always removed by the time
/// that the owner is destroyed.
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
pub struct LoadBlocker {
/// The document whose load event is blocked by this object existing.
@@ -81,7 +81,7 @@ impl Drop for LoadBlocker {
}
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub struct DocumentLoader {
resource_threads: ResourceThreads,
blocking_loads: Vec<LoadType>,
diff --git a/components/script/dom/bindings/cell.rs b/components/script/dom/bindings/cell.rs
index 2235e3ac769..3ba4fad6c66 100644
--- a/components/script/dom/bindings/cell.rs
+++ b/components/script/dom/bindings/cell.rs
@@ -11,7 +11,7 @@ use style::thread_state;
///
/// This extends the API of `std::cell::RefCell` to allow unsafe access in
/// certain situations, with dynamic checking in debug builds.
-#[derive(Clone, Debug, Default, HeapSizeOf, PartialEq)]
+#[derive(Clone, Debug, Default, MallocSizeOf, PartialEq)]
pub struct DomRefCell<T> {
value: RefCell<T>,
}
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index d0b5e678db8..3251290f398 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -2029,7 +2029,7 @@ def DOMClass(descriptor):
# padding.
protoList.extend(['PrototypeList::ID::Last'] * (descriptor.config.maxProtoChainLength - len(protoList)))
prototypeChainString = ', '.join(protoList)
- heapSizeOf = 'heap_size_of_raw_self_and_children::<%s>' % descriptor.concreteType
+ mallocSizeOf = 'malloc_size_of_including_raw_self::<%s>' % descriptor.concreteType
if descriptor.isGlobal():
globals_ = camel_to_upper_snake(descriptor.name)
else:
@@ -2038,9 +2038,9 @@ def DOMClass(descriptor):
DOMClass {
interface_chain: [ %s ],
type_id: %s,
- heap_size_of: %s as unsafe fn(_) -> _,
+ malloc_size_of: %s as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::%s,
-}""" % (prototypeChainString, DOMClassTypeId(descriptor), heapSizeOf, globals_)
+}""" % (prototypeChainString, DOMClassTypeId(descriptor), mallocSizeOf, globals_)
class CGDOMJSClass(CGThing):
@@ -4005,7 +4005,7 @@ class CGEnum(CGThing):
ident = enum.identifier.name
decl = """\
#[repr(usize)]
-#[derive(JSTraceable, PartialEq, Copy, Clone, HeapSizeOf, Debug)]
+#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum %s {
%s
}
@@ -5794,7 +5794,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
'dom::bindings::weakref::WeakReferenceable',
'dom::windowproxy::WindowProxy',
'dom::globalscope::GlobalScope',
- 'mem::heap_size_of_raw_self_and_children',
+ 'mem::malloc_size_of_including_raw_self',
'libc',
'servo_config::prefs::PREFS',
'std::borrow::ToOwned',
diff --git a/components/script/dom/bindings/error.rs b/components/script/dom/bindings/error.rs
index 2cbbe2da647..9ff6aa92429 100644
--- a/components/script/dom/bindings/error.rs
+++ b/components/script/dom/bindings/error.rs
@@ -25,7 +25,7 @@ use libc::c_uint;
use std::slice::from_raw_parts;
/// DOM exceptions that can be thrown by a native DOM method.
-#[derive(Clone, Debug, HeapSizeOf)]
+#[derive(Clone, Debug, MallocSizeOf)]
pub enum Error {
/// IndexSizeError DOMException
IndexSize,
diff --git a/components/script/dom/bindings/iterable.rs b/components/script/dom/bindings/iterable.rs
index 779695918c9..183c17a2578 100644
--- a/components/script/dom/bindings/iterable.rs
+++ b/components/script/dom/bindings/iterable.rs
@@ -22,7 +22,7 @@ use std::cell::Cell;
use std::ptr;
/// The values that an iterator will iterate over.
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub enum IteratorType {
/// The keys of the iterable object.
Keys,
diff --git a/components/script/dom/bindings/num.rs b/components/script/dom/bindings/num.rs
index f7604cfab20..79480574f4d 100644
--- a/components/script/dom/bindings/num.rs
+++ b/components/script/dom/bindings/num.rs
@@ -4,7 +4,7 @@
//! The `Finite<T>` struct.
-use heapsize::HeapSizeOf;
+use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use num_traits::Float;
use std::default::Default;
use std::ops::Deref;
@@ -41,9 +41,9 @@ impl<T: Float> Deref for Finite<T> {
}
}
-impl<T: Float + HeapSizeOf> HeapSizeOf for Finite<T> {
- fn heap_size_of_children(&self) -> usize {
- (**self).heap_size_of_children()
+impl<T: Float + MallocSizeOf> MallocSizeOf for Finite<T> {
+ fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
+ (**self).size_of(ops)
}
}
diff --git a/components/script/dom/bindings/reflector.rs b/components/script/dom/bindings/reflector.rs
index 6a47b7d3c07..0fef0a30678 100644
--- a/components/script/dom/bindings/reflector.rs
+++ b/components/script/dom/bindings/reflector.rs
@@ -27,11 +27,11 @@ pub fn reflect_dom_object<T, U>(
/// A struct to store a reference to the reflector of a DOM object.
#[allow(unrooted_must_root)]
-#[derive(HeapSizeOf)]
+#[derive(MallocSizeOf)]
#[must_root]
// If you're renaming or moving this field, update the path in plugins::reflector as well
pub struct Reflector {
- #[ignore_heap_size_of = "defined and measured in rust-mozjs"]
+ #[ignore_malloc_size_of = "defined and measured in rust-mozjs"]
object: Heap<*mut JSObject>,
}
diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs
index e2c474cafd5..636c14b4d5c 100644
--- a/components/script/dom/bindings/root.rs
+++ b/components/script/dom/bindings/root.rs
@@ -30,9 +30,9 @@ use dom::bindings::reflector::{DomObject, Reflector};
use dom::bindings::trace::JSTraceable;
use dom::bindings::trace::trace_reflector;
use dom::node::Node;
-use heapsize::HeapSizeOf;
use js::jsapi::{JSObject, JSTracer, Heap};
use js::rust::GCMethods;
+use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use mitochondria::OnceCell;
use nonzero::NonZero;
use script_layout_interface::TrustedNodeAddress;
@@ -157,12 +157,12 @@ impl<T: DomObject> DomRoot<T> {
}
}
-impl<T> HeapSizeOf for DomRoot<T>
+impl<T> MallocSizeOf for DomRoot<T>
where
- T: DomObject + HeapSizeOf,
+ T: DomObject + MallocSizeOf,
{
- fn heap_size_of_children(&self) -> usize {
- (**self).heap_size_of_children()
+ fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
+ (**self).size_of(ops)
}
}
@@ -317,8 +317,8 @@ pub struct Dom<T> {
// Dom<T> is similar to Rc<T>, in that it's not always clear how to avoid double-counting.
// For now, we choose not to follow any such pointers.
-impl<T> HeapSizeOf for Dom<T> {
- fn heap_size_of_children(&self) -> usize {
+impl<T> MallocSizeOf for Dom<T> {
+ fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
0
}
}
@@ -516,9 +516,9 @@ impl<T: DomObject> MutDom<T> {
}
}
-impl<T: DomObject> HeapSizeOf for MutDom<T> {
- fn heap_size_of_children(&self) -> usize {
- // See comment on HeapSizeOf for Dom<T>.
+impl<T: DomObject> MallocSizeOf for MutDom<T> {
+ fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
+ // See comment on MallocSizeOf for Dom<T>.
0
}
}
@@ -635,9 +635,9 @@ impl<T: DomObject> Default for MutNullableDom<T> {
}
}
-impl<T: DomObject> HeapSizeOf for MutNullableDom<T> {
- fn heap_size_of_children(&self) -> usize {
- // See comment on HeapSizeOf for Dom<T>.
+impl<T: DomObject> MallocSizeOf for MutNullableDom<T> {
+ fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
+ // See comment on MallocSizeOf for Dom<T>.
0
}
}
@@ -678,9 +678,9 @@ impl<T: DomObject> Default for DomOnceCell<T> {
}
}
-impl<T: DomObject> HeapSizeOf for DomOnceCell<T> {
- fn heap_size_of_children(&self) -> usize {
- // See comment on HeapSizeOf for Dom<T>.
+impl<T: DomObject> MallocSizeOf for DomOnceCell<T> {
+ fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
+ // See comment on MallocSizeOf for Dom<T>.
0
}
}
diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs
index b665b64da8a..af33f662ff7 100644
--- a/components/script/dom/bindings/str.rs
+++ b/components/script/dom/bindings/str.rs
@@ -19,7 +19,7 @@ use std::str;
use std::str::{Bytes, FromStr};
/// Encapsulates the IDL `ByteString` type.
-#[derive(Clone, Debug, Default, Eq, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Debug, Default, Eq, JSTraceable, MallocSizeOf, PartialEq)]
pub struct ByteString(Vec<u8>);
impl ByteString {
@@ -78,7 +78,7 @@ impl ops::Deref for ByteString {
/// A string that is constructed from a UCS-2 buffer by replacing invalid code
/// points with the replacement character.
-#[derive(Clone, Default, HeapSizeOf)]
+#[derive(Clone, Default, MallocSizeOf)]
pub struct USVString(pub String);
@@ -153,7 +153,7 @@ pub fn is_token(s: &[u8]) -> bool {
///
/// This type is currently `!Send`, in order to help with an independent
/// experiment to store `JSString`s rather than Rust `String`s.
-#[derive(Clone, Debug, Eq, Hash, HeapSizeOf, Ord, PartialEq, PartialOrd)]
+#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd)]
pub struct DOMString(String, PhantomData<*const ()>);
impl DOMString {
diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs
index 5ecca038de9..2a23281c8fe 100644
--- a/components/script/dom/bindings/utils.rs
+++ b/components/script/dom/bindings/utils.rs
@@ -13,7 +13,6 @@ use dom::bindings::inheritance::TopTypeId;
use dom::bindings::str::DOMString;
use dom::bindings::trace::trace_object;
use dom::windowproxy;
-use heapsize::HeapSizeOf;
use js;
use js::JS_CALLEE;
use js::glue::{CallJitGetterOp, CallJitMethodOp, CallJitSetterOp, IsWrapper};
@@ -32,6 +31,7 @@ use js::jsapi::{JS_StringHasLatin1Chars, MutableHandleValue, ObjectOpResult};
use js::jsval::{JSVal, UndefinedValue};
use js::rust::{GCMethods, ToString, get_object_class, is_dom_class};
use libc;
+use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use std::ffi::CString;
use std::os::raw::{c_char, c_void};
use std::ptr;
@@ -40,14 +40,14 @@ use std::slice;
/// Proxy handler for a WindowProxy.
pub struct WindowProxyHandler(pub *const libc::c_void);
-impl HeapSizeOf for WindowProxyHandler {
- fn heap_size_of_children(&self) -> usize {
+impl MallocSizeOf for WindowProxyHandler {
+ fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
// FIXME(#6907) this is a pointer to memory allocated by `new` in NewProxyHandler in rust-mozjs.
0
}
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
/// Static data associated with a global object.
pub struct GlobalStaticData {
/// The WindowProxy proxy handler for this global.
@@ -88,8 +88,8 @@ pub struct DOMClass {
/// The type ID of that interface.
pub type_id: TopTypeId,
- /// The HeapSizeOf function wrapper for that interface.
- pub heap_size_of: unsafe fn(*const c_void) -> usize,
+ /// The MallocSizeOf function wrapper for that interface.
+ pub malloc_size_of: unsafe fn(ops: &mut MallocSizeOfOps, *const c_void) -> usize,
/// The `Globals` flag for this global interface, if any.
pub global: InterfaceObjectMap::Globals,
diff --git a/components/script/dom/bindings/weakref.rs b/components/script/dom/bindings/weakref.rs
index 36eac4c4f32..2aa12490867 100644
--- a/components/script/dom/bindings/weakref.rs
+++ b/components/script/dom/bindings/weakref.rs
@@ -14,10 +14,10 @@
use dom::bindings::reflector::DomObject;
use dom::bindings::root::DomRoot;
use dom::bindings::trace::JSTraceable;
-use heapsize::HeapSizeOf;
use js::jsapi::{JSTracer, JS_GetReservedSlot, JS_SetReservedSlot};
use js::jsval::PrivateValue;
use libc::c_void;
+use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use nonzero::NonZero;
use std::cell::{Cell, UnsafeCell};
use std::mem;
@@ -110,8 +110,8 @@ impl<T: WeakReferenceable> Clone for WeakRef<T> {
}
}
-impl<T: WeakReferenceable> HeapSizeOf for WeakRef<T> {
- fn heap_size_of_children(&self) -> usize {
+impl<T: WeakReferenceable> MallocSizeOf for WeakRef<T> {
+ fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
0
}
}
@@ -188,8 +188,8 @@ impl<T: WeakReferenceable> MutableWeakRef<T> {
}
}
-impl<T: WeakReferenceable> HeapSizeOf for MutableWeakRef<T> {
- fn heap_size_of_children(&self) -> usize {
+impl<T: WeakReferenceable> MallocSizeOf for MutableWeakRef<T> {
+ fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
0
}
}
@@ -210,7 +210,7 @@ unsafe impl<T: WeakReferenceable> JSTraceable for MutableWeakRef<T> {
/// A vector of weak references. On tracing, the vector retains
/// only references which still point to live objects.
#[allow_unrooted_interior]
-#[derive(HeapSizeOf)]
+#[derive(MallocSizeOf)]
pub struct WeakRefVec<T: WeakReferenceable> {
vec: Vec<WeakRef<T>>,
}
diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs
index a436564f4f2..394efd4647d 100644
--- a/components/script/dom/blob.rs
+++ b/components/script/dom/blob.rs
@@ -69,7 +69,7 @@ impl BlobImpl {
#[dom_struct]
pub struct Blob {
reflector_: Reflector,
- #[ignore_heap_size_of = "No clear owner"]
+ #[ignore_malloc_size_of = "No clear owner"]
blob_impl: DomRefCell<BlobImpl>,
/// content-type string
type_string: String,
diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs
index f9ab60ec59c..44cf83df5d8 100644
--- a/components/script/dom/bluetooth.rs
+++ b/components/script/dom/bluetooth.rs
@@ -56,13 +56,13 @@ const OPTIONS_ERROR: &'static str = "Fields of 'options' conflict with each othe
Either 'acceptAllDevices' member must be true, or 'filters' member must be set to a value.";
const BT_DESC_CONVERSION_ERROR: &'static str = "Can't convert to an IDL value of type BluetoothPermissionDescriptor";
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub struct AllowedBluetoothDevice {
pub deviceId: DOMString,
pub mayUseGATT: bool,
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub struct BluetoothExtraPermissionData {
allowed_devices: DomRefCell<Vec<AllowedBluetoothDevice>>,
}
diff --git a/components/script/dom/canvasgradient.rs b/components/script/dom/canvasgradient.rs
index 6ae52be6764..ab6ad47d905 100644
--- a/components/script/dom/canvasgradient.rs
+++ b/components/script/dom/canvasgradient.rs
@@ -24,7 +24,7 @@ pub struct CanvasGradient {
stops: DomRefCell<Vec<CanvasGradientStop>>,
}
-#[derive(Clone, HeapSizeOf, JSTraceable)]
+#[derive(Clone, JSTraceable, MallocSizeOf)]
pub enum CanvasGradientStyle {
Linear(LinearGradientStyle),
Radial(RadialGradientStyle),
diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs
index 69cf670efe4..cf6b92bc404 100644
--- a/components/script/dom/canvasrenderingcontext2d.rs
+++ b/components/script/dom/canvasrenderingcontext2d.rs
@@ -51,7 +51,7 @@ use std::sync::Arc;
use unpremultiplytable::UNPREMULTIPLY_TABLE;
#[must_root]
-#[derive(Clone, HeapSizeOf, JSTraceable)]
+#[derive(Clone, JSTraceable, MallocSizeOf)]
#[allow(dead_code)]
enum CanvasFillOrStrokeStyle {
Color(RGBA),
@@ -63,12 +63,12 @@ enum CanvasFillOrStrokeStyle {
#[dom_struct]
pub struct CanvasRenderingContext2D {
reflector_: Reflector,
- #[ignore_heap_size_of = "Defined in ipc-channel"]
+ #[ignore_malloc_size_of = "Defined in ipc-channel"]
ipc_renderer: IpcSender<CanvasMsg>,
/// For rendering contexts created by an HTML canvas element, this is Some,
/// for ones created by a paint worklet, this is None.
canvas: Option<Dom<HTMLCanvasElement>>,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
image_cache: Arc<ImageCache>,
/// Any missing image URLs.
missing_image_urls: DomRefCell<Vec<ServoUrl>>,
@@ -81,7 +81,7 @@ pub struct CanvasRenderingContext2D {
}
#[must_root]
-#[derive(Clone, HeapSizeOf, JSTraceable)]
+#[derive(Clone, JSTraceable, MallocSizeOf)]
struct CanvasContextState {
global_alpha: f64,
global_composition: CompositionOrBlending,
diff --git a/components/script/dom/client.rs b/components/script/dom/client.rs
index 94ddc15535f..7c68daecdb3 100644
--- a/components/script/dom/client.rs
+++ b/components/script/dom/client.rs
@@ -20,7 +20,7 @@ pub struct Client {
active_worker: MutNullableDom<ServiceWorker>,
url: ServoUrl,
frame_type: FrameType,
- #[ignore_heap_size_of = "Defined in uuid"]
+ #[ignore_malloc_size_of = "Defined in uuid"]
id: Uuid
}
diff --git a/components/script/dom/crypto.rs b/components/script/dom/crypto.rs
index ac56e9f3ff6..1a13194151c 100644
--- a/components/script/dom/crypto.rs
+++ b/components/script/dom/crypto.rs
@@ -21,7 +21,7 @@ unsafe_no_jsmanaged_fields!(ServoRng);
#[dom_struct]
pub struct Crypto {
reflector_: Reflector,
- #[ignore_heap_size_of = "Defined in rand"]
+ #[ignore_malloc_size_of = "Defined in rand"]
rng: DomRefCell<ServoRng>,
}
diff --git a/components/script/dom/cssfontfacerule.rs b/components/script/dom/cssfontfacerule.rs
index 3bc836897ea..8f2970abc39 100644
--- a/components/script/dom/cssfontfacerule.rs
+++ b/components/script/dom/cssfontfacerule.rs
@@ -17,7 +17,7 @@ use style::stylesheets::FontFaceRule;
#[dom_struct]
pub struct CSSFontFaceRule {
cssrule: CSSRule,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
fontfacerule: Arc<Locked<FontFaceRule>>,
}
diff --git a/components/script/dom/cssgroupingrule.rs b/components/script/dom/cssgroupingrule.rs
index dec666c825e..21c744118ea 100644
--- a/components/script/dom/cssgroupingrule.rs
+++ b/components/script/dom/cssgroupingrule.rs
@@ -19,7 +19,7 @@ use style::stylesheets::CssRules as StyleCssRules;
#[dom_struct]
pub struct CSSGroupingRule {
cssrule: CSSRule,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
rules: Arc<Locked<StyleCssRules>>,
rulelist: MutNullableDom<CSSRuleList>,
}
diff --git a/components/script/dom/cssimportrule.rs b/components/script/dom/cssimportrule.rs
index 373c230ee77..989917700ac 100644
--- a/components/script/dom/cssimportrule.rs
+++ b/components/script/dom/cssimportrule.rs
@@ -17,7 +17,7 @@ use style::stylesheets::ImportRule;
#[dom_struct]
pub struct CSSImportRule {
cssrule: CSSRule,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
import_rule: Arc<Locked<ImportRule>>,
}
diff --git a/components/script/dom/csskeyframerule.rs b/components/script/dom/csskeyframerule.rs
index f62d73f0b46..63ec6e1d016 100644
--- a/components/script/dom/csskeyframerule.rs
+++ b/components/script/dom/csskeyframerule.rs
@@ -19,7 +19,7 @@ use style::stylesheets::keyframes_rule::Keyframe;
#[dom_struct]
pub struct CSSKeyframeRule {
cssrule: CSSRule,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
keyframerule: Arc<Locked<Keyframe>>,
style_decl: MutNullableDom<CSSStyleDeclaration>,
}
diff --git a/components/script/dom/csskeyframesrule.rs b/components/script/dom/csskeyframesrule.rs
index 955f0c04fb5..7f1c212057d 100644
--- a/components/script/dom/csskeyframesrule.rs
+++ b/components/script/dom/csskeyframesrule.rs
@@ -24,7 +24,7 @@ use style::values::KeyframesName;
#[dom_struct]
pub struct CSSKeyframesRule {
cssrule: CSSRule,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
keyframesrule: Arc<Locked<KeyframesRule>>,
rulelist: MutNullableDom<CSSRuleList>,
}
diff --git a/components/script/dom/cssmediarule.rs b/components/script/dom/cssmediarule.rs
index 3444d494f16..dc4a4c411a5 100644
--- a/components/script/dom/cssmediarule.rs
+++ b/components/script/dom/cssmediarule.rs
@@ -25,7 +25,7 @@ use style_traits::{PARSING_MODE_DEFAULT, ToCss};
#[dom_struct]
pub struct CSSMediaRule {
cssconditionrule: CSSConditionRule,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
mediarule: Arc<Locked<MediaRule>>,
medialist: MutNullableDom<MediaList>,
}
diff --git a/components/script/dom/cssnamespacerule.rs b/components/script/dom/cssnamespacerule.rs
index 40047252680..f585f420732 100644
--- a/components/script/dom/cssnamespacerule.rs
+++ b/components/script/dom/cssnamespacerule.rs
@@ -18,7 +18,7 @@ use style::stylesheets::NamespaceRule;
#[dom_struct]
pub struct CSSNamespaceRule {
cssrule: CSSRule,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
namespacerule: Arc<Locked<NamespaceRule>>,
}
diff --git a/components/script/dom/cssrulelist.rs b/components/script/dom/cssrulelist.rs
index 81b58afc0f8..1f800a6a0b4 100644
--- a/components/script/dom/cssrulelist.rs
+++ b/components/script/dom/cssrulelist.rs
@@ -37,7 +37,7 @@ impl From<RulesMutateError> for Error {
pub struct CSSRuleList {
reflector_: Reflector,
parent_stylesheet: Dom<CSSStyleSheet>,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
rules: RulesSource,
dom_rules: DomRefCell<Vec<MutNullableDom<CSSRule>>>
}
diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs
index f7264d9f5d0..e20d4e82e3f 100644
--- a/components/script/dom/cssstyledeclaration.rs
+++ b/components/script/dom/cssstyledeclaration.rs
@@ -33,12 +33,12 @@ pub struct CSSStyleDeclaration {
pseudo: Option<PseudoElement>,
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
pub enum CSSStyleOwner {
Element(Dom<Element>),
CSSRule(Dom<CSSRule>,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
Arc<Locked<PropertyDeclarationBlock>>),
}
@@ -154,7 +154,7 @@ impl CSSStyleOwner {
}
}
-#[derive(HeapSizeOf, PartialEq)]
+#[derive(MallocSizeOf, PartialEq)]
pub enum CSSModificationAccess {
ReadWrite,
Readonly,
diff --git a/components/script/dom/cssstylerule.rs b/components/script/dom/cssstylerule.rs
index 7c73bbc58c3..0e9f001dc05 100644
--- a/components/script/dom/cssstylerule.rs
+++ b/components/script/dom/cssstylerule.rs
@@ -25,7 +25,7 @@ use style::stylesheets::{StyleRule, Origin};
#[dom_struct]
pub struct CSSStyleRule {
cssrule: CSSRule,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
stylerule: Arc<Locked<StyleRule>>,
style_decl: MutNullableDom<CSSStyleDeclaration>,
}
diff --git a/components/script/dom/cssstylesheet.rs b/components/script/dom/cssstylesheet.rs
index de3d3cc0f6d..d393b1f3ff7 100644
--- a/components/script/dom/cssstylesheet.rs
+++ b/components/script/dom/cssstylesheet.rs
@@ -24,7 +24,7 @@ pub struct CSSStyleSheet {
stylesheet: StyleSheet,
owner: Dom<Element>,
rulelist: MutNullableDom<CSSRuleList>,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
style_stylesheet: Arc<StyleStyleSheet>,
origin_clean: Cell<bool>,
}
diff --git a/components/script/dom/csssupportsrule.rs b/components/script/dom/csssupportsrule.rs
index 0f6a6530233..d9e3f8ac8a0 100644
--- a/components/script/dom/csssupportsrule.rs
+++ b/components/script/dom/csssupportsrule.rs
@@ -23,7 +23,7 @@ use style_traits::{PARSING_MODE_DEFAULT, ToCss};
#[dom_struct]
pub struct CSSSupportsRule {
cssconditionrule: CSSConditionRule,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
supportsrule: Arc<Locked<SupportsRule>>,
}
diff --git a/components/script/dom/cssviewportrule.rs b/components/script/dom/cssviewportrule.rs
index 694636be323..89e523cdc39 100644
--- a/components/script/dom/cssviewportrule.rs
+++ b/components/script/dom/cssviewportrule.rs
@@ -17,7 +17,7 @@ use style::stylesheets::ViewportRule;
#[dom_struct]
pub struct CSSViewportRule {
cssrule: CSSRule,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
viewportrule: Arc<Locked<ViewportRule>>,
}
diff --git a/components/script/dom/customelementregistry.rs b/components/script/dom/customelementregistry.rs
index 319424a25ff..21276d8f5bb 100644
--- a/components/script/dom/customelementregistry.rs
+++ b/components/script/dom/customelementregistry.rs
@@ -47,12 +47,12 @@ pub struct CustomElementRegistry {
window: Dom<Window>,
- #[ignore_heap_size_of = "Rc"]
+ #[ignore_malloc_size_of = "Rc"]
when_defined: DomRefCell<HashMap<LocalName, Rc<Promise>>>,
element_definition_is_running: Cell<bool>,
- #[ignore_heap_size_of = "Rc"]
+ #[ignore_malloc_size_of = "Rc"]
definitions: DomRefCell<HashMap<LocalName, Rc<CustomElementDefinition>>>,
}
@@ -369,35 +369,35 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
}
}
-#[derive(Clone, HeapSizeOf, JSTraceable)]
+#[derive(Clone, JSTraceable, MallocSizeOf)]
pub struct LifecycleCallbacks {
- #[ignore_heap_size_of = "Rc"]
+ #[ignore_malloc_size_of = "Rc"]
connected_callback: Option<Rc<Function>>,
- #[ignore_heap_size_of = "Rc"]
+ #[ignore_malloc_size_of = "Rc"]
disconnected_callback: Option<Rc<Function>>,
- #[ignore_heap_size_of = "Rc"]
+ #[ignore_malloc_size_of = "Rc"]
adopted_callback: Option<Rc<Function>>,
- #[ignore_heap_size_of = "Rc"]
+ #[ignore_malloc_size_of = "Rc"]
attribute_changed_callback: Option<Rc<Function>>,
}
-#[derive(Clone, HeapSizeOf, JSTraceable)]
+#[derive(Clone, JSTraceable, MallocSizeOf)]
pub enum ConstructionStackEntry {
Element(DomRoot<Element>),
AlreadyConstructedMarker,
}
/// <https://html.spec.whatwg.org/multipage/#custom-element-definition>
-#[derive(Clone, HeapSizeOf, JSTraceable)]
+#[derive(Clone, JSTraceable, MallocSizeOf)]
pub struct CustomElementDefinition {
pub name: LocalName,
pub local_name: LocalName,
- #[ignore_heap_size_of = "Rc"]
+ #[ignore_malloc_size_of = "Rc"]
pub constructor: Rc<Function>,
pub observed_attributes: Vec<DOMString>,
@@ -580,15 +580,15 @@ pub fn try_upgrade_element(element: &Element) {
}
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
pub enum CustomElementReaction {
Upgrade(
- #[ignore_heap_size_of = "Rc"]
+ #[ignore_malloc_size_of = "Rc"]
Rc<CustomElementDefinition>
),
Callback(
- #[ignore_heap_size_of = "Rc"]
+ #[ignore_malloc_size_of = "Rc"]
Rc<Function>,
Box<[Heap<JSVal>]>
),
@@ -617,14 +617,14 @@ pub enum CallbackReaction {
}
/// <https://html.spec.whatwg.org/multipage/#processing-the-backup-element-queue>
-#[derive(Clone, Copy, Eq, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, Eq, JSTraceable, MallocSizeOf, PartialEq)]
enum BackupElementQueueFlag {
Processing,
NotProcessing,
}
/// <https://html.spec.whatwg.org/multipage/#custom-element-reactions-stack>
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
pub struct CustomElementReactionStack {
stack: DomRefCell<Vec<ElementQueue>>,
@@ -773,7 +773,7 @@ impl CustomElementReactionStack {
}
/// <https://html.spec.whatwg.org/multipage/#element-queue>
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
struct ElementQueue {
queue: DomRefCell<VecDeque<Dom<Element>>>,
diff --git a/components/script/dom/customevent.rs b/components/script/dom/customevent.rs
index e78ac74bd84..ee62fd2a854 100644
--- a/components/script/dom/customevent.rs
+++ b/components/script/dom/customevent.rs
@@ -22,7 +22,7 @@ use servo_atoms::Atom;
#[dom_struct]
pub struct CustomEvent {
event: Event,
- #[ignore_heap_size_of = "Defined in rust-mozjs"]
+ #[ignore_malloc_size_of = "Defined in rust-mozjs"]
detail: Heap<JSVal>,
}
diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs
index 33f08793b56..a754bbc4c6a 100644
--- a/components/script/dom/dedicatedworkerglobalscope.rs
+++ b/components/script/dom/dedicatedworkerglobalscope.rs
@@ -80,15 +80,15 @@ enum MixedMessage {
#[dom_struct]
pub struct DedicatedWorkerGlobalScope {
workerglobalscope: WorkerGlobalScope,
- #[ignore_heap_size_of = "Defined in std"]
+ #[ignore_malloc_size_of = "Defined in std"]
receiver: Receiver<(TrustedWorkerAddress, WorkerScriptMsg)>,
- #[ignore_heap_size_of = "Defined in std"]
+ #[ignore_malloc_size_of = "Defined in std"]
own_sender: Sender<(TrustedWorkerAddress, WorkerScriptMsg)>,
- #[ignore_heap_size_of = "Defined in std"]
+ #[ignore_malloc_size_of = "Defined in std"]
timer_event_port: Receiver<(TrustedWorkerAddress, TimerEvent)>,
- #[ignore_heap_size_of = "Trusted<T> has unclear ownership like Dom<T>"]
+ #[ignore_malloc_size_of = "Trusted<T> has unclear ownership like Dom<T>"]
worker: DomRefCell<Option<TrustedWorkerAddress>>,
- #[ignore_heap_size_of = "Can't measure trait objects"]
+ #[ignore_malloc_size_of = "Can't measure trait objects"]
/// Sender to the parent thread.
parent_sender: Box<ScriptChan + Send>,
}
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index fd8bf37a897..09212135dd2 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -158,13 +158,13 @@ pub enum TouchEventResult {
Forwarded,
}
-#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum IsHTMLDocument {
HTMLDocument,
NonHTMLDocument,
}
-#[derive(Debug, HeapSizeOf)]
+#[derive(Debug, MallocSizeOf)]
pub struct PendingRestyle {
/// If this element had a state or attribute change since the last restyle, track
/// the original condition of the element.
@@ -187,10 +187,10 @@ impl PendingRestyle {
}
}
-#[derive(Clone, HeapSizeOf, JSTraceable)]
+#[derive(Clone, JSTraceable, MallocSizeOf)]
#[must_root]
struct StyleSheetInDocument {
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
sheet: Arc<Stylesheet>,
owner: Dom<Element>,
}
@@ -228,7 +228,7 @@ pub struct Document {
is_html_document: bool,
activity: Cell<DocumentActivity>,
url: DomRefCell<ServoUrl>,
- #[ignore_heap_size_of = "defined in selectors"]
+ #[ignore_malloc_size_of = "defined in selectors"]
quirks_mode: Cell<QuirksMode>,
/// Caches for the getElement methods
id_map: DomRefCell<HashMap<Atom, Vec<Dom<Element>>>>,
@@ -321,7 +321,7 @@ pub struct Document {
/// <https://html.spec.whatwg.org/multipage/#target-element>
target_element: MutNullableDom<Element>,
/// <https://w3c.github.io/uievents/#event-type-dblclick>
- #[ignore_heap_size_of = "Defined in std"]
+ #[ignore_malloc_size_of = "Defined in std"]
last_click_info: DomRefCell<Option<(Instant, Point2D<f32>)>>,
/// <https://html.spec.whatwg.org/multipage/#ignore-destructive-writes-counter>
ignore_destructive_writes_counter: Cell<u32>,
@@ -346,7 +346,7 @@ pub struct Document {
form_id_listener_map: DomRefCell<HashMap<Atom, HashSet<Dom<Element>>>>,
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
struct ImagesFilter;
impl CollectionFilter for ImagesFilter {
fn filter(&self, elem: &Element, _root: &Node) -> bool {
@@ -354,7 +354,7 @@ impl CollectionFilter for ImagesFilter {
}
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
struct EmbedsFilter;
impl CollectionFilter for EmbedsFilter {
fn filter(&self, elem: &Element, _root: &Node) -> bool {
@@ -362,7 +362,7 @@ impl CollectionFilter for EmbedsFilter {
}
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
struct LinksFilter;
impl CollectionFilter for LinksFilter {
fn filter(&self, elem: &Element, _root: &Node) -> bool {
@@ -371,7 +371,7 @@ impl CollectionFilter for LinksFilter {
}
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
struct FormsFilter;
impl CollectionFilter for FormsFilter {
fn filter(&self, elem: &Element, _root: &Node) -> bool {
@@ -379,7 +379,7 @@ impl CollectionFilter for FormsFilter {
}
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
struct ScriptsFilter;
impl CollectionFilter for ScriptsFilter {
fn filter(&self, elem: &Element, _root: &Node) -> bool {
@@ -387,7 +387,7 @@ impl CollectionFilter for ScriptsFilter {
}
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
struct AnchorsFilter;
impl CollectionFilter for AnchorsFilter {
fn filter(&self, elem: &Element, _root: &Node) -> bool {
@@ -395,7 +395,7 @@ impl CollectionFilter for AnchorsFilter {
}
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
struct AppletsFilter;
impl CollectionFilter for AppletsFilter {
fn filter(&self, elem: &Element, _root: &Node) -> bool {
@@ -1978,7 +1978,7 @@ impl Document {
}
}
-#[derive(HeapSizeOf, PartialEq)]
+#[derive(MallocSizeOf, PartialEq)]
pub enum DocumentSource {
FromParser,
NotFromParser,
@@ -2092,7 +2092,7 @@ fn url_has_network_scheme(url: &ServoUrl) -> bool {
}
}
-#[derive(Clone, Copy, Eq, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, Eq, JSTraceable, MallocSizeOf, PartialEq)]
pub enum HasBrowsingContext {
No,
Yes,
@@ -3470,7 +3470,7 @@ impl DocumentMethods for Document {
#[allow(unsafe_code)]
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:dom-document-nameditem-filter
unsafe fn NamedGetter(&self, _cx: *mut JSContext, name: DOMString) -> Option<NonNullJSObjectPtr> {
- #[derive(HeapSizeOf, JSTraceable)]
+ #[derive(JSTraceable, MallocSizeOf)]
struct NamedElementFilter {
name: Atom,
}
@@ -3945,10 +3945,10 @@ pub enum FocusEventType {
/// If the page is observed to be using `requestAnimationFrame()` for non-animation purposes (i.e.
/// without mutating the DOM), then we fall back to simple timeouts to save energy over video
/// refresh.
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub struct FakeRequestAnimationFrameCallback {
/// The document.
- #[ignore_heap_size_of = "non-owning"]
+ #[ignore_malloc_size_of = "non-owning"]
document: Trusted<Document>,
}
@@ -3959,11 +3959,11 @@ impl FakeRequestAnimationFrameCallback {
}
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub enum AnimationFrameCallback {
DevtoolsFramerateTick { actor_name: String },
FrameRequestCallback {
- #[ignore_heap_size_of = "Rc is hard"]
+ #[ignore_malloc_size_of = "Rc is hard"]
callback: Rc<FrameRequestCallback>
},
}
@@ -3985,7 +3985,7 @@ impl AnimationFrameCallback {
}
}
-#[derive(Default, HeapSizeOf, JSTraceable)]
+#[derive(Default, JSTraceable, MallocSizeOf)]
#[must_root]
struct PendingInOrderScriptVec {
scripts: DomRefCell<VecDeque<PendingScript>>,
@@ -4021,7 +4021,7 @@ impl PendingInOrderScriptVec {
}
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
struct PendingScript {
element: Dom<HTMLScriptElement>,
diff --git a/components/script/dom/domexception.rs b/components/script/dom/domexception.rs
index 4e661dc52c7..e94689b242b 100644
--- a/components/script/dom/domexception.rs
+++ b/components/script/dom/domexception.rs
@@ -12,7 +12,7 @@ use dom::globalscope::GlobalScope;
use dom_struct::dom_struct;
#[repr(u16)]
-#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable)]
+#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf)]
pub enum DOMErrorName {
IndexSizeError = DOMExceptionConstants::INDEX_SIZE_ERR,
HierarchyRequestError = DOMExceptionConstants::HIERARCHY_REQUEST_ERR,
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index 595fe67e0eb..9045918d2f8 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -140,7 +140,7 @@ pub struct Element {
attrs: DomRefCell<Vec<Dom<Attr>>>,
id_attribute: DomRefCell<Option<Atom>>,
is: DomRefCell<Option<LocalName>>,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
style_attribute: DomRefCell<Option<Arc<Locked<PropertyDeclarationBlock>>>>,
attr_list: MutNullableDom<NamedNodeMap>,
class_list: MutNullableDom<DOMTokenList>,
@@ -149,12 +149,12 @@ pub struct Element {
/// operations may require restyling this element or its descendants. The
/// flags are not atomic, so the style system takes care of only set them
/// when it has exclusive access to the element.
- #[ignore_heap_size_of = "bitflags defined in rust-selectors"]
+ #[ignore_malloc_size_of = "bitflags defined in rust-selectors"]
selector_flags: Cell<ElementSelectorFlags>,
/// <https://html.spec.whatwg.org/multipage/#custom-element-reaction-queue>
custom_element_reaction_queue: DomRefCell<Vec<CustomElementReaction>>,
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-definition>
- #[ignore_heap_size_of = "Rc"]
+ #[ignore_malloc_size_of = "Rc"]
custom_element_definition: DomRefCell<Option<Rc<CustomElementDefinition>>>,
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-state>
custom_element_state: Cell<CustomElementState>,
@@ -176,7 +176,7 @@ impl fmt::Debug for DomRoot<Element> {
}
}
-#[derive(HeapSizeOf, PartialEq)]
+#[derive(MallocSizeOf, PartialEq)]
pub enum ElementCreator {
ParserCreated(u64),
ScriptCreated,
@@ -188,7 +188,7 @@ pub enum CustomElementCreationMode {
}
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-state>
-#[derive(Clone, Copy, Eq, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, Eq, JSTraceable, MallocSizeOf, PartialEq)]
pub enum CustomElementState {
Undefined,
Failed,
@@ -3025,7 +3025,7 @@ impl<'a> AttributeMutation<'a> {
/// A holder for an element's "tag name", which will be lazily
/// resolved and cached. Should be reset when the document
/// owner changes.
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
struct TagName {
ptr: DomRefCell<Option<LocalName>>,
}
diff --git a/components/script/dom/errorevent.rs b/components/script/dom/errorevent.rs
index 1703698d382..36d1f149293 100644
--- a/components/script/dom/errorevent.rs
+++ b/components/script/dom/errorevent.rs
@@ -27,7 +27,7 @@ pub struct ErrorEvent {
filename: DomRefCell<DOMString>,
lineno: Cell<u32>,
colno: Cell<u32>,
- #[ignore_heap_size_of = "Defined in rust-mozjs"]
+ #[ignore_malloc_size_of = "Defined in rust-mozjs"]
error: Heap<JSVal>,
}
diff --git a/components/script/dom/event.rs b/components/script/dom/event.rs
index e9313c742c6..607469ca6bd 100644
--- a/components/script/dom/event.rs
+++ b/components/script/dom/event.rs
@@ -294,7 +294,7 @@ impl EventMethods for Event {
}
}
-#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
+#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
pub enum EventBubbles {
Bubbles,
DoesNotBubble
@@ -318,7 +318,7 @@ impl From<EventBubbles> for bool {
}
}
-#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
+#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
pub enum EventCancelable {
Cancelable,
NotCancelable
@@ -344,7 +344,7 @@ impl From<EventCancelable> for bool {
#[derive(Clone, Copy, Debug, Eq, JSTraceable, PartialEq)]
#[repr(u16)]
-#[derive(HeapSizeOf)]
+#[derive(MallocSizeOf)]
pub enum EventPhase {
None = EventConstants::NONE,
Capturing = EventConstants::CAPTURING_PHASE,
@@ -363,7 +363,7 @@ pub enum EventPhase {
///
/// [msg]: https://doc.servo.org/script_traits/enum.ConstellationMsg.html#variant.KeyEvent
///
-#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub enum EventDefault {
/// The default action of the event is allowed (constructor's default)
Allowed,
diff --git a/components/script/dom/eventsource.rs b/components/script/dom/eventsource.rs
index dab9f46bb05..3be3f6035df 100644
--- a/components/script/dom/eventsource.rs
+++ b/components/script/dom/eventsource.rs
@@ -41,10 +41,10 @@ header! { (LastEventId, "Last-Event-ID") => [String] }
const DEFAULT_RECONNECTION_TIME: u64 = 5000;
-#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
struct GenerationId(u32);
-#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
/// <https://html.spec.whatwg.org/multipage/#dom-eventsource-readystate>
enum ReadyState {
Connecting = 0,
@@ -528,11 +528,11 @@ impl EventSourceMethods for EventSource {
}
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub struct EventSourceTimeoutCallback {
- #[ignore_heap_size_of = "Because it is non-owning"]
+ #[ignore_malloc_size_of = "Because it is non-owning"]
event_source: Trusted<EventSource>,
- #[ignore_heap_size_of = "Because it is non-owning"]
+ #[ignore_malloc_size_of = "Because it is non-owning"]
action_sender: ipc::IpcSender<FetchResponseMsg>,
}
diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs
index e5b8c86e71e..558610fc99f 100644
--- a/components/script/dom/eventtarget.rs
+++ b/components/script/dom/eventtarget.rs
@@ -32,7 +32,6 @@ use dom::virtualmethods::VirtualMethods;
use dom::window::Window;
use dom_struct::dom_struct;
use fnv::FnvHasher;
-use heapsize::HeapSizeOf;
use js::jsapi::{CompileFunction, JS_GetFunctionObject, JSAutoCompartment};
use js::rust::{AutoObjectVectorWrapper, CompileOptionsWrapper};
use libc::{c_char, size_t};
@@ -48,11 +47,19 @@ use std::ops::{Deref, DerefMut};
use std::ptr;
use std::rc::Rc;
-#[derive(Clone, JSTraceable, PartialEq)]
+#[derive(Clone, JSTraceable, MallocSizeOf, PartialEq)]
pub enum CommonEventHandler {
- EventHandler(Rc<EventHandlerNonNull>),
- ErrorEventHandler(Rc<OnErrorEventHandlerNonNull>),
- BeforeUnloadEventHandler(Rc<OnBeforeUnloadEventHandlerNonNull>),
+ EventHandler(
+ #[ignore_malloc_size_of = "Rc"]
+ Rc<EventHandlerNonNull>),
+
+ ErrorEventHandler(
+ #[ignore_malloc_size_of = "Rc"]
+ Rc<OnErrorEventHandlerNonNull>),
+
+ BeforeUnloadEventHandler(
+ #[ignore_malloc_size_of = "Rc"]
+ Rc<OnBeforeUnloadEventHandlerNonNull>),
}
impl CommonEventHandler {
@@ -65,14 +72,14 @@ impl CommonEventHandler {
}
}
-#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub enum ListenerPhase {
Capturing,
Bubbling,
}
/// <https://html.spec.whatwg.org/multipage/#internal-raw-uncompiled-handler>
-#[derive(Clone, JSTraceable, PartialEq)]
+#[derive(Clone, JSTraceable, MallocSizeOf, PartialEq)]
struct InternalRawUncompiledHandler {
source: DOMString,
url: ServoUrl,
@@ -80,7 +87,7 @@ struct InternalRawUncompiledHandler {
}
/// A representation of an event handler, either compiled or uncompiled raw source, or null.
-#[derive(Clone, JSTraceable, PartialEq)]
+#[derive(Clone, JSTraceable, MallocSizeOf, PartialEq)]
enum InlineEventListener {
Uncompiled(InternalRawUncompiledHandler),
Compiled(CommonEventHandler),
@@ -110,19 +117,12 @@ impl InlineEventListener {
}
}
-#[derive(Clone, JSTraceable, PartialEq)]
+#[derive(Clone, JSTraceable, MallocSizeOf, PartialEq)]
enum EventListenerType {
- Additive(Rc<EventListener>),
+ Additive(#[ignore_malloc_size_of = "Rc"] Rc<EventListener>),
Inline(InlineEventListener),
}
-impl HeapSizeOf for EventListenerType {
- fn heap_size_of_children(&self) -> usize {
- // FIXME: Rc<T> isn't HeapSizeOf and we can't ignore it due to #6870 and #6871
- 0
- }
-}
-
impl EventListenerType {
fn get_compiled_listener(&mut self, owner: &EventTarget, ty: &Atom)
-> Option<CompiledEventListener> {
@@ -225,14 +225,14 @@ impl CompiledEventListener {
}
}
-#[derive(Clone, DenyPublicFields, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, DenyPublicFields, JSTraceable, MallocSizeOf, PartialEq)]
/// A listener in a collection of event listeners.
struct EventListenerEntry {
phase: ListenerPhase,
listener: EventListenerType
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
/// A mix of potentially uncompiled and compiled event listeners of the same type.
struct EventListeners(Vec<EventListenerEntry>);
diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs
index a2e211cc003..db5518116ef 100644
--- a/components/script/dom/filereader.rs
+++ b/components/script/dom/filereader.rs
@@ -39,7 +39,7 @@ use task::TaskCanceller;
use task_source::TaskSource;
use task_source::file_reading::{FileReadingTask, FileReadingTaskSource};
-#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub enum FileReaderFunction {
ReadAsText,
ReadAsDataUrl,
@@ -48,7 +48,7 @@ pub enum FileReaderFunction {
pub type TrustedFileReader = Trusted<FileReader>;
-#[derive(Clone, HeapSizeOf)]
+#[derive(Clone, MallocSizeOf)]
pub struct ReadMetaData {
pub blobtype: String,
pub label: Option<String>,
@@ -66,18 +66,18 @@ impl ReadMetaData {
}
}
-#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub struct GenerationId(u32);
#[repr(u16)]
-#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum FileReaderReadyState {
Empty = FileReaderConstants::EMPTY,
Loading = FileReaderConstants::LOADING,
Done = FileReaderConstants::DONE,
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub enum FileReaderResult {
ArrayBuffer(Heap<JSVal>),
String(DOMString),
diff --git a/components/script/dom/gamepad.rs b/components/script/dom/gamepad.rs
index 47605b7794e..99f52cb203f 100644
--- a/components/script/dom/gamepad.rs
+++ b/components/script/dom/gamepad.rs
@@ -35,7 +35,7 @@ pub struct Gamepad {
axes: Heap<*mut JSObject>,
buttons: Dom<GamepadButtonList>,
pose: Option<Dom<VRPose>>,
- #[ignore_heap_size_of = "Defined in rust-webvr"]
+ #[ignore_malloc_size_of = "Defined in rust-webvr"]
hand: WebVRGamepadHand,
display_id: u32
}
diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs
index b226924bdef..0d3b9b47298 100644
--- a/components/script/dom/globalscope.rs
+++ b/components/script/dom/globalscope.rs
@@ -72,22 +72,22 @@ pub struct GlobalScope {
console_timers: DomRefCell<HashMap<DOMString, u64>>,
/// For providing instructions to an optional devtools server.
- #[ignore_heap_size_of = "channels are hard"]
+ #[ignore_malloc_size_of = "channels are hard"]
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
/// For sending messages to the memory profiler.
- #[ignore_heap_size_of = "channels are hard"]
+ #[ignore_malloc_size_of = "channels are hard"]
mem_profiler_chan: mem::ProfilerChan,
/// For sending messages to the time profiler.
- #[ignore_heap_size_of = "channels are hard"]
+ #[ignore_malloc_size_of = "channels are hard"]
time_profiler_chan: time::ProfilerChan,
/// A handle for communicating messages to the constellation thread.
- #[ignore_heap_size_of = "channels are hard"]
+ #[ignore_malloc_size_of = "channels are hard"]
script_to_constellation_chan: ScriptToConstellationChan,
- #[ignore_heap_size_of = "channels are hard"]
+ #[ignore_malloc_size_of = "channels are hard"]
scheduler_chan: IpcSender<TimerSchedulerMsg>,
/// <https://html.spec.whatwg.org/multipage/#in-error-reporting-mode>
@@ -108,7 +108,7 @@ pub struct GlobalScope {
/// same microtask queue.
///
/// <https://html.spec.whatwg.org/multipage/#microtask-queue>
- #[ignore_heap_size_of = "Rc<T> is hard"]
+ #[ignore_malloc_size_of = "Rc<T> is hard"]
microtask_queue: Rc<MicrotaskQueue>,
}
diff --git a/components/script/dom/headers.rs b/components/script/dom/headers.rs
index 9b8910bc893..5d152ab93bb 100644
--- a/components/script/dom/headers.rs
+++ b/components/script/dom/headers.rs
@@ -21,12 +21,12 @@ use std::str;
pub struct Headers {
reflector_: Reflector,
guard: Cell<Guard>,
- #[ignore_heap_size_of = "Defined in hyper"]
+ #[ignore_malloc_size_of = "Defined in hyper"]
header_list: DomRefCell<HyperHeaders>
}
// https://fetch.spec.whatwg.org/#concept-headers-guard
-#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub enum Guard {
Immutable,
Request,
diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs
index 70d16684bdd..feb9a3f1805 100755
--- a/components/script/dom/htmlbuttonelement.rs
+++ b/components/script/dom/htmlbuttonelement.rs
@@ -30,7 +30,7 @@ use std::default::Default;
use style::element_state::*;
#[derive(Clone, Copy, JSTraceable, PartialEq)]
-#[derive(HeapSizeOf)]
+#[derive(MallocSizeOf)]
enum ButtonType {
Submit,
Reset,
diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs
index 916fcce9ab6..3e7de52fd29 100644
--- a/components/script/dom/htmlcanvaselement.rs
+++ b/components/script/dom/htmlcanvaselement.rs
@@ -42,7 +42,7 @@ const DEFAULT_WIDTH: u32 = 300;
const DEFAULT_HEIGHT: u32 = 150;
#[must_root]
-#[derive(Clone, HeapSizeOf, JSTraceable)]
+#[derive(Clone, JSTraceable, MallocSizeOf)]
pub enum CanvasContext {
Context2d(Dom<CanvasRenderingContext2D>),
WebGL(Dom<WebGLRenderingContext>),
diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs
index 19b756769bc..3da4503cb0e 100644
--- a/components/script/dom/htmlcollection.rs
+++ b/components/script/dom/htmlcollection.rs
@@ -26,7 +26,7 @@ pub trait CollectionFilter : JSTraceable {
// An optional u32, using maxint to represent None.
// It would be nicer just to use Option<u32> for this, but that would produce word
// alignment issues since Option<u32> uses 33 bits.
-#[derive(Clone, Copy, HeapSizeOf, JSTraceable)]
+#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
struct OptionU32 {
bits: u32,
}
@@ -54,7 +54,7 @@ impl OptionU32 {
pub struct HTMLCollection {
reflector_: Reflector,
root: Dom<Node>,
- #[ignore_heap_size_of = "Contains a trait object; can't measure due to #6870"]
+ #[ignore_malloc_size_of = "Contains a trait object; can't measure due to #6870"]
filter: Box<CollectionFilter + 'static>,
// We cache the version of the root node and all its decendents,
// the length of the collection, and a cursor into the collection.
@@ -119,7 +119,7 @@ impl HTMLCollection {
-> DomRoot<HTMLCollection> {
// case 1
if qualified_name == local_name!("*") {
- #[derive(HeapSizeOf, JSTraceable)]
+ #[derive(JSTraceable, MallocSizeOf)]
struct AllFilter;
impl CollectionFilter for AllFilter {
fn filter(&self, _elem: &Element, _root: &Node) -> bool {
@@ -129,7 +129,7 @@ impl HTMLCollection {
return HTMLCollection::create(window, root, Box::new(AllFilter));
}
- #[derive(HeapSizeOf, JSTraceable)]
+ #[derive(JSTraceable, MallocSizeOf)]
struct HtmlDocumentFilter {
qualified_name: LocalName,
ascii_lower_qualified_name: LocalName,
@@ -169,7 +169,7 @@ impl HTMLCollection {
}
pub fn by_qual_tag_name(window: &Window, root: &Node, qname: QualName) -> DomRoot<HTMLCollection> {
- #[derive(HeapSizeOf, JSTraceable)]
+ #[derive(JSTraceable, MallocSizeOf)]
struct TagNameNSFilter {
qname: QualName
}
@@ -193,7 +193,7 @@ impl HTMLCollection {
pub fn by_atomic_class_name(window: &Window, root: &Node, classes: Vec<Atom>)
-> DomRoot<HTMLCollection> {
- #[derive(HeapSizeOf, JSTraceable)]
+ #[derive(JSTraceable, MallocSizeOf)]
struct ClassNameFilter {
classes: Vec<Atom>
}
@@ -212,7 +212,7 @@ impl HTMLCollection {
}
pub fn children(window: &Window, root: &Node) -> DomRoot<HTMLCollection> {
- #[derive(HeapSizeOf, JSTraceable)]
+ #[derive(JSTraceable, MallocSizeOf)]
struct ElementChildFilter;
impl CollectionFilter for ElementChildFilter {
fn filter(&self, elem: &Element, root: &Node) -> bool {
diff --git a/components/script/dom/htmldatalistelement.rs b/components/script/dom/htmldatalistelement.rs
index 2352fa99bcf..43e2eaa4928 100644
--- a/components/script/dom/htmldatalistelement.rs
+++ b/components/script/dom/htmldatalistelement.rs
@@ -43,7 +43,7 @@ impl HTMLDataListElement {
impl HTMLDataListElementMethods for HTMLDataListElement {
// https://html.spec.whatwg.org/multipage/#dom-datalist-options
fn Options(&self) -> DomRoot<HTMLCollection> {
- #[derive(HeapSizeOf, JSTraceable)]
+ #[derive(JSTraceable, MallocSizeOf)]
struct HTMLDataListOptionsFilter;
impl CollectionFilter for HTMLDataListOptionsFilter {
fn filter(&self, elem: &Element, _root: &Node) -> bool {
diff --git a/components/script/dom/htmlfieldsetelement.rs b/components/script/dom/htmlfieldsetelement.rs
index bee8a41d4cd..81fc57dbce3 100644
--- a/components/script/dom/htmlfieldsetelement.rs
+++ b/components/script/dom/htmlfieldsetelement.rs
@@ -52,7 +52,7 @@ impl HTMLFieldSetElement {
impl HTMLFieldSetElementMethods for HTMLFieldSetElement {
// https://html.spec.whatwg.org/multipage/#dom-fieldset-elements
fn Elements(&self) -> DomRoot<HTMLCollection> {
- #[derive(HeapSizeOf, JSTraceable)]
+ #[derive(JSTraceable, MallocSizeOf)]
struct ElementsFilter;
impl CollectionFilter for ElementsFilter {
fn filter<'a>(&self, elem: &'a Element, _root: &'a Node) -> bool {
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs
index ecca8998978..d99b101dd4a 100755
--- a/components/script/dom/htmlformelement.rs
+++ b/components/script/dom/htmlformelement.rs
@@ -57,7 +57,7 @@ use style::attr::AttrValue;
use style::str::split_html_space_chars;
use task_source::TaskSource;
-#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub struct GenerationId(u32);
#[dom_struct]
@@ -166,7 +166,7 @@ impl HTMLFormElementMethods for HTMLFormElement {
// https://html.spec.whatwg.org/multipage/#dom-form-elements
fn Elements(&self) -> DomRoot<HTMLFormControlsCollection> {
- #[derive(HeapSizeOf, JSTraceable)]
+ #[derive(JSTraceable, MallocSizeOf)]
struct ElementsFilter {
form: DomRoot<HTMLFormElement>
}
@@ -235,13 +235,13 @@ impl HTMLFormElementMethods for HTMLFormElement {
}
}
-#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
+#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
pub enum SubmittedFrom {
FromForm,
NotFromForm
}
-#[derive(Clone, Copy, HeapSizeOf)]
+#[derive(Clone, Copy, MallocSizeOf)]
pub enum ResetFrom {
FromForm,
NotFromForm
@@ -674,14 +674,14 @@ impl HTMLFormElement {
}
}
-#[derive(Clone, HeapSizeOf, JSTraceable)]
+#[derive(Clone, JSTraceable, MallocSizeOf)]
pub enum FormDatumValue {
#[allow(dead_code)]
File(DomRoot<File>),
String(DOMString)
}
-#[derive(Clone, HeapSizeOf, JSTraceable)]
+#[derive(Clone, JSTraceable, MallocSizeOf)]
pub struct FormDatum {
pub ty: DOMString,
pub name: DOMString,
@@ -701,21 +701,21 @@ impl FormDatum {
}
}
-#[derive(Clone, Copy, HeapSizeOf)]
+#[derive(Clone, Copy, MallocSizeOf)]
pub enum FormEncType {
TextPlainEncoded,
UrlEncoded,
FormDataEncoded
}
-#[derive(Clone, Copy, HeapSizeOf)]
+#[derive(Clone, Copy, MallocSizeOf)]
pub enum FormMethod {
FormGet,
FormPost,
FormDialog
}
-#[derive(HeapSizeOf)]
+#[derive(MallocSizeOf)]
#[allow(dead_code)]
pub enum FormSubmittableElement {
ButtonElement(DomRoot<HTMLButtonElement>),
@@ -759,7 +759,7 @@ impl FormSubmittableElement {
}
}
-#[derive(Clone, Copy, HeapSizeOf)]
+#[derive(Clone, Copy, MallocSizeOf)]
pub enum FormSubmitter<'a> {
FormElement(&'a HTMLFormElement),
InputElement(&'a HTMLInputElement),
diff --git a/components/script/dom/htmlheadingelement.rs b/components/script/dom/htmlheadingelement.rs
index 8420def4a84..5dbf23fa157 100644
--- a/components/script/dom/htmlheadingelement.rs
+++ b/components/script/dom/htmlheadingelement.rs
@@ -10,7 +10,7 @@ use dom::node::Node;
use dom_struct::dom_struct;
use html5ever::{LocalName, Prefix};
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub enum HeadingLevel {
Heading1,
Heading2,
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index 08d67b9eff3..697e32636b1 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -56,7 +56,7 @@ use style::attr::{AttrValue, LengthOrPercentageOrAuto};
use task_source::TaskSource;
bitflags! {
- #[derive(HeapSizeOf, JSTraceable)]
+ #[derive(JSTraceable, MallocSizeOf)]
flags SandboxAllowance: u8 {
const ALLOW_NOTHING = 0x00,
const ALLOW_SAME_ORIGIN = 0x01,
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs
index 6f33849ad80..498930624c4 100644
--- a/components/script/dom/htmlimageelement.rs
+++ b/components/script/dom/htmlimageelement.rs
@@ -85,7 +85,7 @@ pub struct Descriptor {
pub den: Option<f64>,
}
-#[derive(Clone, Copy, HeapSizeOf, JSTraceable)]
+#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
#[allow(dead_code)]
enum State {
Unavailable,
@@ -100,19 +100,19 @@ pub struct Size {
pub length: Length,
}
-#[derive(Clone, Copy, HeapSizeOf, JSTraceable)]
+#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
enum ImageRequestPhase {
Pending,
Current
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
struct ImageRequest {
state: State,
parsed_url: Option<ServoUrl>,
source_url: Option<DOMString>,
blocker: Option<LoadBlocker>,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
image: Option<Arc<Image>>,
metadata: Option<ImageMetadata>,
final_url: Option<ServoUrl>,
@@ -695,7 +695,7 @@ impl HTMLImageElement {
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub enum ImageElementMicrotask {
StableStateUpdateImageDataTask {
elem: DomRoot<HTMLImageElement>,
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs
index ad82972d0e3..658c1917212 100755
--- a/components/script/dom/htmlinputelement.rs
+++ b/components/script/dom/htmlinputelement.rs
@@ -62,7 +62,7 @@ const PASSWORD_REPLACEMENT_CHAR: char = '●';
#[derive(Clone, Copy, JSTraceable, PartialEq)]
#[allow(dead_code)]
-#[derive(HeapSizeOf)]
+#[derive(MallocSizeOf)]
enum InputType {
InputSubmit,
InputReset,
@@ -93,7 +93,7 @@ pub struct HTMLInputElement {
size: Cell<u32>,
maxlength: Cell<i32>,
minlength: Cell<i32>,
- #[ignore_heap_size_of = "#7193"]
+ #[ignore_malloc_size_of = "#7193"]
textinput: DomRefCell<TextInput<ScriptToConstellationChan>>,
activation_state: DomRefCell<InputActivationState>,
// https://html.spec.whatwg.org/multipage/#concept-input-value-dirty-flag
@@ -105,7 +105,7 @@ pub struct HTMLInputElement {
#[derive(JSTraceable)]
#[must_root]
-#[derive(HeapSizeOf)]
+#[derive(MallocSizeOf)]
struct InputActivationState {
indeterminate: bool,
checked: bool,
diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs
index 2eb346a00c7..03353d70bc4 100644
--- a/components/script/dom/htmllinkelement.rs
+++ b/components/script/dom/htmllinkelement.rs
@@ -38,7 +38,7 @@ use style::stylesheets::{CssRuleType, Stylesheet};
use style_traits::PARSING_MODE_DEFAULT;
use stylesheet_loader::{StylesheetLoader, StylesheetContextSource, StylesheetOwner};
-#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub struct RequestGenerationId(u32);
impl RequestGenerationId {
@@ -51,7 +51,7 @@ impl RequestGenerationId {
pub struct HTMLLinkElement {
htmlelement: HTMLElement,
rel_list: MutNullableDom<DOMTokenList>,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
stylesheet: DomRefCell<Option<Arc<Stylesheet>>>,
cssom_stylesheet: MutNullableDom<CSSStyleSheet>,
diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs
index f264bde0206..daddcee4377 100644
--- a/components/script/dom/htmlmediaelement.rs
+++ b/components/script/dom/htmlmediaelement.rs
@@ -77,15 +77,15 @@ pub struct HTMLMediaElement {
/// <https://html.spec.whatwg.org/multipage/#delaying-the-load-event-flag>
delaying_the_load_event_flag: DomRefCell<Option<LoadBlocker>>,
/// <https://html.spec.whatwg.org/multipage/#list-of-pending-play-promises>
- #[ignore_heap_size_of = "promises are hard"]
+ #[ignore_malloc_size_of = "promises are hard"]
pending_play_promises: DomRefCell<Vec<Rc<Promise>>>,
/// Play promises which are soon to be fulfilled by a queued task.
- #[ignore_heap_size_of = "promises are hard"]
+ #[ignore_malloc_size_of = "promises are hard"]
in_flight_play_promises_queue: DomRefCell<VecDeque<(Box<[Rc<Promise>]>, ErrorResult)>>,
}
/// <https://html.spec.whatwg.org/multipage/#dom-media-networkstate>
-#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
#[repr(u8)]
pub enum NetworkState {
Empty = HTMLMediaElementConstants::NETWORK_EMPTY as u8,
@@ -95,7 +95,7 @@ pub enum NetworkState {
}
/// <https://html.spec.whatwg.org/multipage/#dom-media-readystate>
-#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq, PartialOrd)]
+#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq, PartialOrd)]
#[repr(u8)]
enum ReadyState {
HaveNothing = HTMLMediaElementConstants::HAVE_NOTHING as u8,
@@ -940,7 +940,7 @@ impl VirtualMethods for HTMLMediaElement {
}
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub enum MediaElementMicrotask {
ResourceSelectionTask {
elem: DomRoot<HTMLMediaElement>,
diff --git a/components/script/dom/htmlmetaelement.rs b/components/script/dom/htmlmetaelement.rs
index 56f31be0964..f27161036e7 100644
--- a/components/script/dom/htmlmetaelement.rs
+++ b/components/script/dom/htmlmetaelement.rs
@@ -32,7 +32,7 @@ use style::stylesheets::{Stylesheet, StylesheetContents, CssRule, CssRules, Orig
#[dom_struct]
pub struct HTMLMetaElement {
htmlelement: HTMLElement,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
stylesheet: DomRefCell<Option<Arc<Stylesheet>>>,
cssom_stylesheet: MutNullableDom<CSSStyleSheet>,
}
diff --git a/components/script/dom/htmlobjectelement.rs b/components/script/dom/htmlobjectelement.rs
index ce45e089fdc..d78e102d1da 100755
--- a/components/script/dom/htmlobjectelement.rs
+++ b/components/script/dom/htmlobjectelement.rs
@@ -26,7 +26,7 @@ use std::default::Default;
#[dom_struct]
pub struct HTMLObjectElement {
htmlelement: HTMLElement,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
image: DomRefCell<Option<Arc<Image>>>,
form_owner: MutNullableDom<HTMLFormElement>,
}
diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs
index 1a21ce28a1c..31871104687 100644
--- a/components/script/dom/htmlscriptelement.rs
+++ b/components/script/dom/htmlscriptelement.rs
@@ -112,7 +112,7 @@ static SCRIPT_JS_MIMES: StaticStringVec = &[
"text/x-javascript",
];
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub struct ClassicScript {
text: DOMString,
url: ServoUrl,
diff --git a/components/script/dom/htmlselectelement.rs b/components/script/dom/htmlselectelement.rs
index 75dea8d461e..3423db303e4 100755
--- a/components/script/dom/htmlselectelement.rs
+++ b/components/script/dom/htmlselectelement.rs
@@ -37,7 +37,7 @@ use std::iter;
use style::attr::AttrValue;
use style::element_state::*;
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
struct OptionsFilter;
impl CollectionFilter for OptionsFilter {
fn filter<'a>(&self, elem: &'a Element, root: &'a Node) -> bool {
diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs
index af01adfd9c5..ef25b52dbb3 100644
--- a/components/script/dom/htmlstyleelement.rs
+++ b/components/script/dom/htmlstyleelement.rs
@@ -31,7 +31,7 @@ use stylesheet_loader::{StylesheetLoader, StylesheetOwner};
#[dom_struct]
pub struct HTMLStyleElement {
htmlelement: HTMLElement,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
stylesheet: DomRefCell<Option<Arc<Stylesheet>>>,
cssom_stylesheet: MutNullableDom<CSSStyleSheet>,
/// <https://html.spec.whatwg.org/multipage/#a-style-sheet-that-is-blocking-scripts>
diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs
index cda13a6496d..c475c3eee1d 100644
--- a/components/script/dom/htmltableelement.rs
+++ b/components/script/dom/htmltableelement.rs
@@ -36,7 +36,7 @@ pub struct HTMLTableElement {
}
#[allow(unrooted_must_root)]
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
struct TableRowFilter {
sections: Vec<Dom<Node>>,
}
diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs
index 0825bb70302..c15553faa75 100755
--- a/components/script/dom/htmltextareaelement.rs
+++ b/components/script/dom/htmltextareaelement.rs
@@ -38,7 +38,7 @@ use textinput::{KeyReaction, Lines, SelectionDirection, TextInput};
#[dom_struct]
pub struct HTMLTextAreaElement {
htmlelement: HTMLElement,
- #[ignore_heap_size_of = "#7193"]
+ #[ignore_malloc_size_of = "#7193"]
textinput: DomRefCell<TextInput<ScriptToConstellationChan>>,
placeholder: DomRefCell<DOMString>,
// https://html.spec.whatwg.org/multipage/#concept-textarea-dirty
diff --git a/components/script/dom/keyboardevent.rs b/components/script/dom/keyboardevent.rs
index 237876ecdda..2d2a2391372 100644
--- a/components/script/dom/keyboardevent.rs
+++ b/components/script/dom/keyboardevent.rs
@@ -742,7 +742,7 @@ fn key_keycode(key: Key) -> u32 {
}
}
-#[derive(HeapSizeOf)]
+#[derive(MallocSizeOf)]
pub struct KeyEventProperties {
pub key_string: Cow<'static, str>,
pub code: &'static str,
diff --git a/components/script/dom/medialist.rs b/components/script/dom/medialist.rs
index df59886226d..30d6ad9ed34 100644
--- a/components/script/dom/medialist.rs
+++ b/components/script/dom/medialist.rs
@@ -24,7 +24,7 @@ use style_traits::{PARSING_MODE_DEFAULT, ToCss};
pub struct MediaList {
reflector_: Reflector,
parent_stylesheet: Dom<CSSStyleSheet>,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
media_queries: Arc<Locked<StyleMediaList>>,
}
diff --git a/components/script/dom/mediaquerylist.rs b/components/script/dom/mediaquerylist.rs
index 6252f9c5098..e89e7d4d744 100644
--- a/components/script/dom/mediaquerylist.rs
+++ b/components/script/dom/mediaquerylist.rs
@@ -118,7 +118,7 @@ impl MediaQueryListMethods for MediaQueryList {
event_handler!(change, GetOnchange, SetOnchange);
}
-#[derive(HeapSizeOf)]
+#[derive(MallocSizeOf)]
pub struct WeakMediaQueryListVec {
cell: DomRefCell<WeakRefVec<MediaQueryList>>,
}
diff --git a/components/script/dom/mutationobserver.rs b/components/script/dom/mutationobserver.rs
index 9f8ba823bd1..5aee5adecd9 100644
--- a/components/script/dom/mutationobserver.rs
+++ b/components/script/dom/mutationobserver.rs
@@ -24,7 +24,7 @@ use std::rc::Rc;
#[dom_struct]
pub struct MutationObserver {
reflector_: Reflector,
- #[ignore_heap_size_of = "can't measure Rc values"]
+ #[ignore_malloc_size_of = "can't measure Rc values"]
callback: Rc<MutationCallback>,
record_queue: DomRefCell<Vec<DomRoot<MutationRecord>>>,
}
@@ -35,13 +35,13 @@ pub enum Mutation<'a> {
prev: Option<&'a Node>, next: Option<&'a Node> },
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub struct RegisteredObserver {
observer: DomRoot<MutationObserver>,
options: ObserverOptions,
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub struct ObserverOptions {
attribute_old_value: bool,
attributes: bool,
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 52641c37474..0186d9e6a67 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -56,10 +56,10 @@ use dom::virtualmethods::{VirtualMethods, vtable_for};
use dom::window::Window;
use dom_struct::dom_struct;
use euclid::{Point2D, Vector2D, Rect, Size2D};
-use heapsize::{HeapSizeOf, heap_size_of};
use html5ever::{Prefix, Namespace, QualName};
use js::jsapi::{JSContext, JSObject, JSRuntime};
use libc::{self, c_void, uintptr_t};
+use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use msg::constellation_msg::{BrowsingContextId, PipelineId};
use ref_slice::ref_slice;
use script_layout_interface::{HTMLCanvasData, OpaqueStyleAndLayoutData, SVGSVGData};
@@ -147,7 +147,7 @@ pub struct Node {
bitflags! {
#[doc = "Flags for node items."]
- #[derive(HeapSizeOf, JSTraceable)]
+ #[derive(JSTraceable, MallocSizeOf)]
pub flags NodeFlags: u16 {
#[doc = "Specifies whether this node is in a document."]
const IS_IN_DOC = 1 << 0,
@@ -200,7 +200,7 @@ impl Drop for Node {
/// suppress observers flag
/// <https://dom.spec.whatwg.org/#concept-node-insert>
/// <https://dom.spec.whatwg.org/#concept-node-remove>
-#[derive(Clone, Copy, HeapSizeOf)]
+#[derive(Clone, Copy, MallocSizeOf)]
enum SuppressObserver {
Suppressed,
Unsuppressed
@@ -1368,7 +1368,7 @@ impl Iterator for TreeIterator {
}
/// Specifies whether children must be recursively cloned or not.
-#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
+#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
pub enum CloneChildrenFlag {
CloneChildren,
DoNotCloneChildren
@@ -2531,7 +2531,7 @@ impl VirtualMethods for Node {
}
/// A summary of the changes that happened to a node.
-#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
+#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
pub enum NodeDamage {
/// The node's `style` attribute changed.
NodeStyleDamaged,
@@ -2704,11 +2704,11 @@ struct UniqueId {
unsafe_no_jsmanaged_fields!(UniqueId);
-impl HeapSizeOf for UniqueId {
+impl MallocSizeOf for UniqueId {
#[allow(unsafe_code)]
- fn heap_size_of_children(&self) -> usize {
+ fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
if let &Some(ref uuid) = unsafe { &*self.cell.get() } {
- unsafe { heap_size_of(&** uuid as *const Uuid as *const _) }
+ unsafe { ops.malloc_size_of(&** uuid) }
} else {
0
}
diff --git a/components/script/dom/nodeiterator.rs b/components/script/dom/nodeiterator.rs
index 688f46e7df7..5897c4075c9 100644
--- a/components/script/dom/nodeiterator.rs
+++ b/components/script/dom/nodeiterator.rs
@@ -21,11 +21,11 @@ use std::rc::Rc;
pub struct NodeIterator {
reflector_: Reflector,
root_node: Dom<Node>,
- #[ignore_heap_size_of = "Defined in rust-mozjs"]
+ #[ignore_malloc_size_of = "Defined in rust-mozjs"]
reference_node: MutDom<Node>,
pointer_before_reference_node: Cell<bool>,
what_to_show: u32,
- #[ignore_heap_size_of = "Can't measure due to #6870"]
+ #[ignore_malloc_size_of = "Can't measure due to #6870"]
filter: Filter,
}
diff --git a/components/script/dom/nodelist.rs b/components/script/dom/nodelist.rs
index 86d8a2a951d..24165267480 100644
--- a/components/script/dom/nodelist.rs
+++ b/components/script/dom/nodelist.rs
@@ -12,7 +12,7 @@ use dom::window::Window;
use dom_struct::dom_struct;
use std::cell::Cell;
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
pub enum NodeListType {
Simple(Vec<Dom<Node>>),
@@ -109,11 +109,11 @@ impl NodeList {
}
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
pub struct ChildrenList {
node: Dom<Node>,
- #[ignore_heap_size_of = "Defined in rust-mozjs"]
+ #[ignore_malloc_size_of = "Defined in rust-mozjs"]
last_visited: MutNullableDom<Node>,
last_index: Cell<u32>,
}
diff --git a/components/script/dom/paintworkletglobalscope.rs b/components/script/dom/paintworkletglobalscope.rs
index 8c74f86b7a7..61527c8dd9f 100644
--- a/components/script/dom/paintworkletglobalscope.rs
+++ b/components/script/dom/paintworkletglobalscope.rs
@@ -68,7 +68,7 @@ pub struct PaintWorkletGlobalScope {
/// The worklet global for this object
worklet_global: WorkletGlobalScope,
/// The image cache
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
image_cache: Arc<ImageCache>,
/// <https://drafts.css-houdini.org/css-paint-api/#paint-definitions>
paint_definitions: DomRefCell<HashMap<Atom, Box<PaintDefinition>>>,
@@ -464,7 +464,7 @@ pub enum PaintWorkletTask {
/// <https://drafts.css-houdini.org/css-paint-api/#paint-definition>
/// This type is dangerous, because it contains uboxed `Heap<JSVal>` values,
/// which can't be moved.
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
struct PaintDefinition {
class_constructor: Heap<JSVal>,
diff --git a/components/script/dom/performance.rs b/components/script/dom/performance.rs
index cb773c06e22..f491fbb7654 100644
--- a/components/script/dom/performance.rs
+++ b/components/script/dom/performance.rs
@@ -50,7 +50,7 @@ const INVALID_ENTRY_NAMES: &'static [&'static str] = &[
/// Implementation of a list of PerformanceEntry items shared by the
/// Performance and PerformanceObserverEntryList interfaces implementations.
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub struct PerformanceEntryList {
entries: DOMPerformanceEntryList,
}
@@ -101,7 +101,7 @@ impl IntoIterator for PerformanceEntryList {
}
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
struct PerformanceObserver {
observer: DomRoot<DOMPerformanceObserver>,
entry_types: Vec<DOMString>,
diff --git a/components/script/dom/performanceobserver.rs b/components/script/dom/performanceobserver.rs
index 06c243e7818..96ad99edf92 100644
--- a/components/script/dom/performanceobserver.rs
+++ b/components/script/dom/performanceobserver.rs
@@ -32,7 +32,7 @@ const VALID_ENTRY_TYPES: &'static [&'static str] = &[
#[dom_struct]
pub struct PerformanceObserver {
reflector_: Reflector,
- #[ignore_heap_size_of = "can't measure Rc values"]
+ #[ignore_malloc_size_of = "can't measure Rc values"]
callback: Rc<PerformanceObserverCallback>,
entries: DomRefCell<DOMPerformanceEntryList>,
}
diff --git a/components/script/dom/popstateevent.rs b/components/script/dom/popstateevent.rs
index 218ed5d3af6..d485499cea5 100644
--- a/components/script/dom/popstateevent.rs
+++ b/components/script/dom/popstateevent.rs
@@ -22,7 +22,7 @@ use servo_atoms::Atom;
#[dom_struct]
pub struct PopStateEvent {
event: Event,
- #[ignore_heap_size_of = "Defined in rust-mozjs"]
+ #[ignore_malloc_size_of = "Defined in rust-mozjs"]
state: Heap<JSVal>,
}
diff --git a/components/script/dom/promise.rs b/components/script/dom/promise.rs
index 51b7c1763af..ad8ee2adfeb 100644
--- a/components/script/dom/promise.rs
+++ b/components/script/dom/promise.rs
@@ -37,7 +37,7 @@ pub struct Promise {
/// the SpiderMonkey GC, an explicit root for the reflector is stored while any
/// native instance exists. This ensures that the reflector will never be GCed
/// while native code could still interact with its native representation.
- #[ignore_heap_size_of = "SM handles JS values"]
+ #[ignore_malloc_size_of = "SM handles JS values"]
permanent_js_root: Heap<JSVal>,
}
diff --git a/components/script/dom/promisenativehandler.rs b/components/script/dom/promisenativehandler.rs
index 4ed9b4b30b4..d87589ccaa8 100644
--- a/components/script/dom/promisenativehandler.rs
+++ b/components/script/dom/promisenativehandler.rs
@@ -8,10 +8,10 @@ use dom::bindings::root::DomRoot;
use dom::bindings::trace::JSTraceable;
use dom::globalscope::GlobalScope;
use dom_struct::dom_struct;
-use heapsize::HeapSizeOf;
use js::jsapi::{JSContext, HandleValue};
+use malloc_size_of::MallocSizeOf;
-pub trait Callback: JSTraceable + HeapSizeOf {
+pub trait Callback: JSTraceable + MallocSizeOf {
fn callback(&self, cx: *mut JSContext, v: HandleValue);
}
diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs
index c4699c7f8ff..f43c9e1922c 100644
--- a/components/script/dom/range.rs
+++ b/components/script/dom/range.rs
@@ -27,8 +27,8 @@ use dom::node::{Node, UnbindContext};
use dom::text::Text;
use dom::window::Window;
use dom_struct::dom_struct;
-use heapsize::HeapSizeOf;
use js::jsapi::JSTracer;
+use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use std::cell::{Cell, UnsafeCell};
use std::cmp::{Ord, Ordering, PartialEq, PartialOrd};
@@ -933,7 +933,7 @@ impl RangeMethods for Range {
}
}
-#[derive(DenyPublicFields, HeapSizeOf, JSTraceable)]
+#[derive(DenyPublicFields, JSTraceable, MallocSizeOf)]
#[must_root]
pub struct BoundaryPoint {
node: MutDom<Node>,
@@ -1251,9 +1251,9 @@ impl WeakRangeVec {
}
#[allow(unsafe_code)]
-impl HeapSizeOf for WeakRangeVec {
- fn heap_size_of_children(&self) -> usize {
- unsafe { (*self.cell.get()).heap_size_of_children() }
+impl MallocSizeOf for WeakRangeVec {
+ fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
+ unsafe { (*self.cell.get()).size_of(ops) }
}
}
diff --git a/components/script/dom/request.rs b/components/script/dom/request.rs
index a4bfbf96f83..a018467b46d 100644
--- a/components/script/dom/request.rs
+++ b/components/script/dom/request.rs
@@ -48,7 +48,7 @@ pub struct Request {
body_used: Cell<bool>,
headers: MutNullableDom<Headers>,
mime_type: DomRefCell<Vec<u8>>,
- #[ignore_heap_size_of = "Rc"]
+ #[ignore_malloc_size_of = "Rc"]
body_promise: DomRefCell<Option<(Rc<Promise>, BodyType)>>,
}
diff --git a/components/script/dom/response.rs b/components/script/dom/response.rs
index ee4276e711a..e4af7f48187 100644
--- a/components/script/dom/response.rs
+++ b/components/script/dom/response.rs
@@ -36,7 +36,7 @@ pub struct Response {
mime_type: DomRefCell<Vec<u8>>,
body_used: Cell<bool>,
/// `None` can be considered a StatusCode of `0`.
- #[ignore_heap_size_of = "Defined in hyper"]
+ #[ignore_malloc_size_of = "Defined in hyper"]
status: DomRefCell<Option<StatusCode>>,
raw_status: DomRefCell<Option<(u16, Vec<u8>)>>,
response_type: DomRefCell<DOMResponseType>,
@@ -44,7 +44,7 @@ pub struct Response {
url_list: DomRefCell<Vec<ServoUrl>>,
// For now use the existing NetTraitsResponseBody enum
body: DomRefCell<NetTraitsResponseBody>,
- #[ignore_heap_size_of = "Rc"]
+ #[ignore_malloc_size_of = "Rc"]
body_promise: DomRefCell<Option<(Rc<Promise>, BodyType)>>,
}
diff --git a/components/script/dom/serviceworkerglobalscope.rs b/components/script/dom/serviceworkerglobalscope.rs
index bd9de0db9f5..9cffa2c341d 100644
--- a/components/script/dom/serviceworkerglobalscope.rs
+++ b/components/script/dom/serviceworkerglobalscope.rs
@@ -71,13 +71,13 @@ impl ScriptChan for ServiceWorkerChan {
#[dom_struct]
pub struct ServiceWorkerGlobalScope {
workerglobalscope: WorkerGlobalScope,
- #[ignore_heap_size_of = "Defined in std"]
+ #[ignore_malloc_size_of = "Defined in std"]
receiver: Receiver<ServiceWorkerScriptMsg>,
- #[ignore_heap_size_of = "Defined in std"]
+ #[ignore_malloc_size_of = "Defined in std"]
own_sender: Sender<ServiceWorkerScriptMsg>,
- #[ignore_heap_size_of = "Defined in std"]
+ #[ignore_malloc_size_of = "Defined in std"]
timer_event_port: Receiver<()>,
- #[ignore_heap_size_of = "Defined in std"]
+ #[ignore_malloc_size_of = "Defined in std"]
swmanager_sender: IpcSender<ServiceWorkerMsg>,
scope_url: ServoUrl,
}
diff --git a/components/script/dom/servoparser/async_html.rs b/components/script/dom/servoparser/async_html.rs
index 2c4e71047b5..bbfa1da0a93 100644
--- a/components/script/dom/servoparser/async_html.rs
+++ b/components/script/dom/servoparser/async_html.rs
@@ -38,25 +38,25 @@ use style::context::QuirksMode as ServoQuirksMode;
type ParseNodeId = usize;
-#[derive(Clone, HeapSizeOf, JSTraceable)]
+#[derive(Clone, JSTraceable, MallocSizeOf)]
pub struct ParseNode {
id: ParseNodeId,
qual_name: Option<QualName>,
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
enum NodeOrText {
Node(ParseNode),
Text(String),
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
struct Attribute {
name: QualName,
value: String,
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
enum ParseOperation {
GetTemplateContents { target: ParseNodeId, contents: ParseNodeId },
@@ -99,21 +99,21 @@ enum ParseOperation {
Pop { node: ParseNodeId },
SetQuirksMode {
- #[ignore_heap_size_of = "Defined in style"]
+ #[ignore_malloc_size_of = "Defined in style"]
mode: ServoQuirksMode
},
}
-#[derive(HeapSizeOf)]
+#[derive(MallocSizeOf)]
enum ToTokenizerMsg {
// From HtmlTokenizer
TokenizerResultDone {
- #[ignore_heap_size_of = "Defined in html5ever"]
+ #[ignore_malloc_size_of = "Defined in html5ever"]
updated_input: VecDeque<SendTendril<UTF8>>
},
TokenizerResultScript {
script: ParseNode,
- #[ignore_heap_size_of = "Defined in html5ever"]
+ #[ignore_malloc_size_of = "Defined in html5ever"]
updated_input: VecDeque<SendTendril<UTF8>>
},
End, // Sent to Tokenizer to signify HtmlTokenizer's end method has returned
@@ -122,10 +122,10 @@ enum ToTokenizerMsg {
ProcessOperation(ParseOperation),
}
-#[derive(HeapSizeOf)]
+#[derive(MallocSizeOf)]
enum ToHtmlTokenizerMsg {
Feed {
- #[ignore_heap_size_of = "Defined in html5ever"]
+ #[ignore_malloc_size_of = "Defined in html5ever"]
input: VecDeque<SendTendril<UTF8>>
},
End,
@@ -165,15 +165,15 @@ fn create_buffer_queue(mut buffers: VecDeque<SendTendril<UTF8>>) -> BufferQueue
// | | | |________| |
// |_____________| |_______________|
//
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
pub struct Tokenizer {
document: Dom<Document>,
- #[ignore_heap_size_of = "Defined in std"]
+ #[ignore_malloc_size_of = "Defined in std"]
receiver: Receiver<ToTokenizerMsg>,
- #[ignore_heap_size_of = "Defined in std"]
+ #[ignore_malloc_size_of = "Defined in std"]
html_tokenizer_sender: Sender<ToHtmlTokenizerMsg>,
- #[ignore_heap_size_of = "Defined in std"]
+ #[ignore_malloc_size_of = "Defined in std"]
nodes: HashMap<ParseNodeId, Dom<Node>>,
url: ServoUrl,
}
@@ -495,7 +495,7 @@ fn run(sink: Sink,
}
}
-#[derive(Default, HeapSizeOf, JSTraceable)]
+#[derive(Default, JSTraceable, MallocSizeOf)]
struct ParseNodeData {
contents: Option<ParseNode>,
is_integration_point: bool,
diff --git a/components/script/dom/servoparser/html.rs b/components/script/dom/servoparser/html.rs
index f6857fcd198..53dcc3fc7c6 100644
--- a/components/script/dom/servoparser/html.rs
+++ b/components/script/dom/servoparser/html.rs
@@ -28,10 +28,10 @@ use js::jsapi::JSTracer;
use servo_url::ServoUrl;
use std::io;
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
pub struct Tokenizer {
- #[ignore_heap_size_of = "Defined in html5ever"]
+ #[ignore_malloc_size_of = "Defined in html5ever"]
inner: HtmlTokenizer<TreeBuilder<Dom<Node>, Sink>>,
}
diff --git a/components/script/dom/servoparser/mod.rs b/components/script/dom/servoparser/mod.rs
index f5f7943693e..08310326716 100644
--- a/components/script/dom/servoparser/mod.rs
+++ b/components/script/dom/servoparser/mod.rs
@@ -74,13 +74,13 @@ pub struct ServoParser {
/// The document associated with this parser.
document: Dom<Document>,
/// Input received from network.
- #[ignore_heap_size_of = "Defined in html5ever"]
+ #[ignore_malloc_size_of = "Defined in html5ever"]
network_input: DomRefCell<BufferQueue>,
/// Part of an UTF-8 code point spanning input chunks
- #[ignore_heap_size_of = "Defined in html5ever"]
+ #[ignore_malloc_size_of = "Defined in html5ever"]
incomplete_utf8: DomRefCell<Option<IncompleteUtf8>>,
/// Input received from script. Used only to support document.write().
- #[ignore_heap_size_of = "Defined in html5ever"]
+ #[ignore_malloc_size_of = "Defined in html5ever"]
script_input: DomRefCell<BufferQueue>,
/// The tokenizer of this parser.
tokenizer: DomRefCell<Tokenizer>,
@@ -493,13 +493,13 @@ impl<I> Iterator for FragmentParsingResult<I>
}
}
-#[derive(HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(JSTraceable, MallocSizeOf, PartialEq)]
enum ParserKind {
Normal,
ScriptCreated,
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
enum Tokenizer {
Html(self::html::Tokenizer),
@@ -742,7 +742,7 @@ fn insert(parent: &Node, reference_child: Option<&Node>, child: NodeOrText<Dom<N
}
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
pub struct Sink {
base_url: ServoUrl,
diff --git a/components/script/dom/servoparser/xml.rs b/components/script/dom/servoparser/xml.rs
index fe74d627349..d34792b56c3 100644
--- a/components/script/dom/servoparser/xml.rs
+++ b/components/script/dom/servoparser/xml.rs
@@ -16,10 +16,10 @@ use xml5ever::buffer_queue::BufferQueue;
use xml5ever::tokenizer::XmlTokenizer;
use xml5ever::tree_builder::{Tracer as XmlTracer, XmlTreeBuilder};
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
#[must_root]
pub struct Tokenizer {
- #[ignore_heap_size_of = "Defined in xml5ever"]
+ #[ignore_malloc_size_of = "Defined in xml5ever"]
inner: XmlTokenizer<XmlTreeBuilder<Dom<Node>, Sink>>,
}
diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs
index 62738fcf379..ce8bce56878 100644
--- a/components/script/dom/testbinding.rs
+++ b/components/script/dom/testbinding.rs
@@ -723,9 +723,9 @@ impl TestBindingMethods for TestBinding {
p.append_native_handler(&handler);
return p;
- #[derive(HeapSizeOf, JSTraceable)]
+ #[derive(JSTraceable, MallocSizeOf)]
struct SimpleHandler {
- #[ignore_heap_size_of = "Rc has unclear ownership semantics"]
+ #[ignore_malloc_size_of = "Rc has unclear ownership semantics"]
handler: Rc<SimpleCallback>,
}
impl SimpleHandler {
@@ -804,9 +804,9 @@ impl TestBinding {
pub unsafe fn condition_unsatisfied(_: *mut JSContext, _: HandleObject) -> bool { false }
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub struct TestBindingCallback {
- #[ignore_heap_size_of = "unclear ownership semantics"]
+ #[ignore_malloc_size_of = "unclear ownership semantics"]
promise: TrustedPromise,
value: DOMString,
}
diff --git a/components/script/dom/textdecoder.rs b/components/script/dom/textdecoder.rs
index 26ba8047c6b..2bfe574c380 100644
--- a/components/script/dom/textdecoder.rs
+++ b/components/script/dom/textdecoder.rs
@@ -18,7 +18,7 @@ use std::borrow::ToOwned;
#[dom_struct]
pub struct TextDecoder {
reflector_: Reflector,
- #[ignore_heap_size_of = "Defined in rust-encoding"]
+ #[ignore_malloc_size_of = "Defined in rust-encoding"]
encoding: EncodingRef,
fatal: bool,
}
diff --git a/components/script/dom/treewalker.rs b/components/script/dom/treewalker.rs
index c1d60c5a9f6..de5219a608f 100644
--- a/components/script/dom/treewalker.rs
+++ b/components/script/dom/treewalker.rs
@@ -23,7 +23,7 @@ pub struct TreeWalker {
root_node: Dom<Node>,
current_node: MutDom<Node>,
what_to_show: u32,
- #[ignore_heap_size_of = "function pointers and Rc<T> are hard"]
+ #[ignore_malloc_size_of = "function pointers and Rc<T> are hard"]
filter: Filter
}
diff --git a/components/script/dom/urlhelper.rs b/components/script/dom/urlhelper.rs
index d00189156f0..d98dcc438bf 100644
--- a/components/script/dom/urlhelper.rs
+++ b/components/script/dom/urlhelper.rs
@@ -7,7 +7,7 @@ use servo_url::ServoUrl;
use std::borrow::ToOwned;
use url::quirks;
-#[derive(HeapSizeOf)]
+#[derive(MallocSizeOf)]
pub struct UrlHelper;
impl UrlHelper {
diff --git a/components/script/dom/validitystate.rs b/components/script/dom/validitystate.rs
index 3357c29a175..0178764c3d0 100755
--- a/components/script/dom/validitystate.rs
+++ b/components/script/dom/validitystate.rs
@@ -11,7 +11,7 @@ use dom::window::Window;
use dom_struct::dom_struct;
// https://html.spec.whatwg.org/multipage/#validity-states
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
#[allow(dead_code)]
pub enum ValidityStatus {
ValueMissing,
diff --git a/components/script/dom/vrdisplay.rs b/components/script/dom/vrdisplay.rs
index 4f012856c2c..d63e0f514e0 100644
--- a/components/script/dom/vrdisplay.rs
+++ b/components/script/dom/vrdisplay.rs
@@ -46,7 +46,7 @@ use webvr_traits::{WebVRDisplayData, WebVRDisplayEvent, WebVRFrameData, WebVRLay
#[dom_struct]
pub struct VRDisplay {
eventtarget: EventTarget,
- #[ignore_heap_size_of = "Defined in rust-webvr"]
+ #[ignore_malloc_size_of = "Defined in rust-webvr"]
display: DomRefCell<WebVRDisplayData>,
depth_near: Cell<f64>,
depth_far: Cell<f64>,
@@ -55,19 +55,19 @@ pub struct VRDisplay {
right_eye_params: MutDom<VREyeParameters>,
capabilities: MutDom<VRDisplayCapabilities>,
stage_params: MutNullableDom<VRStageParameters>,
- #[ignore_heap_size_of = "Defined in rust-webvr"]
+ #[ignore_malloc_size_of = "Defined in rust-webvr"]
frame_data: DomRefCell<WebVRFrameData>,
- #[ignore_heap_size_of = "Defined in rust-webvr"]
+ #[ignore_malloc_size_of = "Defined in rust-webvr"]
layer: DomRefCell<WebVRLayer>,
layer_ctx: MutNullableDom<WebGLRenderingContext>,
- #[ignore_heap_size_of = "Defined in rust-webvr"]
+ #[ignore_malloc_size_of = "Defined in rust-webvr"]
next_raf_id: Cell<u32>,
/// List of request animation frame callbacks
- #[ignore_heap_size_of = "closures are hard"]
+ #[ignore_malloc_size_of = "closures are hard"]
raf_callback_list: DomRefCell<Vec<(u32, Option<Rc<FrameRequestCallback>>)>>,
// Compositor VRFrameData synchonization
frame_data_status: Cell<VRFrameDataStatus>,
- #[ignore_heap_size_of = "channels are hard"]
+ #[ignore_malloc_size_of = "closures are hard"]
frame_data_receiver: DomRefCell<Option<WebGLReceiver<Result<Vec<u8>, ()>>>>,
running_display_raf: Cell<bool>,
paused: Cell<bool>,
@@ -78,7 +78,7 @@ unsafe_no_jsmanaged_fields!(WebVRDisplayData);
unsafe_no_jsmanaged_fields!(WebVRFrameData);
unsafe_no_jsmanaged_fields!(WebVRLayer);
-#[derive(Clone, Copy, Eq, HeapSizeOf, PartialEq)]
+#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq)]
enum VRFrameDataStatus {
Waiting,
Synced,
diff --git a/components/script/dom/vrdisplaycapabilities.rs b/components/script/dom/vrdisplaycapabilities.rs
index 9721de0e1b6..ef1f1d7f275 100644
--- a/components/script/dom/vrdisplaycapabilities.rs
+++ b/components/script/dom/vrdisplaycapabilities.rs
@@ -14,7 +14,7 @@ use webvr_traits::WebVRDisplayCapabilities;
#[dom_struct]
pub struct VRDisplayCapabilities {
reflector_: Reflector,
- #[ignore_heap_size_of = "Defined in rust-webvr"]
+ #[ignore_malloc_size_of = "Defined in rust-webvr"]
capabilities: DomRefCell<WebVRDisplayCapabilities>
}
diff --git a/components/script/dom/vreyeparameters.rs b/components/script/dom/vreyeparameters.rs
index f29d0230de5..b573d3d96b8 100644
--- a/components/script/dom/vreyeparameters.rs
+++ b/components/script/dom/vreyeparameters.rs
@@ -20,7 +20,7 @@ use webvr_traits::WebVREyeParameters;
#[dom_struct]
pub struct VREyeParameters {
reflector_: Reflector,
- #[ignore_heap_size_of = "Defined in rust-webvr"]
+ #[ignore_malloc_size_of = "Defined in rust-webvr"]
parameters: DomRefCell<WebVREyeParameters>,
offset: Heap<*mut JSObject>,
fov: Dom<VRFieldOfView>,
diff --git a/components/script/dom/vrfieldofview.rs b/components/script/dom/vrfieldofview.rs
index 3bcb80b3e2c..eb798bafc8a 100644
--- a/components/script/dom/vrfieldofview.rs
+++ b/components/script/dom/vrfieldofview.rs
@@ -15,7 +15,7 @@ use webvr_traits::WebVRFieldOfView;
#[dom_struct]
pub struct VRFieldOfView {
reflector_: Reflector,
- #[ignore_heap_size_of = "Defined in rust-webvr"]
+ #[ignore_malloc_size_of = "Defined in rust-webvr"]
fov: DomRefCell<WebVRFieldOfView>
}
diff --git a/components/script/dom/vrstageparameters.rs b/components/script/dom/vrstageparameters.rs
index a2a185fd6cc..fa545621001 100644
--- a/components/script/dom/vrstageparameters.rs
+++ b/components/script/dom/vrstageparameters.rs
@@ -19,7 +19,7 @@ use webvr_traits::WebVRStageParameters;
#[dom_struct]
pub struct VRStageParameters {
reflector_: Reflector,
- #[ignore_heap_size_of = "Defined in rust-webvr"]
+ #[ignore_malloc_size_of = "Defined in rust-webvr"]
parameters: DomRefCell<WebVRStageParameters>,
transform: Heap<*mut JSObject>,
}
diff --git a/components/script/dom/webgl_extensions/extensions.rs b/components/script/dom/webgl_extensions/extensions.rs
index 9b022ac7def..85559612471 100644
--- a/components/script/dom/webgl_extensions/extensions.rs
+++ b/components/script/dom/webgl_extensions/extensions.rs
@@ -13,9 +13,9 @@ use dom::bindings::trace::JSTraceable;
use dom::webglrenderingcontext::WebGLRenderingContext;
use fnv::{FnvHashMap, FnvHashSet};
use gleam::gl::GLenum;
-use heapsize::HeapSizeOf;
use js::jsapi::JSContext;
use js::jsval::JSVal;
+use malloc_size_of::MallocSizeOf;
use ref_filter_map::ref_filter_map;
use std::cell::Ref;
use std::collections::HashMap;
@@ -45,7 +45,7 @@ const DEFAULT_DISABLED_GET_PARAMETER_NAMES: [GLenum; 1] = [
];
/// WebGL features that are enabled/disabled by WebGL Extensions.
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
struct WebGLExtensionFeatures {
gl_extensions: FnvHashSet<String>,
disabled_tex_types: FnvHashSet<GLenum>,
@@ -74,7 +74,7 @@ impl Default for WebGLExtensionFeatures {
/// Handles the list of implemented, supported and enabled WebGL extensions.
#[must_root]
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub struct WebGLExtensions {
extensions: DomRefCell<HashMap<String, Box<WebGLExtensionWrapper>>>,
features: DomRefCell<WebGLExtensionFeatures>,
@@ -97,7 +97,7 @@ impl WebGLExtensions {
}
}
- pub fn register<T:'static + WebGLExtension + JSTraceable + HeapSizeOf>(&self) {
+ pub fn register<T:'static + WebGLExtension + JSTraceable + MallocSizeOf>(&self) {
let name = T::name().to_uppercase();
self.extensions.borrow_mut().insert(name, Box::new(TypedWebGLExtensionWrapper::<T>::new()));
}
@@ -122,7 +122,7 @@ impl WebGLExtensions {
pub fn is_enabled<T>(&self) -> bool
where
- T: 'static + WebGLExtension + JSTraceable + HeapSizeOf
+ T: 'static + WebGLExtension + JSTraceable + MallocSizeOf
{
let name = T::name().to_uppercase();
self.extensions.borrow().get(&name).map_or(false, |ext| { ext.is_enabled() })
@@ -130,7 +130,7 @@ impl WebGLExtensions {
pub fn get_dom_object<T>(&self) -> Option<DomRoot<T::Extension>>
where
- T: 'static + WebGLExtension + JSTraceable + HeapSizeOf
+ T: 'static + WebGLExtension + JSTraceable + MallocSizeOf
{
let name = T::name().to_uppercase();
self.extensions.borrow().get(&name).and_then(|extension| {
@@ -224,15 +224,15 @@ impl WebGLExtensions {
}
// Helper structs
-#[derive(Eq, Hash, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Eq, Hash, JSTraceable, MallocSizeOf, PartialEq)]
struct TexFormatType(u32, u32);
type WebGLQueryParameterFunc = Fn(*mut JSContext, &WebGLRenderingContext)
-> Result<JSVal, WebGLError>;
-#[derive(HeapSizeOf)]
+#[derive(MallocSizeOf)]
struct WebGLQueryParameterHandler {
- #[ignore_heap_size_of = "Closures are hard"]
+ #[ignore_malloc_size_of = "Closures are hard"]
func: Box<WebGLQueryParameterFunc>
}
diff --git a/components/script/dom/webgl_extensions/wrapper.rs b/components/script/dom/webgl_extensions/wrapper.rs
index 49d698bf14c..1c10e692f51 100644
--- a/components/script/dom/webgl_extensions/wrapper.rs
+++ b/components/script/dom/webgl_extensions/wrapper.rs
@@ -7,13 +7,13 @@ use dom::bindings::reflector::DomObject;
use dom::bindings::root::{DomRoot, MutNullableDom};
use dom::bindings::trace::JSTraceable;
use dom::webglrenderingcontext::WebGLRenderingContext;
-use heapsize::HeapSizeOf;
+use malloc_size_of::MallocSizeOf;
use std::any::Any;
use super::{WebGLExtension, WebGLExtensions};
/// Trait used internally by WebGLExtensions to store and
/// handle the different WebGL extensions in a common list.
-pub trait WebGLExtensionWrapper: JSTraceable + HeapSizeOf {
+pub trait WebGLExtensionWrapper: JSTraceable + MallocSizeOf {
fn instance_or_init(&self,
ctx: &WebGLRenderingContext,
ext: &WebGLExtensions)
@@ -26,7 +26,7 @@ pub trait WebGLExtensionWrapper: JSTraceable + HeapSizeOf {
}
#[must_root]
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub struct TypedWebGLExtensionWrapper<T: WebGLExtension> {
extension: MutNullableDom<T::Extension>
}
@@ -42,7 +42,7 @@ impl<T: WebGLExtension> TypedWebGLExtensionWrapper<T> {
}
impl<T> WebGLExtensionWrapper for TypedWebGLExtensionWrapper<T>
- where T: WebGLExtension + JSTraceable + HeapSizeOf + 'static {
+ where T: WebGLExtension + JSTraceable + MallocSizeOf + 'static {
#[allow(unsafe_code)]
fn instance_or_init(&self,
ctx: &WebGLRenderingContext,
@@ -82,7 +82,9 @@ impl<T> WebGLExtensionWrapper for TypedWebGLExtensionWrapper<T>
}
}
-impl<T> TypedWebGLExtensionWrapper<T> where T: WebGLExtension + JSTraceable + HeapSizeOf + 'static {
+impl<T> TypedWebGLExtensionWrapper<T>
+ where T: WebGLExtension + JSTraceable + MallocSizeOf + 'static
+{
pub fn dom_object(&self) -> Option<DomRoot<T::Extension>> {
self.extension.get()
}
diff --git a/components/script/dom/webgl_validations/types.rs b/components/script/dom/webgl_validations/types.rs
index 9271175b462..a2bdaa0de2f 100644
--- a/components/script/dom/webgl_validations/types.rs
+++ b/components/script/dom/webgl_validations/types.rs
@@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderi
/// with gl constants.
macro_rules! type_safe_wrapper {
($name: ident, $($variant:ident => $mod:ident::$constant:ident, )+) => {
- #[derive(Clone, Copy, Debug, Eq, Hash, HeapSizeOf, JSTraceable, PartialEq)]
+ #[derive(Clone, Copy, Debug, Eq, Hash, JSTraceable, MallocSizeOf, PartialEq)]
#[repr(u32)]
pub enum $name {
$(
diff --git a/components/script/dom/webglbuffer.rs b/components/script/dom/webglbuffer.rs
index fc916f99a6c..68cae62429b 100644
--- a/components/script/dom/webglbuffer.rs
+++ b/components/script/dom/webglbuffer.rs
@@ -27,7 +27,7 @@ pub struct WebGLBuffer {
// The Vertex Array Objects that are referencing this buffer
vao_references: DomRefCell<Option<HashSet<WebGLVertexArrayId>>>,
pending_delete: Cell<bool>,
- #[ignore_heap_size_of = "Defined in ipc-channel"]
+ #[ignore_malloc_size_of = "Defined in ipc-channel"]
renderer: WebGLMsgSender,
}
diff --git a/components/script/dom/webglframebuffer.rs b/components/script/dom/webglframebuffer.rs
index 1fcfbf83f51..c9165609cdb 100644
--- a/components/script/dom/webglframebuffer.rs
+++ b/components/script/dom/webglframebuffer.rs
@@ -19,7 +19,7 @@ use dom_struct::dom_struct;
use std::cell::Cell;
#[must_root]
-#[derive(Clone, HeapSizeOf, JSTraceable)]
+#[derive(Clone, JSTraceable, MallocSizeOf)]
enum WebGLFramebufferAttachment {
Renderbuffer(Dom<WebGLRenderbuffer>),
Texture { texture: Dom<WebGLTexture>, level: i32 },
@@ -34,7 +34,7 @@ pub struct WebGLFramebuffer {
is_deleted: Cell<bool>,
size: Cell<Option<(i32, i32)>>,
status: Cell<u32>,
- #[ignore_heap_size_of = "Defined in ipc-channel"]
+ #[ignore_malloc_size_of = "Defined in ipc-channel"]
renderer: WebGLMsgSender,
// The attachment points for textures and renderbuffers on this
diff --git a/components/script/dom/webglprogram.rs b/components/script/dom/webglprogram.rs
index 58b4b51f645..98b788fc2ae 100644
--- a/components/script/dom/webglprogram.rs
+++ b/components/script/dom/webglprogram.rs
@@ -27,7 +27,7 @@ pub struct WebGLProgram {
linked: Cell<bool>,
fragment_shader: MutNullableDom<WebGLShader>,
vertex_shader: MutNullableDom<WebGLShader>,
- #[ignore_heap_size_of = "Defined in ipc-channel"]
+ #[ignore_malloc_size_of = "Defined in ipc-channel"]
renderer: WebGLMsgSender,
}
diff --git a/components/script/dom/webglrenderbuffer.rs b/components/script/dom/webglrenderbuffer.rs
index c1cc99955b4..feac4eed416 100644
--- a/components/script/dom/webglrenderbuffer.rs
+++ b/components/script/dom/webglrenderbuffer.rs
@@ -21,7 +21,7 @@ pub struct WebGLRenderbuffer {
is_deleted: Cell<bool>,
size: Cell<Option<(i32, i32)>>,
internal_format: Cell<Option<u32>>,
- #[ignore_heap_size_of = "Defined in ipc-channel"]
+ #[ignore_malloc_size_of = "Defined in ipc-channel"]
renderer: WebGLMsgSender,
}
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index 98076fa4889..514fac1e492 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -135,7 +135,7 @@ fn has_invalid_blend_constants(arg1: u32, arg2: u32) -> bool {
/// Set of bitflags for texture unpacking (texImage2d, etc...)
bitflags! {
- #[derive(HeapSizeOf, JSTraceable)]
+ #[derive(JSTraceable, MallocSizeOf)]
flags TextureUnpacking: u8 {
const FLIP_Y_AXIS = 0x01,
const PREMULTIPLY_ALPHA = 0x02,
@@ -145,7 +145,7 @@ bitflags! {
/// Information about the bound textures of a WebGL texture unit.
#[must_root]
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
struct TextureUnitBindings {
bound_texture_2d: MutNullableDom<WebGLTexture>,
bound_texture_cube_map: MutNullableDom<WebGLTexture>,
@@ -181,15 +181,15 @@ impl TextureUnitBindings {
#[dom_struct]
pub struct WebGLRenderingContext {
reflector_: Reflector,
- #[ignore_heap_size_of = "Channels are hard"]
+ #[ignore_malloc_size_of = "Channels are hard"]
webgl_sender: WebGLMsgSender,
- #[ignore_heap_size_of = "Defined in webrender"]
+ #[ignore_malloc_size_of = "Defined in webrender"]
webrender_image: Cell<Option<webrender_api::ImageKey>>,
share_mode: WebGLContextShareMode,
- #[ignore_heap_size_of = "Defined in offscreen_gl_context"]
+ #[ignore_malloc_size_of = "Defined in offscreen_gl_context"]
limits: GLLimits,
canvas: Dom<HTMLCanvasElement>,
- #[ignore_heap_size_of = "Defined in canvas_traits"]
+ #[ignore_malloc_size_of = "Defined in canvas_traits"]
last_error: Cell<Option<WebGLError>>,
texture_unpacking_settings: Cell<TextureUnpacking>,
texture_unpacking_alignment: Cell<u32>,
@@ -201,11 +201,11 @@ pub struct WebGLRenderingContext {
bound_buffer_element_array: MutNullableDom<WebGLBuffer>,
bound_attrib_buffers: DomRefCell<FnvHashMap<u32, Dom<WebGLBuffer>>>,
current_program: MutNullableDom<WebGLProgram>,
- #[ignore_heap_size_of = "Because it's small"]
+ #[ignore_malloc_size_of = "Because it's small"]
current_vertex_attrib_0: Cell<(f32, f32, f32, f32)>,
- #[ignore_heap_size_of = "Because it's small"]
+ #[ignore_malloc_size_of = "Because it's small"]
current_scissor: Cell<(i32, i32, i32, i32)>,
- #[ignore_heap_size_of = "Because it's small"]
+ #[ignore_malloc_size_of = "Because it's small"]
current_clear_color: Cell<(f32, f32, f32, f32)>,
extension_manager: WebGLExtensions,
}
diff --git a/components/script/dom/webglshader.rs b/components/script/dom/webglshader.rs
index d2060b1756c..781db93c8f2 100644
--- a/components/script/dom/webglshader.rs
+++ b/components/script/dom/webglshader.rs
@@ -18,7 +18,7 @@ use dom_struct::dom_struct;
use std::cell::Cell;
use std::sync::{ONCE_INIT, Once};
-#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum ShaderCompilationStatus {
NotCompiled,
Succeeded,
@@ -35,7 +35,7 @@ pub struct WebGLShader {
is_deleted: Cell<bool>,
attached_counter: Cell<u32>,
compilation_status: Cell<ShaderCompilationStatus>,
- #[ignore_heap_size_of = "Defined in ipc-channel"]
+ #[ignore_malloc_size_of = "Defined in ipc-channel"]
renderer: WebGLMsgSender,
}
diff --git a/components/script/dom/webgltexture.rs b/components/script/dom/webgltexture.rs
index 6927fd10a48..1336718eb00 100644
--- a/components/script/dom/webgltexture.rs
+++ b/components/script/dom/webgltexture.rs
@@ -36,7 +36,7 @@ pub struct WebGLTexture {
target: Cell<Option<u32>>,
is_deleted: Cell<bool>,
/// Stores information about mipmap levels and cubemap faces.
- #[ignore_heap_size_of = "Arrays are cumbersome"]
+ #[ignore_malloc_size_of = "Arrays are cumbersome"]
image_info_array: DomRefCell<[ImageInfo; MAX_LEVEL_COUNT * MAX_FACE_COUNT]>,
/// Face count can only be 1 or 6
face_count: Cell<u8>,
@@ -44,7 +44,7 @@ pub struct WebGLTexture {
// Store information for min and mag filters
min_filter: Cell<Option<u32>>,
mag_filter: Cell<Option<u32>>,
- #[ignore_heap_size_of = "Defined in ipc-channel"]
+ #[ignore_malloc_size_of = "Defined in ipc-channel"]
renderer: WebGLMsgSender,
/// True if this texture is used for the DOMToTexture feature.
attached_to_dom: Cell<bool>,
@@ -394,7 +394,7 @@ impl Drop for WebGLTexture {
}
}
-#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub struct ImageInfo {
width: u32,
height: u32,
diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs
index 11172c403cb..47d3a6f3668 100644
--- a/components/script/dom/websocket.rs
+++ b/components/script/dom/websocket.rs
@@ -41,7 +41,7 @@ use task::{TaskOnce, TaskCanceller};
use task_source::TaskSource;
use task_source::networking::NetworkingTaskSource;
-#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
enum WebSocketRequestState {
Connecting = 0,
Open = 1,
@@ -104,7 +104,7 @@ pub struct WebSocket {
ready_state: Cell<WebSocketRequestState>,
buffered_amount: Cell<u64>,
clearing_buffer: Cell<bool>, //Flag to tell if there is a running thread to clear buffered_amount
- #[ignore_heap_size_of = "Defined in std"]
+ #[ignore_malloc_size_of = "Defined in std"]
sender: DomRefCell<Option<IpcSender<WebSocketDomAction>>>,
binary_type: Cell<BinaryType>,
protocol: DomRefCell<String>, //Subprotocol selected by server
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 9d2137911d7..6a62e124b92 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -127,14 +127,14 @@ use webrender_api::{ClipId, DocumentId};
use webvr_traits::WebVRMsg;
/// Current state of the window object
-#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
enum WindowState {
Alive,
Zombie, // Pipeline is closed, but the window hasn't been GCed yet.
}
/// Extra information concerning the reason for reflowing.
-#[derive(Debug, HeapSizeOf)]
+#[derive(Debug, MallocSizeOf)]
pub enum ReflowReason {
CachedPageNeededReflow,
RefreshTick,
@@ -161,24 +161,24 @@ pub enum ReflowReason {
#[dom_struct]
pub struct Window {
globalscope: GlobalScope,
- #[ignore_heap_size_of = "trait objects are hard"]
+ #[ignore_malloc_size_of = "trait objects are hard"]
script_chan: MainThreadScriptChan,
- #[ignore_heap_size_of = "task sources are hard"]
+ #[ignore_malloc_size_of = "task sources are hard"]
dom_manipulation_task_source: DOMManipulationTaskSource,
- #[ignore_heap_size_of = "task sources are hard"]
+ #[ignore_malloc_size_of = "task sources are hard"]
user_interaction_task_source: UserInteractionTaskSource,
- #[ignore_heap_size_of = "task sources are hard"]
+ #[ignore_malloc_size_of = "task sources are hard"]
networking_task_source: NetworkingTaskSource,
- #[ignore_heap_size_of = "task sources are hard"]
+ #[ignore_malloc_size_of = "task sources are hard"]
history_traversal_task_source: HistoryTraversalTaskSource,
- #[ignore_heap_size_of = "task sources are hard"]
+ #[ignore_malloc_size_of = "task sources are hard"]
file_reading_task_source: FileReadingTaskSource,
- #[ignore_heap_size_of = "task sources are hard"]
+ #[ignore_malloc_size_of = "task sources are hard"]
performance_timeline_task_source: PerformanceTimelineTaskSource,
navigator: MutNullableDom<Navigator>,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
image_cache: Arc<ImageCache>,
- #[ignore_heap_size_of = "channels are hard"]
+ #[ignore_malloc_size_of = "channels are hard"]
image_cache_chan: Sender<ImageCacheMsg>,
window_proxy: MutNullableDom<WindowProxy>,
document: MutNullableDom<Document>,
@@ -196,7 +196,7 @@ pub struct Window {
/// For sending timeline markers. Will be ignored if
/// no devtools server
devtools_markers: DomRefCell<HashSet<TimelineMarkerType>>,
- #[ignore_heap_size_of = "channels are hard"]
+ #[ignore_malloc_size_of = "channels are hard"]
devtools_marker_sender: DomRefCell<Option<IpcSender<Option<TimelineMarker>>>>,
/// Pending resize event, if any.
@@ -209,22 +209,22 @@ pub struct Window {
dom_static: GlobalStaticData,
/// The JavaScript runtime.
- #[ignore_heap_size_of = "Rc<T> is hard"]
+ #[ignore_malloc_size_of = "Rc<T> is hard"]
js_runtime: DomRefCell<Option<Rc<Runtime>>>,
/// A handle for communicating messages to the layout thread.
- #[ignore_heap_size_of = "channels are hard"]
+ #[ignore_malloc_size_of = "channels are hard"]
layout_chan: Sender<Msg>,
/// A handle to perform RPC calls into the layout, quickly.
- #[ignore_heap_size_of = "trait objects are hard"]
+ #[ignore_malloc_size_of = "trait objects are hard"]
layout_rpc: Box<LayoutRPC + Send + 'static>,
/// The current size of the window, in pixels.
window_size: Cell<Option<WindowSizeData>>,
/// A handle for communicating messages to the bluetooth thread.
- #[ignore_heap_size_of = "channels are hard"]
+ #[ignore_malloc_size_of = "channels are hard"]
bluetooth_thread: IpcSender<BluetoothRequest>,
bluetooth_extra_permission_data: BluetoothExtraPermissionData,
@@ -242,7 +242,7 @@ pub struct Window {
pending_reflow_count: Cell<u32>,
/// A channel for communicating results of async scripts back to the webdriver server
- #[ignore_heap_size_of = "channels are hard"]
+ #[ignore_malloc_size_of = "channels are hard"]
webdriver_script_chan: DomRefCell<Option<IpcSender<WebDriverJSResult>>>,
/// The current state of the window object
@@ -251,7 +251,7 @@ pub struct Window {
current_viewport: Cell<Rect<Au>>,
/// A flag to prevent async events from attempting to interact with this window.
- #[ignore_heap_size_of = "defined in std"]
+ #[ignore_malloc_size_of = "defined in std"]
ignore_further_async_events: DomRefCell<Arc<AtomicBool>>,
error_reporter: CSSErrorReporter,
@@ -265,11 +265,11 @@ pub struct Window {
test_runner: MutNullableDom<TestRunner>,
/// A handle for communicating messages to the webvr thread, if available.
- #[ignore_heap_size_of = "channels are hard"]
+ #[ignore_malloc_size_of = "channels are hard"]
webgl_chan: WebGLChan,
/// A handle for communicating messages to the webvr thread, if available.
- #[ignore_heap_size_of = "channels are hard"]
+ #[ignore_malloc_size_of = "channels are hard"]
webvr_chan: Option<IpcSender<WebVRMsg>>,
/// A map for storing the previous permission state read results.
@@ -290,7 +290,7 @@ pub struct Window {
/// <https://drafts.css-houdini.org/css-paint-api-1/#paint-worklet>
paint_worklet: MutNullableDom<Worklet>,
/// The Webrender Document id associated with this window.
- #[ignore_heap_size_of = "defined in webrender_api"]
+ #[ignore_malloc_size_of = "defined in webrender_api"]
webrender_document: DocumentId,
}
diff --git a/components/script/dom/worker.rs b/components/script/dom/worker.rs
index 4963b57c3aa..f397ef42148 100644
--- a/components/script/dom/worker.rs
+++ b/components/script/dom/worker.rs
@@ -36,12 +36,13 @@ pub type TrustedWorkerAddress = Trusted<Worker>;
#[dom_struct]
pub struct Worker {
eventtarget: EventTarget,
- #[ignore_heap_size_of = "Defined in std"]
+ #[ignore_malloc_size_of = "Defined in std"]
/// Sender to the Receiver associated with the DedicatedWorkerGlobalScope
/// this Worker created.
sender: Sender<(TrustedWorkerAddress, WorkerScriptMsg)>,
+ #[ignore_malloc_size_of = "Arc"]
closing: Arc<AtomicBool>,
- #[ignore_heap_size_of = "Defined in rust-mozjs"]
+ #[ignore_malloc_size_of = "Defined in rust-mozjs"]
runtime: Arc<Mutex<Option<SharedRt>>>,
terminated: Cell<bool>,
}
diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs
index ca7e2c3b7a9..760f879b37e 100644
--- a/components/script/dom/workerglobalscope.rs
+++ b/components/script/dom/workerglobalscope.rs
@@ -73,19 +73,19 @@ pub struct WorkerGlobalScope {
worker_id: WorkerId,
worker_url: ServoUrl,
- #[ignore_heap_size_of = "Arc"]
+ #[ignore_malloc_size_of = "Arc"]
closing: Option<Arc<AtomicBool>>,
- #[ignore_heap_size_of = "Defined in js"]
+ #[ignore_malloc_size_of = "Defined in js"]
runtime: Runtime,
location: MutNullableDom<WorkerLocation>,
navigator: MutNullableDom<WorkerNavigator>,
- #[ignore_heap_size_of = "Defined in ipc-channel"]
+ #[ignore_malloc_size_of = "Defined in ipc-channel"]
/// Optional `IpcSender` for sending the `DevtoolScriptControlMsg`
/// to the server from within the worker
from_devtools_sender: Option<IpcSender<DevtoolScriptControlMsg>>,
- #[ignore_heap_size_of = "Defined in std"]
+ #[ignore_malloc_size_of = "Defined in std"]
/// This `Receiver` will be ignored later if the corresponding
/// `IpcSender` doesn't exist
from_devtools_receiver: Receiver<DevtoolScriptControlMsg>,
diff --git a/components/script/dom/worklet.rs b/components/script/dom/worklet.rs
index ae122c8e0d5..7a608a189e1 100644
--- a/components/script/dom/worklet.rs
+++ b/components/script/dom/worklet.rs
@@ -151,7 +151,7 @@ impl WorkletMethods for Worklet {
#[derive(Clone, Copy, Debug, Eq, Hash, JSTraceable, PartialEq)]
pub struct WorkletId(Uuid);
-known_heap_size!(0, WorkletId);
+malloc_size_of_is_0!(WorkletId);
impl WorkletId {
fn new() -> WorkletId {
@@ -653,10 +653,10 @@ impl WorkletThread {
}
/// An executor of worklet tasks
-#[derive(Clone, HeapSizeOf, JSTraceable)]
+#[derive(Clone, JSTraceable, MallocSizeOf)]
pub struct WorkletExecutor {
worklet_id: WorkletId,
- #[ignore_heap_size_of = "channels are hard"]
+ #[ignore_malloc_size_of = "channels are hard"]
primary_sender: Sender<WorkletData>,
}
diff --git a/components/script/dom/workletglobalscope.rs b/components/script/dom/workletglobalscope.rs
index 3dea747ee74..653c8e6468e 100644
--- a/components/script/dom/workletglobalscope.rs
+++ b/components/script/dom/workletglobalscope.rs
@@ -40,7 +40,7 @@ pub struct WorkletGlobalScope {
/// The base URL for this worklet.
base_url: ServoUrl,
/// Sender back to the script thread
- #[ignore_heap_size_of = "channels are hard"]
+ #[ignore_malloc_size_of = "channels are hard"]
to_script_thread_sender: Sender<MainThreadScriptMsg>,
/// Worklet task executor
executor: WorkletExecutor,
@@ -155,7 +155,7 @@ pub struct WorkletGlobalScopeInit {
}
/// <https://drafts.css-houdini.org/worklets/#worklet-global-scope-type>
-#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable)]
+#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf)]
pub enum WorkletGlobalScopeType {
/// A servo-specific testing worklet
Test,
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index 2baa7351034..68a96ca38d6 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -73,7 +73,7 @@ use time;
use timers::{OneshotTimerCallback, OneshotTimerHandle};
use url::Position;
-#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
enum XMLHttpRequestState {
Unsent = 0,
Opened = 1,
@@ -82,7 +82,7 @@ enum XMLHttpRequestState {
Done = 4,
}
-#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub struct GenerationId(u32);
/// Closure of required data for each async network event that comprises the
@@ -131,20 +131,20 @@ pub struct XMLHttpRequest {
response_type: Cell<XMLHttpRequestResponseType>,
response_xml: MutNullableDom<Document>,
response_blob: MutNullableDom<Blob>,
- #[ignore_heap_size_of = "Defined in rust-mozjs"]
+ #[ignore_malloc_size_of = "Defined in rust-mozjs"]
response_json: Heap<JSVal>,
- #[ignore_heap_size_of = "Defined in hyper"]
+ #[ignore_malloc_size_of = "Defined in hyper"]
response_headers: DomRefCell<Headers>,
- #[ignore_heap_size_of = "Defined in hyper"]
+ #[ignore_malloc_size_of = "Defined in hyper"]
override_mime_type: DomRefCell<Option<Mime>>,
- #[ignore_heap_size_of = "Defined in rust-encoding"]
+ #[ignore_malloc_size_of = "Defined in rust-encoding"]
override_charset: DomRefCell<Option<EncodingRef>>,
// Associated concepts
- #[ignore_heap_size_of = "Defined in hyper"]
+ #[ignore_malloc_size_of = "Defined in hyper"]
request_method: DomRefCell<Method>,
request_url: DomRefCell<Option<ServoUrl>>,
- #[ignore_heap_size_of = "Defined in hyper"]
+ #[ignore_malloc_size_of = "Defined in hyper"]
request_headers: DomRefCell<Headers>,
request_body_len: Cell<usize>,
sync: Cell<bool>,
@@ -1243,7 +1243,7 @@ impl XMLHttpRequest {
use std::fmt;
// a dummy header so we can use headers.remove::<SetCookie2>()
- #[derive(Clone, Debug, HeapSizeOf)]
+ #[derive(Clone, Debug, MallocSizeOf)]
struct SetCookie2;
impl Header for SetCookie2 {
fn header_name() -> &'static str {
@@ -1334,9 +1334,9 @@ impl XMLHttpRequest {
}
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub struct XHRTimeoutCallback {
- #[ignore_heap_size_of = "Because it is non-owning"]
+ #[ignore_malloc_size_of = "Because it is non-owning"]
xhr: Trusted<XMLHttpRequest>,
generation_id: GenerationId,
}
diff --git a/components/script/lib.rs b/components/script/lib.rs
index 5f33f1e1151..edf954d4c96 100644
--- a/components/script/lib.rs
+++ b/components/script/lib.rs
@@ -39,8 +39,6 @@ extern crate euclid;
extern crate fnv;
extern crate gleam;
extern crate half;
-#[macro_use] extern crate heapsize;
-#[macro_use] extern crate heapsize_derive;
#[macro_use] extern crate html5ever;
#[macro_use]
extern crate hyper;
@@ -56,6 +54,8 @@ extern crate lazy_static;
extern crate libc;
#[macro_use]
extern crate log;
+#[macro_use] extern crate malloc_size_of;
+#[macro_use] extern crate malloc_size_of_derive;
extern crate metrics;
#[macro_use]
extern crate mime;
diff --git a/components/script/mem.rs b/components/script/mem.rs
index b40a78ec569..47491359a6d 100644
--- a/components/script/mem.rs
+++ b/components/script/mem.rs
@@ -6,24 +6,28 @@
use dom::bindings::conversions::get_dom_class;
use dom::bindings::reflector::DomObject;
-use heapsize::{HeapSizeOf, heap_size_of};
+use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use std::os::raw::c_void;
// This is equivalent to measuring a Box<T>, except that DOM objects lose their
// associated box in order to stash their pointers in a reserved slot of their
// JS reflector.
#[allow(unsafe_code)]
-pub fn heap_size_of_self_and_children<T: DomObject + HeapSizeOf>(obj: &T) -> usize {
+pub fn malloc_size_of_including_self<T: DomObject + MallocSizeOf>(
+ ops: &mut MallocSizeOfOps, obj: &T) -> usize
+{
unsafe {
let class = get_dom_class(obj.reflector().get_jsobject().get()).unwrap();
- (class.heap_size_of)(obj as *const T as *const c_void)
+ (class.malloc_size_of)(ops, obj as *const T as *const c_void)
}
}
-/// Used by codegen to include the pointer to the `HeapSizeOf` implementation of each
+/// Used by codegen to include the pointer to the `MallocSizeOf` implementation of each
/// IDL interface. This way we don't have to find the most-derived interface of DOM
/// objects by hand in code.
#[allow(unsafe_code)]
-pub unsafe fn heap_size_of_raw_self_and_children<T: HeapSizeOf>(obj: *const c_void) -> usize {
- heap_size_of(obj) + (*(obj as *const T)).heap_size_of_children()
+pub unsafe fn malloc_size_of_including_raw_self<T: MallocSizeOf>(
+ ops: &mut MallocSizeOfOps, obj: *const c_void) -> usize
+{
+ ops.malloc_size_of(obj) + (*(obj as *const T)).size_of(ops)
}
diff --git a/components/script/microtask.rs b/components/script/microtask.rs
index 7560d97d883..8457a43b1b8 100644
--- a/components/script/microtask.rs
+++ b/components/script/microtask.rs
@@ -21,7 +21,7 @@ use std::mem;
use std::rc::Rc;
/// A collection of microtasks in FIFO order.
-#[derive(Default, HeapSizeOf, JSTraceable)]
+#[derive(Default, JSTraceable, MallocSizeOf)]
pub struct MicrotaskQueue {
/// The list of enqueued microtasks that will be invoked at the next microtask checkpoint.
microtask_queue: DomRefCell<Vec<Microtask>>,
@@ -29,7 +29,7 @@ pub struct MicrotaskQueue {
performing_a_microtask_checkpoint: Cell<bool>,
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub enum Microtask {
Promise(EnqueuedPromiseCallback),
MediaElement(MediaElementMicrotask),
@@ -43,9 +43,9 @@ pub trait MicrotaskRunnable {
}
/// A promise callback scheduled to run during the next microtask checkpoint (#4283).
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub struct EnqueuedPromiseCallback {
- #[ignore_heap_size_of = "Rc has unclear ownership"]
+ #[ignore_malloc_size_of = "Rc has unclear ownership"]
pub callback: Rc<PromiseJobCallback>,
pub pipeline: PipelineId,
}
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 1413a0c40dc..e5a9a0401aa 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -73,7 +73,8 @@ use js::jsapi::{JSAutoCompartment, JSContext, JS_SetWrapObjectCallbacks};
use js::jsapi::{JSTracer, SetWindowProxyClass};
use js::jsval::UndefinedValue;
use js::rust::Runtime;
-use mem::heap_size_of_self_and_children;
+use malloc_size_of::{malloc_size_of, MallocSizeOfOps};
+use mem::malloc_size_of_including_self;
use metrics::PaintTimeMetrics;
use microtask::{MicrotaskQueue, Microtask};
use msg::constellation_msg::{BrowsingContextId, FrameType, PipelineId, PipelineNamespace, TopLevelBrowsingContextId};
@@ -1503,14 +1504,17 @@ impl ScriptThread {
let mut path_seg = String::from("url(");
let mut dom_tree_size = 0;
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);
for (_, document) in self.documents.borrow().iter() {
let current_url = document.url();
for child in document.upcast::<Node>().traverse_preorder() {
- dom_tree_size += heap_size_of_self_and_children(&*child);
+ dom_tree_size += malloc_size_of_including_self(&mut ops, &*child);
}
- dom_tree_size += heap_size_of_self_and_children(document.window());
+ dom_tree_size += malloc_size_of_including_self(&mut ops, document.window());
if reports.len() > 0 {
path_seg.push_str(", ");
diff --git a/components/script/textinput.rs b/components/script/textinput.rs
index a2374cb6a82..3c533964b7d 100644
--- a/components/script/textinput.rs
+++ b/components/script/textinput.rs
@@ -22,7 +22,7 @@ pub enum Selection {
NotSelected
}
-#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub enum SelectionDirection {
Forward,
Backward,
@@ -49,7 +49,7 @@ impl From<SelectionDirection> for DOMString {
}
}
-#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub struct TextPoint {
/// 0-based line number
pub line: usize,
@@ -58,7 +58,7 @@ pub struct TextPoint {
}
/// Encapsulated state for handling keyboard input in a single or multiline text input control.
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub struct TextInput<T: ClipboardProvider> {
/// Current text input content, split across lines without trailing '\n'
lines: Vec<DOMString>,
@@ -68,7 +68,7 @@ pub struct TextInput<T: ClipboardProvider> {
pub selection_begin: Option<TextPoint>,
/// Is this a multiline input?
multiline: bool,
- #[ignore_heap_size_of = "Can't easily measure this generic type"]
+ #[ignore_malloc_size_of = "Can't easily measure this generic type"]
clipboard_provider: T,
/// The maximum number of UTF-16 code units this text input is allowed to hold.
///
diff --git a/components/script/timers.rs b/components/script/timers.rs
index 1f69eca03ba..4bc4bf37fff 100644
--- a/components/script/timers.rs
+++ b/components/script/timers.rs
@@ -13,7 +13,6 @@ use dom::globalscope::GlobalScope;
use dom::testbinding::TestBindingCallback;
use dom::xmlhttprequest::XHRTimeoutCallback;
use euclid::Length;
-use heapsize::HeapSizeOf;
use ipc_channel::ipc::IpcSender;
use js::jsapi::{HandleValue, Heap};
use js::jsval::{JSVal, UndefinedValue};
@@ -27,15 +26,15 @@ use std::collections::HashMap;
use std::default::Default;
use std::rc::Rc;
-#[derive(Clone, Copy, Debug, Eq, Hash, HeapSizeOf, JSTraceable, Ord, PartialEq, PartialOrd)]
+#[derive(Clone, Copy, Debug, Eq, Hash, JSTraceable, MallocSizeOf, Ord, PartialEq, PartialOrd)]
pub struct OneshotTimerHandle(i32);
-#[derive(DenyPublicFields, HeapSizeOf, JSTraceable)]
+#[derive(DenyPublicFields, JSTraceable, MallocSizeOf)]
pub struct OneshotTimers {
js_timers: JsTimers,
- #[ignore_heap_size_of = "Defined in std"]
+ #[ignore_malloc_size_of = "Defined in std"]
timer_event_chan: IpcSender<TimerEvent>,
- #[ignore_heap_size_of = "Defined in std"]
+ #[ignore_malloc_size_of = "Defined in std"]
scheduler_chan: IpcSender<TimerSchedulerMsg>,
next_timer_handle: Cell<OneshotTimerHandle>,
timers: DomRefCell<Vec<OneshotTimer>>,
@@ -54,7 +53,7 @@ pub struct OneshotTimers {
expected_event_id: Cell<TimerEventId>,
}
-#[derive(DenyPublicFields, HeapSizeOf, JSTraceable)]
+#[derive(DenyPublicFields, JSTraceable, MallocSizeOf)]
struct OneshotTimer {
handle: OneshotTimerHandle,
source: TimerSource,
@@ -65,7 +64,7 @@ struct OneshotTimer {
// This enum is required to work around the fact that trait objects do not support generic methods.
// A replacement trait would have a method such as
// `invoke<T: DomObject>(self: Box<Self>, this: &T, js_timers: &JsTimers);`.
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub enum OneshotTimerCallback {
XhrTimeout(XHRTimeoutCallback),
EventSourceTimeout(EventSourceTimeoutCallback),
@@ -301,10 +300,10 @@ impl OneshotTimers {
}
}
-#[derive(Clone, Copy, Eq, Hash, HeapSizeOf, JSTraceable, Ord, PartialEq, PartialOrd)]
+#[derive(Clone, Copy, Eq, Hash, JSTraceable, MallocSizeOf, Ord, PartialEq, PartialOrd)]
pub struct JsTimerHandle(i32);
-#[derive(DenyPublicFields, HeapSizeOf, JSTraceable)]
+#[derive(DenyPublicFields, JSTraceable, MallocSizeOf)]
pub struct JsTimers {
next_timer_handle: Cell<JsTimerHandle>,
active_timers: DomRefCell<HashMap<JsTimerHandle, JsTimerEntry>>,
@@ -314,7 +313,7 @@ pub struct JsTimers {
min_duration: Cell<Option<MsDuration>>,
}
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
struct JsTimerEntry {
oneshot_handle: OneshotTimerHandle,
}
@@ -323,9 +322,9 @@ struct JsTimerEntry {
// (ie. function value to invoke and all arguments to pass
// to the function when calling it)
// TODO: Handle rooting during invocation when movable GC is turned on
-#[derive(HeapSizeOf, JSTraceable)]
+#[derive(JSTraceable, MallocSizeOf)]
pub struct JsTimerTask {
- #[ignore_heap_size_of = "Because it is non-owning"]
+ #[ignore_malloc_size_of = "Because it is non-owning"]
handle: JsTimerHandle,
source: TimerSource,
callback: InternalTimerCallback,
@@ -335,7 +334,7 @@ pub struct JsTimerTask {
}
// Enum allowing more descriptive values for the is_interval field
-#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
+#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub enum IsInterval {
Interval,
NonInterval,
@@ -347,17 +346,14 @@ pub enum TimerCallback {
FunctionTimerCallback(Rc<Function>),
}
-#[derive(Clone, JSTraceable)]
+#[derive(Clone, JSTraceable, MallocSizeOf)]
enum InternalTimerCallback {
StringTimerCallback(DOMString),
- FunctionTimerCallback(Rc<Function>, Rc<Box<[Heap<JSVal>]>>),
-}
-
-impl HeapSizeOf for InternalTimerCallback {
- 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
- }
+ FunctionTimerCallback(
+ #[ignore_malloc_size_of = "Rc"]
+ Rc<Function>,
+ #[ignore_malloc_size_of = "Rc"]
+ Rc<Box<[Heap<JSVal>]>>),
}
impl JsTimers {