diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2016-11-02 18:46:15 +0100 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2016-11-03 01:10:32 +0100 |
commit | 5bb4c6c8846e71c7553cb625464b06ca0fedba08 (patch) | |
tree | c1dd794a9c246d668ccefc4320b6d1871c004231 /components/script | |
parent | b640a83725a2b2a6c93be44107e49f4e99e7d59f (diff) | |
download | servo-5bb4c6c8846e71c7553cb625464b06ca0fedba08.tar.gz servo-5bb4c6c8846e71c7553cb625464b06ca0fedba08.zip |
Use heapsize_derive instead of heapsize_plugin
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/Cargo.toml | 2 | ||||
-rw-r--r-- | components/script/dom/bindings/js.rs | 6 | ||||
-rw-r--r-- | components/script/dom/bindings/num.rs | 7 | ||||
-rw-r--r-- | components/script/dom/validitystate.rs | 2 | ||||
-rw-r--r-- | components/script/lib.rs | 3 |
5 files changed, 17 insertions, 3 deletions
diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index f8f0b8f0d4b..b65b1da3eb4 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -35,7 +35,7 @@ euclid = "0.10.1" fnv = "1.0" gfx_traits = {path = "../gfx_traits"} heapsize = "0.3.6" -heapsize_plugin = "0.1.2" +heapsize_derive = "0.1" html5ever = {version = "0.5.1", features = ["heap_size", "unstable"]} hyper = "0.9.9" hyper_serde = "0.1.4" diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs index 779cb62d634..11aed4be9af 100644 --- a/components/script/dom/bindings/js.rs +++ b/components/script/dom/bindings/js.rs @@ -625,6 +625,12 @@ impl<T: Reflectable> Deref for Root<T> { } } +impl<T: Reflectable + HeapSizeOf> HeapSizeOf for Root<T> { + fn heap_size_of_children(&self) -> usize { + (**self).heap_size_of_children() + } +} + impl<T: Reflectable> PartialEq for Root<T> { fn eq(&self, other: &Self) -> bool { self.ptr == other.ptr diff --git a/components/script/dom/bindings/num.rs b/components/script/dom/bindings/num.rs index fde24d08421..03b0c743f9f 100644 --- a/components/script/dom/bindings/num.rs +++ b/components/script/dom/bindings/num.rs @@ -4,6 +4,7 @@ //! The `Finite<T>` struct. +use heapsize::HeapSizeOf; use num_traits::Float; use std::ops::Deref; @@ -38,3 +39,9 @@ impl<T: Float> Deref for Finite<T> { value } } + +impl<T: Float + HeapSizeOf> HeapSizeOf for Finite<T> { + fn heap_size_of_children(&self) -> usize { + (**self).heap_size_of_children() + } +} diff --git a/components/script/dom/validitystate.rs b/components/script/dom/validitystate.rs index 938320b7254..21740b16bfc 100644 --- a/components/script/dom/validitystate.rs +++ b/components/script/dom/validitystate.rs @@ -11,7 +11,7 @@ use dom::window::Window; // https://html.spec.whatwg.org/multipage/#validity-states #[derive_JSTraceable] -#[derive_HeapSizeOf] +#[derive(HeapSizeOf)] pub enum ValidityStatus { ValueMissing, TypeMismatch, diff --git a/components/script/lib.rs b/components/script/lib.rs index f2227fc363a..96e9cb29731 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -14,6 +14,7 @@ #![feature(on_unimplemented)] #![feature(optin_builtin_traits)] #![feature(plugin)] +#![feature(proc_macro)] #![feature(slice_patterns)] #![feature(stmt_expr_attributes)] #![feature(try_from)] @@ -24,7 +25,6 @@ #![doc = "The script crate contains all matters DOM."] -#![plugin(heapsize_plugin)] #![plugin(phf_macros)] #![plugin(plugins)] @@ -46,6 +46,7 @@ extern crate euclid; extern crate fnv; extern crate gfx_traits; extern crate heapsize; +#[macro_use] extern crate heapsize_derive; extern crate html5ever; extern crate hyper; extern crate hyper_serde; |