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

@ -9,6 +9,7 @@ use dom::bindings::conversions::ToJSValConvertible;
use dom::bindings::global::GlobalRef;
use dom::domexception::{DOMException, DOMErrorName};
use util::mem::HeapSizeOf;
use util::str::DOMString;
use js::jsapi::{JSContext, JSObject, RootedValue};
@ -24,7 +25,7 @@ use std::ptr;
use std::mem;
/// DOM exceptions that can be thrown by a native DOM method.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, HeapSizeOf)]
pub enum Error {
/// IndexSizeError DOMException
IndexSize,

View file

@ -27,6 +27,8 @@ use js::jsapi::{GetGlobalForObjectCrossCompartment};
use js::jsapi::{JSContext, JSObject, JS_GetClass, MutableHandleValue};
use url::Url;
use util::mem::HeapSizeOf;
/// A freely-copyable reference to a rooted global object.
#[derive(Copy, Clone)]
pub enum GlobalRef<'a> {
@ -47,7 +49,7 @@ pub enum GlobalRoot {
/// A traced reference to a global object, for use in fields of traced Rust
/// structures.
#[derive(JSTraceable)]
#[derive(JSTraceable, HeapSizeOf)]
#[must_root]
pub enum GlobalField {
/// A field for a `Window` object.

View file

@ -463,4 +463,3 @@ impl<T: Reflectable> Drop for Root<T> {
unsafe { (*self.root_list).unroot(self); }
}
}

View file

@ -11,8 +11,10 @@ use std::ops;
use std::str;
use std::str::FromStr;
use util::mem::HeapSizeOf;
/// Encapsulates the IDL `ByteString` type.
#[derive(JSTraceable,Clone,Eq,PartialEq)]
#[derive(JSTraceable, Clone, Eq, PartialEq, HeapSizeOf)]
pub struct ByteString(Vec<u8>);
impl ByteString {