Skip to content

Commit

Permalink
make dom_struct derive HeapSizeOf,
Browse files Browse the repository at this point in the history
closes #7357
  • Loading branch information
jxs committed Aug 26, 2015
1 parent fa5ad1c commit 677b844
Show file tree
Hide file tree
Showing 155 changed files with 3 additions and 226 deletions.
1 change: 1 addition & 0 deletions components/plugins/jstraceable.rs
Expand Up @@ -17,6 +17,7 @@ pub fn expand_dom_struct(cx: &mut ExtCtxt, sp: Span, _: &MetaItem, anno: Annotat
item2.attrs.push(quote_attr!(cx, #[must_root]));
item2.attrs.push(quote_attr!(cx, #[privatize]));
item2.attrs.push(quote_attr!(cx, #[derive(JSTraceable)]));
item2.attrs.push(quote_attr!(cx, #[derive(HeapSizeOf)]));

// The following attributes are only for internal usage
item2.attrs.push(quote_attr!(cx, #[_generate_reflector]));
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/attr.rs
Expand Up @@ -111,7 +111,6 @@ impl Deref for AttrValue {

// https://dom.spec.whatwg.org/#interface-attr
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct Attr {
reflector_: Reflector,
local_name: Atom,
Expand Down
1 change: 1 addition & 0 deletions components/script/dom/bindings/js.rs
Expand Up @@ -207,6 +207,7 @@ impl MutHeapJSVal {
/// `JS<T>`.
#[must_root]
#[derive(JSTraceable)]
#[derive(HeapSizeOf)]
pub struct MutHeap<T: HeapGCValue + Copy> {
val: Cell<T>,
}
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/blob.rs
Expand Up @@ -25,7 +25,6 @@ pub enum BlobTypeId {

// http://dev.w3.org/2006/webapi/FileAPI/#blob
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct Blob {
reflector_: Reflector,
type_: BlobTypeId,
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/canvasgradient.rs
Expand Up @@ -16,7 +16,6 @@ use dom::canvasrenderingcontext2d::parse_color;

// https://html.spec.whatwg.org/multipage/#canvasgradient
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct CanvasGradient {
reflector_: Reflector,
style: CanvasGradientStyle,
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/canvaspattern.rs
Expand Up @@ -12,7 +12,6 @@ use euclid::size::Size2D;

// https://html.spec.whatwg.org/multipage/#canvaspattern
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct CanvasPattern {
reflector_: Reflector,
surface_data: Vec<u8>,
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/canvasrenderingcontext2d.rs
Expand Up @@ -61,7 +61,6 @@ pub enum CanvasFillOrStrokeStyle {

// https://html.spec.whatwg.org/multipage/#canvasrenderingcontext2d
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct CanvasRenderingContext2D {
reflector_: Reflector,
global: GlobalField,
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/characterdata.rs
Expand Up @@ -24,7 +24,6 @@ use std::cell::Ref;

// https://dom.spec.whatwg.org/#characterdata
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct CharacterData {
node: Node,
data: DOMRefCell<DOMString>,
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/closeevent.rs
Expand Up @@ -16,7 +16,6 @@ use script_task::ScriptChan;
use util::str::DOMString;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct CloseEvent {
event: Event,
wasClean: bool,
Expand Down
2 changes: 0 additions & 2 deletions components/script/dom/comment.rs
Expand Up @@ -16,7 +16,6 @@ use util::str::DOMString;

/// An HTML comment.
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct Comment {
characterdata: CharacterData,
}
Expand Down Expand Up @@ -44,4 +43,3 @@ impl Comment {
Ok(Comment::new(data, document.r()))
}
}

1 change: 0 additions & 1 deletion components/script/dom/console.rs
Expand Up @@ -13,7 +13,6 @@ use util::str::DOMString;

// https://developer.mozilla.org/en-US/docs/Web/API/Console
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct Console {
reflector_: Reflector,
global: GlobalField,
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/crypto.rs
Expand Up @@ -22,7 +22,6 @@ no_jsmanaged_fields!(OsRng);

// https://developer.mozilla.org/en-US/docs/Web/API/Crypto
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct Crypto {
reflector_: Reflector,
rng: DOMRefCell<OsRng>,
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/css.rs
Expand Up @@ -10,7 +10,6 @@ use util::str::DOMString;
use cssparser::serialize_identifier;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct CSS {
reflector_: Reflector,
}
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/cssstyledeclaration.rs
Expand Up @@ -24,7 +24,6 @@ use std::cell::Ref;

// http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct CSSStyleDeclaration {
reflector_: Reflector,
owner: JS<Element>,
Expand Down
2 changes: 0 additions & 2 deletions components/script/dom/customevent.rs
Expand Up @@ -17,7 +17,6 @@ use util::str::DOMString;

// https://dom.spec.whatwg.org/#interface-customevent
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct CustomEvent {
event: Event,
#[ignore_heap_size_of = "Defined in rust-mozjs"]
Expand Down Expand Up @@ -85,4 +84,3 @@ impl<'a> CustomEventMethods for &'a CustomEvent {
event.InitEvent(type_, can_bubble, cancelable);
}
}

1 change: 0 additions & 1 deletion components/script/dom/dedicatedworkerglobalscope.rs
Expand Up @@ -138,7 +138,6 @@ enum MixedMessage {

// https://html.spec.whatwg.org/multipage/#dedicatedworkerglobalscope
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct DedicatedWorkerGlobalScope {
workerglobalscope: WorkerGlobalScope,
id: PipelineId,
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/document.rs
Expand Up @@ -113,7 +113,6 @@ pub enum IsHTMLDocument {

// https://dom.spec.whatwg.org/#document
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct Document {
node: Node,
window: JS<Window>,
Expand Down
2 changes: 0 additions & 2 deletions components/script/dom/documentfragment.rs
Expand Up @@ -21,7 +21,6 @@ use util::str::DOMString;

// https://dom.spec.whatwg.org/#documentfragment
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct DocumentFragment {
node: Node,
}
Expand Down Expand Up @@ -96,4 +95,3 @@ impl<'a> DocumentFragmentMethods for &'a DocumentFragment {
root.query_selector_all(selectors)
}
}

2 changes: 0 additions & 2 deletions components/script/dom/documenttype.rs
Expand Up @@ -18,7 +18,6 @@ use std::borrow::ToOwned;
// https://dom.spec.whatwg.org/#documenttype
/// The `DOCTYPE` tag.
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct DocumentType {
node: Node,
name: DOMString,
Expand Down Expand Up @@ -111,4 +110,3 @@ impl<'a> DocumentTypeMethods for &'a DocumentType {
node.remove_self();
}
}

1 change: 0 additions & 1 deletion components/script/dom/domexception.rs
Expand Up @@ -41,7 +41,6 @@ pub enum DOMErrorName {
}

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct DOMException {
reflector_: Reflector,
code: DOMErrorName,
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/domimplementation.rs
Expand Up @@ -27,7 +27,6 @@ use std::borrow::ToOwned;

// https://dom.spec.whatwg.org/#domimplementation
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct DOMImplementation {
reflector_: Reflector,
document: JS<Document>,
Expand Down
2 changes: 0 additions & 2 deletions components/script/dom/domparser.rs
Expand Up @@ -21,7 +21,6 @@ use util::str::DOMString;
use std::borrow::ToOwned;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct DOMParser {
reflector_: Reflector,
window: JS<Window>, //XXXjdm Document instead?
Expand Down Expand Up @@ -81,4 +80,3 @@ impl<'a> DOMParserMethods for &'a DOMParser {
}
}
}

2 changes: 0 additions & 2 deletions components/script/dom/dompoint.rs
Expand Up @@ -12,7 +12,6 @@ use dom::dompointreadonly::{DOMPointReadOnly, DOMPointWriteMethods};

// http://dev.w3.org/fxtf/geometry/Overview.html#dompoint
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct DOMPoint {
point: DOMPointReadOnly
}
Expand Down Expand Up @@ -75,4 +74,3 @@ impl<'a> DOMPointMethods for &'a DOMPoint {
self.point.SetW(value);
}
}

1 change: 0 additions & 1 deletion components/script/dom/dompointreadonly.rs
Expand Up @@ -11,7 +11,6 @@ use std::cell::Cell;

// http://dev.w3.org/fxtf/geometry/Overview.html#dompointreadonly
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct DOMPointReadOnly {
reflector_: Reflector,
x: Cell<f64>,
Expand Down
2 changes: 0 additions & 2 deletions components/script/dom/domrect.rs
Expand Up @@ -12,7 +12,6 @@ use dom::window::Window;
use util::geometry::Au;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct DOMRect {
reflector_: Reflector,
top: f32,
Expand Down Expand Up @@ -74,4 +73,3 @@ impl<'a> DOMRectMethods for &'a DOMRect {
Finite::wrap(result)
}
}

2 changes: 0 additions & 2 deletions components/script/dom/domrectlist.rs
Expand Up @@ -11,7 +11,6 @@ use dom::domrect::DOMRect;
use dom::window::Window;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct DOMRectList {
reflector_: Reflector,
rects: Vec<JS<DOMRect>>,
Expand Down Expand Up @@ -55,4 +54,3 @@ impl<'a> DOMRectListMethods for &'a DOMRectList {
self.Item(index)
}
}

1 change: 0 additions & 1 deletion components/script/dom/domstringmap.rs
Expand Up @@ -13,7 +13,6 @@ use dom::node::window_from_node;
use util::str::DOMString;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct DOMStringMap {
reflector_: Reflector,
element: JS<HTMLElement>,
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/domtokenlist.rs
Expand Up @@ -19,7 +19,6 @@ use util::str::{DOMString, HTML_SPACE_CHARACTERS, str_join};
use std::borrow::ToOwned;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct DOMTokenList {
reflector_: Reflector,
element: JS<Element>,
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/element.rs
Expand Up @@ -92,7 +92,6 @@ use std::mem;
use std::sync::Arc;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct Element {
node: Node,
local_name: Atom,
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/errorevent.rs
Expand Up @@ -22,7 +22,6 @@ use std::borrow::ToOwned;
use std::cell::Cell;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct ErrorEvent {
event: Event,
message: DOMRefCell<DOMString>,
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/event.rs
Expand Up @@ -54,7 +54,6 @@ pub enum EventCancelable {
}

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct Event {
reflector_: Reflector,
type_id: EventTypeId,
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/eventtarget.rs
Expand Up @@ -130,7 +130,6 @@ pub struct EventListenerEntry {
}

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct EventTarget {
reflector_: Reflector,
type_id: EventTargetTypeId,
Expand Down
2 changes: 0 additions & 2 deletions components/script/dom/file.rs
Expand Up @@ -11,7 +11,6 @@ use dom::blob::{Blob, BlobTypeId};
use util::str::DOMString;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct File {
blob: Blob,
name: DOMString,
Expand Down Expand Up @@ -46,4 +45,3 @@ impl<'a> FileMethods for &'a File {
self.name.clone()
}
}

2 changes: 0 additions & 2 deletions components/script/dom/filelist.rs
Expand Up @@ -12,7 +12,6 @@ use dom::window::Window;

// https://w3c.github.io/FileAPI/#dfn-filelist
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct FileList {
reflector_: Reflector,
list: Vec<JS<File>>
Expand Down Expand Up @@ -49,4 +48,3 @@ impl<'a> FileListMethods for &'a FileList {
item
}
}

1 change: 0 additions & 1 deletion components/script/dom/filereader.rs
Expand Up @@ -67,7 +67,6 @@ pub enum FileReaderReadyState {
}

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct FileReader {
eventtarget: EventTarget,
global: GlobalField,
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/formdata.rs
Expand Up @@ -30,7 +30,6 @@ pub enum FormDatum {
}

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct FormData {
reflector_: Reflector,
data: DOMRefCell<HashMap<DOMString, Vec<FormDatum>>>,
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/htmlanchorelement.rs
Expand Up @@ -33,7 +33,6 @@ use url::UrlParser;
use std::default::Default;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct HTMLAnchorElement {
htmlelement: HTMLElement,
rel_list: MutNullableHeap<JS<DOMTokenList>>,
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/htmlappletelement.rs
Expand Up @@ -20,7 +20,6 @@ use string_cache::Atom;
use util::str::DOMString;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct HTMLAppletElement {
htmlelement: HTMLElement
}
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/htmlareaelement.rs
Expand Up @@ -22,7 +22,6 @@ use string_cache::Atom;
use util::str::DOMString;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct HTMLAreaElement {
htmlelement: HTMLElement,
rel_list: MutNullableHeap<JS<DOMTokenList>>,
Expand Down
2 changes: 0 additions & 2 deletions components/script/dom/htmlaudioelement.rs
Expand Up @@ -14,7 +14,6 @@ use dom::node::{Node, NodeTypeId};
use util::str::DOMString;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct HTMLAudioElement {
htmlmediaelement: HTMLMediaElement
}
Expand Down Expand Up @@ -46,4 +45,3 @@ impl HTMLAudioElement {
Node::reflect_node(box element, document, HTMLAudioElementBinding::Wrap)
}
}

1 change: 0 additions & 1 deletion components/script/dom/htmlbaseelement.rs
Expand Up @@ -19,7 +19,6 @@ use util::str::DOMString;
use url::{Url, UrlParser};

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct HTMLBaseElement {
htmlelement: HTMLElement
}
Expand Down
2 changes: 0 additions & 2 deletions components/script/dom/htmlbodyelement.rs
Expand Up @@ -35,7 +35,6 @@ use time;
const INITIAL_REFLOW_DELAY: u64 = 200_000_000;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct HTMLBodyElement {
htmlelement: HTMLElement,
background_color: Cell<Option<RGBA>>,
Expand Down Expand Up @@ -183,4 +182,3 @@ impl<'a> VirtualMethods for &'a HTMLBodyElement {
}
}
}

0 comments on commit 677b844

Please sign in to comment.