style: Add refcount logging to servo_arc.

Differential Revision: https://phabricator.services.mozilla.com/D32173
This commit is contained in:
Emilio Cobos Álvarez 2019-05-16 04:35:34 +02:00
parent 57868f571f
commit 9a9a4e12d5
10 changed files with 100 additions and 23 deletions

View file

@ -485,8 +485,12 @@ type SharingCache<E> = SharingCacheBase<StyleSharingCandidate<E>>;
type TypelessSharingCache = SharingCacheBase<FakeCandidate>;
type StoredSharingCache = Arc<AtomicRefCell<TypelessSharingCache>>;
thread_local!(static SHARING_CACHE_KEY: StoredSharingCache =
Arc::new(AtomicRefCell::new(TypelessSharingCache::default())));
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()));
}
/// An LRU cache of the last few nodes seen, so that we can aggressively try to
/// reuse their styles.