aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-10-15 07:13:55 -0600
committerbors-servo <metajack+bors@gmail.com>2015-10-15 07:13:55 -0600
commit5a0a91eba794af027723051c7f039cb22088aa65 (patch)
tree7b5a40eea5731c0906d7658a08a0dc782ac7da8d /components/script/dom/bindings/codegen
parentf8ada66919c8fda836b8e33375e82c1ef9059999 (diff)
parentda676309318a7069650ca2cd571de7fa9b9e516a (diff)
downloadservo-5a0a91eba794af027723051c7f039cb22088aa65.tar.gz
servo-5a0a91eba794af027723051c7f039cb22088aa65.zip
Auto merge of #7972 - nox:codegen-heapsize, r=Ms2ger
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. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7972) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/bindings/codegen')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py5
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 9c5592c67b2..3378700ca99 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):
@@ -5141,6 +5143,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',