Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make dom_struct derive HeapSizeOf #7361

Merged
merged 1 commit into from Aug 27, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

make dom_struct derive HeapSizeOf,

closes #7357
  • Loading branch information
jxs committed Aug 27, 2015
commit fd87c8cb3ee5ac2be258e0420420c228299c90e3
@@ -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]));
@@ -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,
@@ -207,6 +207,7 @@ impl MutHeapJSVal {
/// `JS<T>`.
#[must_root]
#[derive(JSTraceable)]
#[derive(HeapSizeOf)]

This comment has been minimized.

@jxs

jxs Aug 26, 2015

Author Contributor

added derive for MutHeap

pub struct MutHeap<T: HeapGCValue + Copy> {
val: Cell<T>,
}
@@ -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,
@@ -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,
@@ -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>,
@@ -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,
@@ -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>,
@@ -16,7 +16,6 @@ use script_task::ScriptChan;
use util::str::DOMString;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct CloseEvent {
event: Event,
wasClean: bool,
@@ -16,7 +16,6 @@ use util::str::DOMString;

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

@@ -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,
@@ -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>,
@@ -10,7 +10,6 @@ use util::str::DOMString;
use cssparser::serialize_identifier;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct CSS {
reflector_: Reflector,
}
@@ -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>,
@@ -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"]
@@ -85,4 +84,3 @@ impl<'a> CustomEventMethods for &'a CustomEvent {
event.InitEvent(type_, can_bubble, cancelable);
}
}

@@ -138,7 +138,6 @@ enum MixedMessage {

// https://html.spec.whatwg.org/multipage/#dedicatedworkerglobalscope
#[dom_struct]
#[derive(HeapSizeOf)]
pub struct DedicatedWorkerGlobalScope {
workerglobalscope: WorkerGlobalScope,
id: PipelineId,
@@ -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>,
@@ -21,7 +21,6 @@ use util::str::DOMString;

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

@@ -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,
@@ -111,4 +110,3 @@ impl<'a> DocumentTypeMethods for &'a DocumentType {
node.remove_self();
}
}

@@ -41,7 +41,6 @@ pub enum DOMErrorName {
}

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct DOMException {
reflector_: Reflector,
code: DOMErrorName,
@@ -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>,
@@ -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?
@@ -81,4 +80,3 @@ impl<'a> DOMParserMethods for &'a DOMParser {
}
}
}

@@ -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
}
@@ -75,4 +74,3 @@ impl<'a> DOMPointMethods for &'a DOMPoint {
self.point.SetW(value);
}
}

@@ -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>,
@@ -12,7 +12,6 @@ use dom::window::Window;
use util::geometry::Au;

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

@@ -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>>,
@@ -55,4 +54,3 @@ impl<'a> DOMRectListMethods for &'a DOMRectList {
self.Item(index)
}
}

@@ -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>,
@@ -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>,
@@ -92,7 +92,6 @@ use std::mem;
use std::sync::Arc;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct Element {
node: Node,
local_name: Atom,
@@ -22,7 +22,6 @@ use std::borrow::ToOwned;
use std::cell::Cell;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct ErrorEvent {
event: Event,
message: DOMRefCell<DOMString>,
@@ -54,7 +54,6 @@ pub enum EventCancelable {
}

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct Event {
reflector_: Reflector,
type_id: EventTypeId,
@@ -130,7 +130,6 @@ pub struct EventListenerEntry {
}

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct EventTarget {
reflector_: Reflector,
type_id: EventTargetTypeId,
@@ -11,7 +11,6 @@ use dom::blob::{Blob, BlobTypeId};
use util::str::DOMString;

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

@@ -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>>
@@ -49,4 +48,3 @@ impl<'a> FileListMethods for &'a FileList {
item
}
}

@@ -67,7 +67,6 @@ pub enum FileReaderReadyState {
}

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct FileReader {
eventtarget: EventTarget,
global: GlobalField,
@@ -30,7 +30,6 @@ pub enum FormDatum {
}

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct FormData {
reflector_: Reflector,
data: DOMRefCell<HashMap<DOMString, Vec<FormDatum>>>,
@@ -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>>,
@@ -20,7 +20,6 @@ use string_cache::Atom;
use util::str::DOMString;

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct HTMLAppletElement {
htmlelement: HTMLElement
}
@@ -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>>,
@@ -14,7 +14,6 @@ use dom::node::{Node, NodeTypeId};
use util::str::DOMString;

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

@@ -19,7 +19,6 @@ use util::str::DOMString;
use url::{Url, UrlParser};

#[dom_struct]
#[derive(HeapSizeOf)]
pub struct HTMLBaseElement {
htmlelement: HTMLElement
}
@@ -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>>,
@@ -183,4 +182,3 @@ impl VirtualMethods for HTMLBodyElement {
}
}
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.