mirror of
https://github.com/servo/servo.git
synced 2025-08-12 17:05:33 +01:00
style: Shutdown Servo's thread-pool in leak-checking builds, leak the atom table elsewhere.
Differential Revision: https://phabricator.services.mozilla.com/D44217
This commit is contained in:
parent
d54d1bcb17
commit
9eaadc6860
4 changed files with 70 additions and 18 deletions
|
@ -82,7 +82,7 @@ use servo_arc::Arc;
|
|||
use smallbitvec::SmallBitVec;
|
||||
use smallvec::SmallVec;
|
||||
use std::marker::PhantomData;
|
||||
use std::mem;
|
||||
use std::mem::{self, ManuallyDrop};
|
||||
use std::ops::Deref;
|
||||
use std::ptr::NonNull;
|
||||
use uluru::{Entry, LRUCache};
|
||||
|
@ -477,10 +477,9 @@ type TypelessSharingCache = SharingCacheBase<FakeCandidate>;
|
|||
type StoredSharingCache = Arc<AtomicRefCell<TypelessSharingCache>>;
|
||||
|
||||
thread_local! {
|
||||
// TODO(emilio): Looks like a few of these should just be Rc<RefCell<>> or
|
||||
// something. No need for atomics in the thread-local code.
|
||||
static SHARING_CACHE_KEY: StoredSharingCache =
|
||||
Arc::new_leaked(AtomicRefCell::new(TypelessSharingCache::default()));
|
||||
// See the comment on bloom.rs about why do we leak this.
|
||||
static SHARING_CACHE_KEY: ManuallyDrop<StoredSharingCache> =
|
||||
ManuallyDrop::new(Arc::new_leaked(Default::default()));
|
||||
}
|
||||
|
||||
/// An LRU cache of the last few nodes seen, so that we can aggressively try to
|
||||
|
@ -533,7 +532,7 @@ impl<E: TElement> StyleSharingCache<E> {
|
|||
mem::align_of::<SharingCache<E>>(),
|
||||
mem::align_of::<TypelessSharingCache>()
|
||||
);
|
||||
let cache_arc = SHARING_CACHE_KEY.with(|c| c.clone());
|
||||
let cache_arc = SHARING_CACHE_KEY.with(|c| Arc::clone(&*c));
|
||||
let cache =
|
||||
OwningHandle::new_with_fn(cache_arc, |x| unsafe { x.as_ref() }.unwrap().borrow_mut());
|
||||
debug_assert!(cache.is_empty());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue