diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2016-09-27 15:30:55 +0200 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2016-10-04 13:45:58 +0200 |
commit | aeb3efda1ff7a386b49ef341d321cc93c3980a6b (patch) | |
tree | 3d81f89ed374f2270ca43b18e3bfc66ffc26e213 /components/script/dom | |
parent | 29c72d15a943386ee2f3130fbe741b0457cb52e5 (diff) | |
download | servo-aeb3efda1ff7a386b49ef341d321cc93c3980a6b.tar.gz servo-aeb3efda1ff7a386b49ef341d321cc93c3980a6b.zip |
Make script build without `impl<T: HeapSizeOf> HeapSizeOf for Arc<T>`.
The removal of this impl is not included in this commit.
CC https://github.com/servo/heapsize/issues/37#issuecomment-249861171
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/document.rs | 17 | ||||
-rw-r--r-- | components/script/dom/element.rs | 1 | ||||
-rw-r--r-- | components/script/dom/htmlimageelement.rs | 1 | ||||
-rw-r--r-- | components/script/dom/htmllinkelement.rs | 1 | ||||
-rw-r--r-- | components/script/dom/htmlmetaelement.rs | 1 | ||||
-rw-r--r-- | components/script/dom/htmlobjectelement.rs | 1 | ||||
-rw-r--r-- | components/script/dom/htmlstyleelement.rs | 1 | ||||
-rw-r--r-- | components/script/dom/workerglobalscope.rs | 1 |
8 files changed, 21 insertions, 3 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 1b91e743a78..31c4267f915 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -146,6 +146,14 @@ enum ParserBlockedByScript { Unblocked, } +#[derive(JSTraceable, HeapSizeOf)] +#[must_root] +struct StylesheetInDocument { + node: JS<Node>, + #[ignore_heap_size_of = "Arc"] + stylesheet: Arc<Stylesheet>, +} + // https://dom.spec.whatwg.org/#document #[dom_struct] pub struct Document { @@ -174,7 +182,7 @@ pub struct Document { anchors: MutNullableHeap<JS<HTMLCollection>>, applets: MutNullableHeap<JS<HTMLCollection>>, /// List of stylesheets associated with nodes in this document. |None| if the list needs to be refreshed. - stylesheets: DOMRefCell<Option<Vec<(JS<Node>, Arc<Stylesheet>)>>>, + stylesheets: DOMRefCell<Option<Vec<StylesheetInDocument>>>, /// Whether the list of stylesheets has changed since the last reflow was triggered. stylesheets_changed_since_reflow: Cell<bool>, ready_state: Cell<DocumentReadyState>, @@ -1891,13 +1899,16 @@ impl Document { node.get_stylesheet() } else { None - }.map(|stylesheet| (JS::from_ref(&*node), stylesheet)) + }.map(|stylesheet| StylesheetInDocument { + node: JS::from_ref(&*node), + stylesheet: stylesheet + }) }) .collect()); }; } self.stylesheets.borrow().as_ref().unwrap().iter() - .map(|&(_, ref stylesheet)| stylesheet.clone()) + .map(|s| s.stylesheet.clone()) .collect() } diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 838da981524..ca0aea778fa 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -109,6 +109,7 @@ pub struct Element { prefix: Option<DOMString>, attrs: DOMRefCell<Vec<JS<Attr>>>, id_attribute: DOMRefCell<Option<Atom>>, + #[ignore_heap_size_of = "Arc"] style_attribute: DOMRefCell<Option<Arc<PropertyDeclarationBlock>>>, attr_list: MutNullableHeap<JS<NamedNodeMap>>, class_list: MutNullableHeap<JS<DOMTokenList>>, diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index 9236c75c699..24e28e7639b 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -47,6 +47,7 @@ struct ImageRequest { state: State, parsed_url: Option<Url>, source_url: Option<DOMString>, + #[ignore_heap_size_of = "Arc"] image: Option<Arc<Image>>, metadata: Option<ImageMetadata>, } diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs index 7c6cabd345e..74e21ac9668 100644 --- a/components/script/dom/htmllinkelement.rs +++ b/components/script/dom/htmllinkelement.rs @@ -52,6 +52,7 @@ no_jsmanaged_fields!(Stylesheet); pub struct HTMLLinkElement { htmlelement: HTMLElement, rel_list: MutNullableHeap<JS<DOMTokenList>>, + #[ignore_heap_size_of = "Arc"] stylesheet: DOMRefCell<Option<Arc<Stylesheet>>>, /// https://html.spec.whatwg.org/multipage/#a-style-sheet-that-is-blocking-scripts diff --git a/components/script/dom/htmlmetaelement.rs b/components/script/dom/htmlmetaelement.rs index 34e4dbdfefe..1b057783908 100644 --- a/components/script/dom/htmlmetaelement.rs +++ b/components/script/dom/htmlmetaelement.rs @@ -27,6 +27,7 @@ use style::viewport::ViewportRule; #[dom_struct] pub struct HTMLMetaElement { htmlelement: HTMLElement, + #[ignore_heap_size_of = "Arc"] stylesheet: DOMRefCell<Option<Arc<Stylesheet>>>, } diff --git a/components/script/dom/htmlobjectelement.rs b/components/script/dom/htmlobjectelement.rs index a54cd5c1eb9..697abfe6e67 100644 --- a/components/script/dom/htmlobjectelement.rs +++ b/components/script/dom/htmlobjectelement.rs @@ -24,6 +24,7 @@ use string_cache::Atom; #[dom_struct] pub struct HTMLObjectElement { htmlelement: HTMLElement, + #[ignore_heap_size_of = "Arc"] image: DOMRefCell<Option<Arc<Image>>>, } diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs index 5e0706e5d65..4db70eb1c8f 100644 --- a/components/script/dom/htmlstyleelement.rs +++ b/components/script/dom/htmlstyleelement.rs @@ -24,6 +24,7 @@ use style::stylesheets::{Stylesheet, Origin}; #[dom_struct] pub struct HTMLStyleElement { htmlelement: HTMLElement, + #[ignore_heap_size_of = "Arc"] stylesheet: DOMRefCell<Option<Arc<Stylesheet>>>, } diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs index 9c7768ce5e7..9b976c5a31d 100644 --- a/components/script/dom/workerglobalscope.rs +++ b/components/script/dom/workerglobalscope.rs @@ -83,6 +83,7 @@ pub struct WorkerGlobalScope { worker_id: WorkerId, pipeline_id: PipelineId, worker_url: Url, + #[ignore_heap_size_of = "Arc"] closing: Option<Arc<AtomicBool>>, #[ignore_heap_size_of = "Defined in js"] runtime: Runtime, |