mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
reduce node.unique_id size
fix sizeof unittest update Cargo.lock
This commit is contained in:
parent
2be0cb7827
commit
4bf21ab15e
9 changed files with 35 additions and 27 deletions
|
@ -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<A: JSTraceable, B: JSTraceable> 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<T>);
|
||||
|
|
|
@ -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<String>,
|
||||
unique_id: DOMRefCell<Option<Box<Uuid>>>,
|
||||
}
|
||||
|
||||
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),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
11
components/servo/Cargo.lock
generated
11
components/servo/Cargo.lock
generated
|
@ -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)",
|
||||
]
|
||||
|
||||
|
|
|
@ -56,3 +56,4 @@ string_cache = "0.1"
|
|||
lazy_static = "0.1"
|
||||
getopts = "0.2.11"
|
||||
hyper = "0.6"
|
||||
uuid = "0.1.17"
|
||||
|
|
|
@ -49,6 +49,7 @@ extern crate serde;
|
|||
extern crate smallvec;
|
||||
extern crate string_cache;
|
||||
extern crate url;
|
||||
extern crate uuid;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
11
ports/cef/Cargo.lock
generated
11
ports/cef/Cargo.lock
generated
|
@ -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)",
|
||||
]
|
||||
|
||||
|
|
7
ports/gonk/Cargo.lock
generated
7
ports/gonk/Cargo.lock
generated
|
@ -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)",
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue