style: Shrink maps if needed after stylist rebuilds

Hashbrown grows a lot sometimes making us waste a lot of memory. Shrink
some of these maps after CascadeData rebuild / stylesheet collection
invalidation.

Differential Revision: https://phabricator.services.mozilla.com/D134716
This commit is contained in:
Emilio Cobos Álvarez 2023-06-06 23:27:20 +02:00 committed by Oriol Brufau
parent f9610e5898
commit fcc55f2156
6 changed files with 122 additions and 17 deletions

View file

@ -170,9 +170,14 @@ impl<T> PerPseudoElementMap<T> {
}
/// Get an iterator for the entries.
pub fn iter(&self) -> ::std::slice::Iter<Option<T>> {
pub fn iter(&self) -> std::slice::Iter<Option<T>> {
self.entries.iter()
}
/// Get a mutable iterator for the entries.
pub fn iter_mut(&mut self) -> std::slice::IterMut<Option<T>> {
self.entries.iter_mut()
}
}
/// Values for the :dir() pseudo class