Replace ScopedTLS::unsafe_get by ScopedTLS::into_slots

We only ever look at the slots after we are done with the thread pool,
so we don't need to expose any unsafety to inspect the slots.
This commit is contained in:
Anthony Ramine 2020-04-04 22:26:58 +02:00
parent 5d6c5132c1
commit e7cb736796
2 changed files with 6 additions and 8 deletions

View file

@ -165,10 +165,9 @@ pub fn traverse_dom<E, D>(
if dump_stats || report_stats {
let mut aggregate = mem::replace(&mut context.thread_local.statistics, Default::default());
let parallel = maybe_tls.is_some();
if let Some(ref mut tls) = maybe_tls {
let slots = unsafe { tls.unsafe_get() };
for slot in slots {
if let Some(ref cx) = *slot.borrow() {
if let Some(tls) = maybe_tls {
for mut slot in tls.into_slots().into_vec() {
if let Some(cx) = slot.get_mut() {
aggregate += cx.statistics.clone();
}
}