mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
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.
This commit is contained in:
parent
32daa17d5c
commit
da67630931
4 changed files with 28 additions and 236 deletions
|
@ -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',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue