Measure heap memory usage for more types. Fixes #6951

This commit is contained in:
Bogdan Cuza 2015-08-05 18:31:42 +03:00
parent 94c8dcd575
commit 45145108da
175 changed files with 669 additions and 94 deletions

View file

@ -30,8 +30,10 @@ pub enum CollectionTypeId {
}
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct HTMLCollection {
reflector_: Reflector,
#[ignore_heap_size_of = "Contains a trait object; can't measure due to #6870"]
collection: CollectionTypeId,
}
@ -57,7 +59,7 @@ impl HTMLCollection {
fn all_elements(window: &Window, root: &Node,
namespace_filter: Option<Namespace>) -> Root<HTMLCollection> {
#[derive(JSTraceable)]
#[derive(JSTraceable, HeapSizeOf)]
struct AllElementFilter {
namespace_filter: Option<Namespace>
}
@ -79,7 +81,7 @@ impl HTMLCollection {
return HTMLCollection::all_elements(window, root, None);
}
#[derive(JSTraceable)]
#[derive(JSTraceable, HeapSizeOf)]
struct TagNameFilter {
tag: Atom,
ascii_lower_tag: Atom,
@ -110,7 +112,7 @@ impl HTMLCollection {
if tag == "*" {
return HTMLCollection::all_elements(window, root, namespace_filter);
}
#[derive(JSTraceable)]
#[derive(JSTraceable, HeapSizeOf)]
struct TagNameNSFilter {
tag: Atom,
namespace_filter: Option<Namespace>
@ -135,7 +137,7 @@ impl HTMLCollection {
pub fn by_class_name(window: &Window, root: &Node, classes: DOMString)
-> Root<HTMLCollection> {
#[derive(JSTraceable)]
#[derive(JSTraceable, HeapSizeOf)]
struct ClassNameFilter {
classes: Vec<Atom>
}
@ -153,7 +155,7 @@ impl HTMLCollection {
}
pub fn children(window: &Window, root: &Node) -> Root<HTMLCollection> {
#[derive(JSTraceable)]
#[derive(JSTraceable, HeapSizeOf)]
struct ElementChildFilter;
impl CollectionFilter for ElementChildFilter {
fn filter(&self, elem: &Element, root: &Node) -> bool {