diff options
author | Ruud van Asseldonk <dev@veniogames.com> | 2016-02-03 20:06:39 +0100 |
---|---|---|
committer | Ruud van Asseldonk <dev@veniogames.com> | 2016-02-03 20:06:39 +0100 |
commit | 95be0b9a25c288ef8fa0f340d0be6a241e9e1ecc (patch) | |
tree | c769ead9fb3fc507941ebf5e1e98f582bf8c9948 | |
parent | b1fffcd85de45b0c7b917beef2718621a323e5cf (diff) | |
download | servo-95be0b9a25c288ef8fa0f340d0be6a241e9e1ecc.tar.gz servo-95be0b9a25c288ef8fa0f340d0be6a241e9e1ecc.zip |
Upgrade to new Hasher API
-rw-r--r-- | components/gfx/font_context.rs | 7 | ||||
-rw-r--r-- | components/gfx/lib.rs | 1 | ||||
-rw-r--r-- | components/layout/context.rs | 4 | ||||
-rw-r--r-- | components/layout/layout_thread.rs | 8 | ||||
-rw-r--r-- | components/layout/lib.rs | 1 | ||||
-rw-r--r-- | components/script/dom/eventtarget.rs | 4 | ||||
-rw-r--r-- | components/script/lib.rs | 1 | ||||
-rw-r--r-- | components/util/cache.rs | 7 | ||||
-rw-r--r-- | components/util/lib.rs | 1 |
9 files changed, 14 insertions, 20 deletions
diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs index 1011d40112b..173f1815ed2 100644 --- a/components/gfx/font_context.rs +++ b/components/gfx/font_context.rs @@ -19,9 +19,8 @@ use platform::font_template::FontTemplateData; use smallvec::SmallVec; use std::cell::RefCell; use std::collections::HashMap; -use std::collections::hash_state::DefaultState; use std::default::Default; -use std::hash::{Hash, Hasher}; +use std::hash::{BuildHasherDefault, Hash, Hasher}; use std::rc::Rc; use std::sync::Arc; use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; @@ -86,7 +85,7 @@ pub struct FontContext { paint_font_cache: Vec<PaintFontCacheEntry>, layout_font_group_cache: - HashMap<LayoutFontGroupCacheKey, Rc<FontGroup>, DefaultState<FnvHasher>>, + HashMap<LayoutFontGroupCacheKey, Rc<FontGroup>, BuildHasherDefault<FnvHasher>>, epoch: usize, } @@ -100,7 +99,7 @@ impl FontContext { layout_font_cache: vec!(), fallback_font_cache: vec!(), paint_font_cache: vec!(), - layout_font_group_cache: HashMap::with_hash_state(Default::default()), + layout_font_group_cache: HashMap::with_hasher(Default::default()), epoch: 0, } } diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs index 871e210f541..dbf255a56b4 100644 --- a/components/gfx/lib.rs +++ b/components/gfx/lib.rs @@ -10,7 +10,6 @@ #![feature(box_syntax)] #![feature(custom_attribute)] #![feature(custom_derive)] -#![feature(hashmap_hasher)] #![feature(mpsc_select)] #![feature(plugin)] #![feature(str_char)] diff --git a/components/layout/context.rs b/components/layout/context.rs index 53bb036d09c..ec2be6f2141 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -20,7 +20,7 @@ use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread, ImageResp use net_traits::image_cache_thread::{ImageOrMetadataAvailable, UsePlaceholder}; use std::cell::{RefCell, RefMut}; use std::collections::HashMap; -use std::collections::hash_state::DefaultState; +use std::hash::BuildHasherDefault; use std::rc::Rc; use std::sync::mpsc::Sender; use std::sync::{Arc, Mutex}; @@ -95,7 +95,7 @@ pub struct SharedLayoutContext { pub canvas_layers_sender: Mutex<Sender<(LayerId, IpcSender<CanvasMsg>)>>, /// The visible rects for each layer, as reported to us by the compositor. - pub visible_rects: Arc<HashMap<LayerId, Rect<Au>, DefaultState<FnvHasher>>>, + pub visible_rects: Arc<HashMap<LayerId, Rect<Au>, BuildHasherDefault<FnvHasher>>>, } pub struct LayoutContext<'a> { diff --git a/components/layout/layout_thread.rs b/components/layout/layout_thread.rs index 206bfe4c82d..49875094b4f 100644 --- a/components/layout/layout_thread.rs +++ b/components/layout/layout_thread.rs @@ -54,7 +54,7 @@ use serde_json; use std::borrow::ToOwned; use std::cell::RefCell; use std::collections::HashMap; -use std::collections::hash_state::DefaultState; +use std::hash::BuildHasherDefault; use std::ops::{Deref, DerefMut}; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::mpsc::{channel, Sender, Receiver}; @@ -195,7 +195,7 @@ pub struct LayoutThread { /// The position and size of the visible rect for each layer. We do not build display lists /// for any areas more than `DISPLAY_PORT_SIZE_FACTOR` screens away from this area. - visible_rects: Arc<HashMap<LayerId, Rect<Au>, DefaultState<FnvHasher>>>, + visible_rects: Arc<HashMap<LayerId, Rect<Au>, BuildHasherDefault<FnvHasher>>>, /// The list of currently-running animations. running_animations: Arc<RwLock<HashMap<OpaqueNode, Vec<Animation>>>>, @@ -430,7 +430,7 @@ impl LayoutThread { new_animations_receiver: new_animations_receiver, outstanding_web_fonts: outstanding_web_fonts_counter, root_flow: None, - visible_rects: Arc::new(HashMap::with_hash_state(Default::default())), + visible_rects: Arc::new(HashMap::with_hasher(Default::default())), running_animations: Arc::new(RwLock::new(HashMap::new())), expired_animations: Arc::new(RwLock::new(HashMap::new())), epoch: Epoch(0), @@ -1099,7 +1099,7 @@ impl LayoutThread { // layers have moved more than `DISPLAY_PORT_THRESHOLD_SIZE_FACTOR` away from their last // positions. let mut must_regenerate_display_lists = false; - let mut old_visible_rects = HashMap::with_hash_state(Default::default()); + let mut old_visible_rects = HashMap::with_hasher(Default::default()); let inflation_amount = Size2D::new(self.viewport_size.width * DISPLAY_PORT_THRESHOLD_SIZE_FACTOR, self.viewport_size.height * DISPLAY_PORT_THRESHOLD_SIZE_FACTOR); diff --git a/components/layout/lib.rs b/components/layout/lib.rs index cf0d2f18ea1..4f46b0fe134 100644 --- a/components/layout/lib.rs +++ b/components/layout/lib.rs @@ -6,7 +6,6 @@ #![feature(box_syntax)] #![feature(cell_extras)] #![feature(custom_derive)] -#![feature(hashmap_hasher)] #![feature(mpsc_select)] #![feature(nonzero)] #![feature(plugin)] diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs index 48682ec2211..1ac0313d3c5 100644 --- a/components/script/dom/eventtarget.rs +++ b/components/script/dom/eventtarget.rs @@ -28,9 +28,9 @@ use js::rust::{AutoObjectVectorWrapper, CompileOptionsWrapper}; use libc::{c_char, size_t}; use std::collections::HashMap; use std::collections::hash_map::Entry::{Occupied, Vacant}; -use std::collections::hash_state::DefaultState; use std::default::Default; use std::ffi::CString; +use std::hash::BuildHasherDefault; use std::rc::Rc; use std::{intrinsics, ptr}; use string_cache::Atom; @@ -161,7 +161,7 @@ pub struct EventListenerEntry { #[dom_struct] pub struct EventTarget { reflector_: Reflector, - handlers: DOMRefCell<HashMap<Atom, Vec<EventListenerEntry>, DefaultState<FnvHasher>>>, + handlers: DOMRefCell<HashMap<Atom, Vec<EventListenerEntry>, BuildHasherDefault<FnvHasher>>>, } impl EventTarget { diff --git a/components/script/lib.rs b/components/script/lib.rs index 6365c03c5b7..d9bdd742559 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -12,7 +12,6 @@ #![feature(custom_attribute)] #![feature(custom_derive)] #![feature(fnbox)] -#![feature(hashmap_hasher)] #![feature(mpsc_select)] #![feature(nonzero)] #![feature(on_unimplemented)] diff --git a/components/util/cache.rs b/components/util/cache.rs index deb87405d1f..7b8d7bfb1a0 100644 --- a/components/util/cache.rs +++ b/components/util/cache.rs @@ -6,9 +6,8 @@ use rand; use rand::Rng; use std::collections::HashMap; use std::collections::hash_map::Entry::{Occupied, Vacant}; -use std::collections::hash_state::DefaultState; use std::default::Default; -use std::hash::{Hash, Hasher, SipHasher}; +use std::hash::{BuildHasherDefault, Hash, Hasher, SipHasher}; use std::slice::Iter; @@ -17,7 +16,7 @@ pub struct HashCache<K, V> where K: Clone + PartialEq + Eq + Hash, V: Clone, { - entries: HashMap<K, V, DefaultState<SipHasher>>, + entries: HashMap<K, V, BuildHasherDefault<SipHasher>>, } impl<K, V> HashCache<K, V> @@ -26,7 +25,7 @@ impl<K, V> HashCache<K, V> { pub fn new() -> HashCache<K, V> { HashCache { - entries: HashMap::with_hash_state(<DefaultState<SipHasher> as Default>::default()), + entries: HashMap::with_hasher(Default::default()), } } diff --git a/components/util/lib.rs b/components/util/lib.rs index 660945d4c1a..01e46727238 100644 --- a/components/util/lib.rs +++ b/components/util/lib.rs @@ -8,7 +8,6 @@ #![feature(custom_derive)] #![cfg_attr(feature = "non-geckolib", feature(decode_utf16))] #![feature(fnbox)] -#![feature(hashmap_hasher)] #![feature(heap_api)] #![feature(oom)] #![feature(optin_builtin_traits)] |