author | Anthony Ramine <nox@nox.paris> |
Sat, 04 Apr 2020 22:26:58 +0200 | |
changeset 524461 | 083f6ee1d48a207029b371e7ea6bfaa0e46a0390 |
parent 524460 | 61f86d3c80acd39cc828d8978ef911505201a996 |
child 524462 | 59fd20266fb5b165bb67403f3d4e22e7a785b923 |
push id | 37321 |
push user | dluca@mozilla.com |
push date | Fri, 17 Apr 2020 09:38:52 +0000 |
treeherder | mozilla-central@24537fed53e6 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | emilio |
bugs | 1630676 |
milestone | 77.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
servo/components/style/driver.rs | file | annotate | diff | comparison | revisions | |
servo/components/style/scoped_tls.rs | file | annotate | diff | comparison | revisions |
--- a/servo/components/style/driver.rs +++ b/servo/components/style/driver.rs @@ -160,20 +160,19 @@ pub fn traverse_dom<E, D>( nodes_remaining_at_current_depth = discovered.len(); } } // Collect statistics from thread-locals if requested. 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(); } } } if report_stats { report_statistics(&aggregate); }
--- a/servo/components/style/scoped_tls.rs +++ b/servo/components/style/scoped_tls.rs @@ -66,14 +66,13 @@ impl<'scope, T: Send> ScopedTLS<'scope, let mut opt = self.borrow_mut(); if opt.is_none() { f(opt.deref_mut()); } RefMut::map(opt, |x| x.as_mut().unwrap()) } - /// Unsafe access to the slots. This can be used to access the TLS when - /// the caller knows that the pool does not have access to the TLS. - pub unsafe fn unsafe_get(&self) -> &[RefCell<Option<T>>] { - &self.slots + /// Returns the slots, consuming the scope. + pub fn into_slots(self) -> Box<[RefCell<Option<T>>]> { + self.slots } }