mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Refactor the author sheet cache to keep alive the relevant StylesheetContents
This prevents incorrectly reusing cached results when the contents go away and new contents are allocated with the same address. Note that these keep alive transitively everything else under them, so all other medialist keys don't need this. By making this a proper hashmap it should also improve cache lookup times if the cache grows too big. Differential Revision: https://phabricator.services.mozilla.com/D115202
This commit is contained in:
parent
9c32836913
commit
1ddd3b09c2
3 changed files with 126 additions and 55 deletions
|
@ -248,6 +248,14 @@ impl<T> Arc<T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Like from_raw, but returns an addrefed arc instead.
|
||||
#[inline]
|
||||
pub unsafe fn from_raw_addrefed(ptr: *const T) -> Self {
|
||||
let arc = Self::from_raw(ptr);
|
||||
mem::forget(arc.clone());
|
||||
arc
|
||||
}
|
||||
|
||||
/// Create a new static Arc<T> (one that won't reference count the object)
|
||||
/// and place it in the allocation provided by the specified `alloc`
|
||||
/// function.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue