aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py5
-rw-r--r--components/script/dom/bindings/utils.rs4
2 files changed, 8 insertions, 1 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 00df29230c3..16663692ed7 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -1748,12 +1748,14 @@ def DOMClass(descriptor):
# padding.
protoList.extend(['PrototypeList::ID::Count'] * (descriptor.config.maxProtoChainLength - len(protoList)))
prototypeChainString = ', '.join(protoList)
+ heapSizeOf = 'heap_size_of_raw_self_and_children::<%s>' % descriptor.interface.identifier.name
return """\
DOMClass {
interface_chain: [ %s ],
native_hooks: &sNativePropertyHooks,
type_id: %s,
-}""" % (prototypeChainString, DOMClassTypeId(descriptor))
+ heap_size_of: %s as unsafe fn(_) -> _,
+}""" % (prototypeChainString, DOMClassTypeId(descriptor), heapSizeOf)
class CGDOMJSClass(CGThing):
@@ -5139,6 +5141,7 @@ class CGBindingRoot(CGThing):
'dom::bindings::num::Finite',
'dom::bindings::str::ByteString',
'dom::bindings::str::USVString',
+ 'mem::heap_size_of_raw_self_and_children',
'libc',
'util::str::DOMString',
'std::borrow::ToOwned',
diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs
index 52cf58e4ff0..3b672e68f9e 100644
--- a/components/script/dom/bindings/utils.rs
+++ b/components/script/dom/bindings/utils.rs
@@ -150,6 +150,7 @@ pub struct NativePropertyHooks {
}
/// The struct that holds inheritance information for DOM object reflectors.
+#[allow(raw_pointer_derive)]
#[derive(Copy, Clone)]
pub struct DOMClass {
/// A list of interfaces that this object implements, in order of decreasing
@@ -161,6 +162,9 @@ pub struct DOMClass {
/// The NativePropertyHooks for the interface associated with this class.
pub native_hooks: &'static NativePropertyHooks,
+
+ /// The HeapSizeOf function wrapper for that interface.
+ pub heap_size_of: unsafe fn(*const libc::c_void) -> usize,
}
unsafe impl Sync for DOMClass {}