mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Upgrade to new Hasher API
This commit is contained in:
parent
b1fffcd85d
commit
95be0b9a25
9 changed files with 14 additions and 20 deletions
|
@ -19,9 +19,8 @@ use platform::font_template::FontTemplateData;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::collections::hash_state::DefaultState;
|
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{BuildHasherDefault, Hash, Hasher};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
|
use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
|
||||||
|
@ -86,7 +85,7 @@ pub struct FontContext {
|
||||||
paint_font_cache: Vec<PaintFontCacheEntry>,
|
paint_font_cache: Vec<PaintFontCacheEntry>,
|
||||||
|
|
||||||
layout_font_group_cache:
|
layout_font_group_cache:
|
||||||
HashMap<LayoutFontGroupCacheKey, Rc<FontGroup>, DefaultState<FnvHasher>>,
|
HashMap<LayoutFontGroupCacheKey, Rc<FontGroup>, BuildHasherDefault<FnvHasher>>,
|
||||||
|
|
||||||
epoch: usize,
|
epoch: usize,
|
||||||
}
|
}
|
||||||
|
@ -100,7 +99,7 @@ impl FontContext {
|
||||||
layout_font_cache: vec!(),
|
layout_font_cache: vec!(),
|
||||||
fallback_font_cache: vec!(),
|
fallback_font_cache: vec!(),
|
||||||
paint_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,
|
epoch: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(custom_attribute)]
|
#![feature(custom_attribute)]
|
||||||
#![feature(custom_derive)]
|
#![feature(custom_derive)]
|
||||||
#![feature(hashmap_hasher)]
|
|
||||||
#![feature(mpsc_select)]
|
#![feature(mpsc_select)]
|
||||||
#![feature(plugin)]
|
#![feature(plugin)]
|
||||||
#![feature(str_char)]
|
#![feature(str_char)]
|
||||||
|
|
|
@ -20,7 +20,7 @@ use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread, ImageResp
|
||||||
use net_traits::image_cache_thread::{ImageOrMetadataAvailable, UsePlaceholder};
|
use net_traits::image_cache_thread::{ImageOrMetadataAvailable, UsePlaceholder};
|
||||||
use std::cell::{RefCell, RefMut};
|
use std::cell::{RefCell, RefMut};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::collections::hash_state::DefaultState;
|
use std::hash::BuildHasherDefault;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::mpsc::Sender;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
@ -95,7 +95,7 @@ pub struct SharedLayoutContext {
|
||||||
pub canvas_layers_sender: Mutex<Sender<(LayerId, IpcSender<CanvasMsg>)>>,
|
pub canvas_layers_sender: Mutex<Sender<(LayerId, IpcSender<CanvasMsg>)>>,
|
||||||
|
|
||||||
/// The visible rects for each layer, as reported to us by the compositor.
|
/// 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> {
|
pub struct LayoutContext<'a> {
|
||||||
|
|
|
@ -54,7 +54,7 @@ use serde_json;
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::collections::hash_state::DefaultState;
|
use std::hash::BuildHasherDefault;
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
use std::sync::mpsc::{channel, Sender, Receiver};
|
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
|
/// 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.
|
/// 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.
|
/// The list of currently-running animations.
|
||||||
running_animations: Arc<RwLock<HashMap<OpaqueNode, Vec<Animation>>>>,
|
running_animations: Arc<RwLock<HashMap<OpaqueNode, Vec<Animation>>>>,
|
||||||
|
@ -430,7 +430,7 @@ impl LayoutThread {
|
||||||
new_animations_receiver: new_animations_receiver,
|
new_animations_receiver: new_animations_receiver,
|
||||||
outstanding_web_fonts: outstanding_web_fonts_counter,
|
outstanding_web_fonts: outstanding_web_fonts_counter,
|
||||||
root_flow: None,
|
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())),
|
running_animations: Arc::new(RwLock::new(HashMap::new())),
|
||||||
expired_animations: Arc::new(RwLock::new(HashMap::new())),
|
expired_animations: Arc::new(RwLock::new(HashMap::new())),
|
||||||
epoch: Epoch(0),
|
epoch: Epoch(0),
|
||||||
|
@ -1099,7 +1099,7 @@ impl LayoutThread {
|
||||||
// layers have moved more than `DISPLAY_PORT_THRESHOLD_SIZE_FACTOR` away from their last
|
// layers have moved more than `DISPLAY_PORT_THRESHOLD_SIZE_FACTOR` away from their last
|
||||||
// positions.
|
// positions.
|
||||||
let mut must_regenerate_display_lists = false;
|
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 =
|
let inflation_amount =
|
||||||
Size2D::new(self.viewport_size.width * DISPLAY_PORT_THRESHOLD_SIZE_FACTOR,
|
Size2D::new(self.viewport_size.width * DISPLAY_PORT_THRESHOLD_SIZE_FACTOR,
|
||||||
self.viewport_size.height * DISPLAY_PORT_THRESHOLD_SIZE_FACTOR);
|
self.viewport_size.height * DISPLAY_PORT_THRESHOLD_SIZE_FACTOR);
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(cell_extras)]
|
#![feature(cell_extras)]
|
||||||
#![feature(custom_derive)]
|
#![feature(custom_derive)]
|
||||||
#![feature(hashmap_hasher)]
|
|
||||||
#![feature(mpsc_select)]
|
#![feature(mpsc_select)]
|
||||||
#![feature(nonzero)]
|
#![feature(nonzero)]
|
||||||
#![feature(plugin)]
|
#![feature(plugin)]
|
||||||
|
|
|
@ -28,9 +28,9 @@ use js::rust::{AutoObjectVectorWrapper, CompileOptionsWrapper};
|
||||||
use libc::{c_char, size_t};
|
use libc::{c_char, size_t};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::collections::hash_map::Entry::{Occupied, Vacant};
|
use std::collections::hash_map::Entry::{Occupied, Vacant};
|
||||||
use std::collections::hash_state::DefaultState;
|
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
|
use std::hash::BuildHasherDefault;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::{intrinsics, ptr};
|
use std::{intrinsics, ptr};
|
||||||
use string_cache::Atom;
|
use string_cache::Atom;
|
||||||
|
@ -161,7 +161,7 @@ pub struct EventListenerEntry {
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct EventTarget {
|
pub struct EventTarget {
|
||||||
reflector_: Reflector,
|
reflector_: Reflector,
|
||||||
handlers: DOMRefCell<HashMap<Atom, Vec<EventListenerEntry>, DefaultState<FnvHasher>>>,
|
handlers: DOMRefCell<HashMap<Atom, Vec<EventListenerEntry>, BuildHasherDefault<FnvHasher>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EventTarget {
|
impl EventTarget {
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#![feature(custom_attribute)]
|
#![feature(custom_attribute)]
|
||||||
#![feature(custom_derive)]
|
#![feature(custom_derive)]
|
||||||
#![feature(fnbox)]
|
#![feature(fnbox)]
|
||||||
#![feature(hashmap_hasher)]
|
|
||||||
#![feature(mpsc_select)]
|
#![feature(mpsc_select)]
|
||||||
#![feature(nonzero)]
|
#![feature(nonzero)]
|
||||||
#![feature(on_unimplemented)]
|
#![feature(on_unimplemented)]
|
||||||
|
|
|
@ -6,9 +6,8 @@ use rand;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::collections::hash_map::Entry::{Occupied, Vacant};
|
use std::collections::hash_map::Entry::{Occupied, Vacant};
|
||||||
use std::collections::hash_state::DefaultState;
|
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::hash::{Hash, Hasher, SipHasher};
|
use std::hash::{BuildHasherDefault, Hash, Hasher, SipHasher};
|
||||||
use std::slice::Iter;
|
use std::slice::Iter;
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +16,7 @@ pub struct HashCache<K, V>
|
||||||
where K: Clone + PartialEq + Eq + Hash,
|
where K: Clone + PartialEq + Eq + Hash,
|
||||||
V: Clone,
|
V: Clone,
|
||||||
{
|
{
|
||||||
entries: HashMap<K, V, DefaultState<SipHasher>>,
|
entries: HashMap<K, V, BuildHasherDefault<SipHasher>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<K, V> HashCache<K, V>
|
impl<K, V> HashCache<K, V>
|
||||||
|
@ -26,7 +25,7 @@ impl<K, V> HashCache<K, V>
|
||||||
{
|
{
|
||||||
pub fn new() -> HashCache<K, V> {
|
pub fn new() -> HashCache<K, V> {
|
||||||
HashCache {
|
HashCache {
|
||||||
entries: HashMap::with_hash_state(<DefaultState<SipHasher> as Default>::default()),
|
entries: HashMap::with_hasher(Default::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#![feature(custom_derive)]
|
#![feature(custom_derive)]
|
||||||
#![cfg_attr(feature = "non-geckolib", feature(decode_utf16))]
|
#![cfg_attr(feature = "non-geckolib", feature(decode_utf16))]
|
||||||
#![feature(fnbox)]
|
#![feature(fnbox)]
|
||||||
#![feature(hashmap_hasher)]
|
|
||||||
#![feature(heap_api)]
|
#![feature(heap_api)]
|
||||||
#![feature(oom)]
|
#![feature(oom)]
|
||||||
#![feature(optin_builtin_traits)]
|
#![feature(optin_builtin_traits)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue