diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 72e52c4962c..af5c198a163 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -88,6 +88,7 @@ use style::restyle_hints::ElementSnapshot; use style::values::specified::Length; use url::Url; use util::str::{DOMString, LengthOrPercentageOrAuto}; +use uuid::Uuid; /// A trait to allow tracing (only) DOM objects. @@ -252,7 +253,7 @@ impl JSTraceable for (A, B) { } -no_jsmanaged_fields!(bool, f32, f64, String, Url, AtomicBool); +no_jsmanaged_fields!(bool, f32, f64, String, Url, AtomicBool, Uuid); no_jsmanaged_fields!(usize, u8, u16, u32, u64); no_jsmanaged_fields!(isize, i8, i16, i32, i64); no_jsmanaged_fields!(Sender); diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 9c296ac4385..f7b694300af 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -67,7 +67,7 @@ use string_cache::{Atom, Namespace, QualName}; use style::properties::ComputedValues; use util::str::DOMString; use util::task_state; -use uuid; +use uuid::Uuid; // // The basic Node structure @@ -115,7 +115,7 @@ pub struct Node { /// node is finalized. layout_data: LayoutDataRef, - unique_id: DOMRefCell, + unique_id: DOMRefCell>>, } impl PartialEq for Node { @@ -793,11 +793,11 @@ impl Node { } pub fn get_unique_id(&self) -> String { - if self.unique_id.borrow().is_empty() { + if self.unique_id.borrow().is_none() { let mut unique_id = self.unique_id.borrow_mut(); - *unique_id = uuid::Uuid::new_v4().to_simple_string(); + *unique_id = Some(Box::new(Uuid::new_v4())); } - self.unique_id.borrow().clone() + self.unique_id.borrow().as_ref().unwrap().to_simple_string() } pub fn summarize(&self) -> NodeInfo { @@ -1310,7 +1310,7 @@ impl Node { layout_data: LayoutDataRef::new(), - unique_id: DOMRefCell::new(String::new()), + unique_id: DOMRefCell::new(None), } } diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index f0d37d70faa..598fcd0bff8 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -1192,7 +1192,7 @@ dependencies = [ "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1542,7 +1542,7 @@ dependencies = [ "unicase 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "websocket 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "xml5ever 0.1.0 (git+https://github.com/Ygg01/xml5ever)", ] @@ -1925,6 +1925,7 @@ dependencies = [ "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1940,7 +1941,7 @@ dependencies = [ [[package]] name = "uuid" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1994,7 +1995,7 @@ dependencies = [ "log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", - "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2011,7 +2012,7 @@ dependencies = [ "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "webdriver 0.3.1 (git+https://github.com/jgraham/webdriver-rust.git)", ] diff --git a/components/util/Cargo.toml b/components/util/Cargo.toml index 480324f0578..bdbb7ec3443 100644 --- a/components/util/Cargo.toml +++ b/components/util/Cargo.toml @@ -56,3 +56,4 @@ string_cache = "0.1" lazy_static = "0.1" getopts = "0.2.11" hyper = "0.6" +uuid = "0.1.17" diff --git a/components/util/lib.rs b/components/util/lib.rs index abcb686723a..595a6b54e20 100644 --- a/components/util/lib.rs +++ b/components/util/lib.rs @@ -49,6 +49,7 @@ extern crate serde; extern crate smallvec; extern crate string_cache; extern crate url; +extern crate uuid; use std::sync::Arc; diff --git a/components/util/mem.rs b/components/util/mem.rs index 36c2294a876..968282eafda 100644 --- a/components/util/mem.rs +++ b/components/util/mem.rs @@ -39,6 +39,7 @@ use str::{DOMString, LengthOrPercentageOrAuto}; use string_cache::atom::Atom; use string_cache::namespace::{QualName, Namespace}; use url; +use uuid::Uuid; extern { // Get the size of a heap block. @@ -425,3 +426,4 @@ known_heap_size!(0, JSVal, PagePx, ViewportPx, DevicePixel, QuirksMode, OsRng, R known_heap_size!(0, TokenSerializationType, LengthOrPercentageOrAuto); known_heap_size!(0, ElementState, Combinator, PseudoElement, str); +known_heap_size!(0, Uuid); diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index 0fb84a80b8c..4d5970755c4 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -1144,7 +1144,7 @@ dependencies = [ "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1468,7 +1468,7 @@ dependencies = [ "unicase 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "websocket 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "xml5ever 0.1.0 (git+https://github.com/Ygg01/xml5ever)", ] @@ -1860,11 +1860,12 @@ dependencies = [ "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uuid" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1918,7 +1919,7 @@ dependencies = [ "log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", - "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1935,7 +1936,7 @@ dependencies = [ "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "webdriver 0.3.1 (git+https://github.com/jgraham/webdriver-rust.git)", ] diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock index 531f2b92268..402e376b86e 100644 --- a/ports/gonk/Cargo.lock +++ b/ports/gonk/Cargo.lock @@ -1124,7 +1124,7 @@ dependencies = [ "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1448,7 +1448,7 @@ dependencies = [ "unicase 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "websocket 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "xml5ever 0.1.0 (git+https://github.com/Ygg01/xml5ever)", ] @@ -1838,11 +1838,12 @@ dependencies = [ "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uuid" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/tests/unit/script/size_of.rs b/tests/unit/script/size_of.rs index 16154bdcc91..f760d610862 100644 --- a/tests/unit/script/size_of.rs +++ b/tests/unit/script/size_of.rs @@ -38,10 +38,10 @@ macro_rules! sizeof_checker ( // Update the sizes here sizeof_checker!(size_event_target, EventTarget, 40); -sizeof_checker!(size_node, Node, 176); -sizeof_checker!(size_element, Element, 320); -sizeof_checker!(size_htmlelement, HTMLElement, 336); -sizeof_checker!(size_div, HTMLDivElement, 336); -sizeof_checker!(size_span, HTMLSpanElement, 336); -sizeof_checker!(size_text, Text, 208); -sizeof_checker!(size_characterdata, CharacterData, 208); +sizeof_checker!(size_node, Node, 160); +sizeof_checker!(size_element, Element, 304); +sizeof_checker!(size_htmlelement, HTMLElement, 320); +sizeof_checker!(size_div, HTMLDivElement, 320); +sizeof_checker!(size_span, HTMLSpanElement, 320); +sizeof_checker!(size_text, Text, 192); +sizeof_checker!(size_characterdata, CharacterData, 192);