mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Make DomRefCell not mutate the borrow flag non-atomically
This commit is contained in:
parent
45f1316c62
commit
15db31769c
2 changed files with 6 additions and 5 deletions
|
@ -45,11 +45,12 @@ impl<T> DomRefCell<T> {
|
||||||
&mut *self.value.as_ptr()
|
&mut *self.value.as_ptr()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Version of the above that we use during restyle while the script thread
|
/// Mutably borrow a cell for layout. Ideally this would use
|
||||||
/// is blocked.
|
/// `RefCell::try_borrow_mut_unguarded` but that doesn't exist yet.
|
||||||
pub fn borrow_mut_for_layout(&self) -> RefMut<T> {
|
#[allow(unsafe_code)]
|
||||||
|
pub unsafe fn borrow_mut_for_layout(&self) -> &mut T {
|
||||||
debug_assert!(thread_state::get().is_layout());
|
debug_assert!(thread_state::get().is_layout());
|
||||||
self.value.borrow_mut()
|
&mut *self.value.as_ptr()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -281,7 +281,7 @@ impl<'dom> LayoutShadowRootHelpers<'dom> for LayoutDom<'dom, ShadowRoot> {
|
||||||
quirks_mode: QuirksMode,
|
quirks_mode: QuirksMode,
|
||||||
guard: &SharedRwLockReadGuard,
|
guard: &SharedRwLockReadGuard,
|
||||||
) {
|
) {
|
||||||
let mut author_styles = (*self.unsafe_get()).author_styles.borrow_mut_for_layout();
|
let author_styles = self.unsafe_get().author_styles.borrow_mut_for_layout();
|
||||||
if author_styles.stylesheets.dirty() {
|
if author_styles.stylesheets.dirty() {
|
||||||
author_styles.flush::<E>(device, quirks_mode, guard);
|
author_styles.flush::<E>(device, quirks_mode, guard);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue