mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Temporarily use OrderMap on Gecko.
This will allow us to discard std hash map as a source of crashes.
This commit is contained in:
parent
a2c2d34753
commit
4d9ce6b880
3 changed files with 30 additions and 14 deletions
|
@ -512,19 +512,12 @@ impl<V: 'static> MaybeCaseInsensitiveHashMap<Atom, V> {
|
|||
MaybeCaseInsensitiveHashMap(PrecomputedHashMap::default())
|
||||
}
|
||||
|
||||
/// HashMap::entry
|
||||
pub fn entry(&mut self, mut key: Atom, quirks_mode: QuirksMode) -> hash_map::Entry<Atom, V> {
|
||||
if quirks_mode == QuirksMode::Quirks {
|
||||
key = key.to_ascii_lowercase()
|
||||
}
|
||||
self.0.entry(key)
|
||||
}
|
||||
|
||||
/// HashMap::try_entry
|
||||
#[cfg(not(feature = "gecko"))]
|
||||
pub fn try_entry(
|
||||
&mut self,
|
||||
mut key: Atom,
|
||||
quirks_mode: QuirksMode
|
||||
quirks_mode: QuirksMode,
|
||||
) -> Result<hash_map::Entry<Atom, V>, FailedAllocationError> {
|
||||
if quirks_mode == QuirksMode::Quirks {
|
||||
key = key.to_ascii_lowercase()
|
||||
|
@ -532,6 +525,22 @@ impl<V: 'static> MaybeCaseInsensitiveHashMap<Atom, V> {
|
|||
self.0.try_entry(key)
|
||||
}
|
||||
|
||||
/// HashMap::try_entry
|
||||
///
|
||||
/// FIXME(emilio): Remove the extra Entry parameter and unify when ordermap
|
||||
/// 0.4 is released.
|
||||
#[cfg(feature = "gecko")]
|
||||
pub fn try_entry(
|
||||
&mut self,
|
||||
mut key: Atom,
|
||||
quirks_mode: QuirksMode,
|
||||
) -> Result<hash_map::Entry<Atom, V, BuildHasherDefault<PrecomputedHasher>>, FailedAllocationError> {
|
||||
if quirks_mode == QuirksMode::Quirks {
|
||||
key = key.to_ascii_lowercase()
|
||||
}
|
||||
self.0.try_entry(key)
|
||||
}
|
||||
|
||||
/// HashMap::iter
|
||||
pub fn iter(&self) -> hash_map::Iter<Atom, V> {
|
||||
self.0.iter()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue