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 -->
This commit is contained in:
bors-servo 2015-10-15 07:13:55 -06:00
commit 5a0a91eba7
4 changed files with 28 additions and 236 deletions

View file

@ -61,7 +61,7 @@ use js::rust::Runtime;
use layout_interface::{ReflowQueryType};
use layout_interface::{self, LayoutChan, NewLayoutTaskInfo, ReflowGoal, ScriptLayoutChan};
use libc;
use mem::heap_size_of_eventtarget;
use mem::heap_size_of_self_and_children;
use msg::compositor_msg::{LayerId, ScriptToCompositorMsg};
use msg::constellation_msg::Msg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, FocusType, LoadData};
@ -1258,11 +1258,11 @@ impl ScriptTask {
for child in NodeCast::from_ref(&*it_page.document()).traverse_preorder() {
let target = EventTargetCast::from_ref(&*child);
dom_tree_size += heap_size_of_eventtarget(target);
dom_tree_size += heap_size_of_self_and_children(target);
}
let window = it_page.window();
let target = EventTargetCast::from_ref(&*window);
dom_tree_size += heap_size_of_eventtarget(target);
dom_tree_size += heap_size_of_self_and_children(target);
reports.push(Report {
path: path![format!("url({})", current_url), "dom-tree"],