diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2015-10-11 11:50:38 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2015-10-14 21:52:16 +0200 |
commit | da676309318a7069650ca2cd571de7fa9b9e516a (patch) | |
tree | c4f1646796e0d192358f70ea323e230693514177 /components/script/dom/bindings/codegen | |
parent | 32daa17d5cbcad02db0713e21e52410cdc60480e (diff) | |
download | servo-da676309318a7069650ca2cd571de7fa9b9e516a.tar.gz servo-da676309318a7069650ca2cd571de7fa9b9e516a.zip |
Introduce DOMClass::heap_size_of
It holds a function pointer to the HeapSizeOf::heap_size_of_children()
implementation corresponding to that IDL interface.
This removes the need for a clumsly TypeId-based match expression in the
former heap_size_of_eventtarget() function.
Diffstat (limited to 'components/script/dom/bindings/codegen')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 5 |
1 files changed, 4 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', |