mirror of
https://github.com/servo/servo.git
synced 2025-08-09 15:35:34 +01:00
Move shared lock acquires up the call stack. (Or is it down?)
This commit is contained in:
parent
c5a7294e05
commit
d18b1280f2
5 changed files with 46 additions and 27 deletions
|
@ -13,6 +13,7 @@ use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
|
|||
use media_queries::Device;
|
||||
use parking_lot::RwLock;
|
||||
use properties::ComputedValues;
|
||||
use shared_lock::SharedRwLockReadGuard;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::{Receiver, Sender, channel};
|
||||
|
@ -83,20 +84,20 @@ impl PerDocumentStyleDataImpl {
|
|||
/// Reset the device state because it may have changed.
|
||||
///
|
||||
/// Implies also a stylesheet flush.
|
||||
pub fn reset_device(&mut self) {
|
||||
pub fn reset_device(&mut self, guard: &SharedRwLockReadGuard) {
|
||||
{
|
||||
let mut stylist = Arc::get_mut(&mut self.stylist).unwrap();
|
||||
Arc::get_mut(&mut stylist.device).unwrap().reset();
|
||||
}
|
||||
self.stylesheets_changed = true;
|
||||
self.flush_stylesheets();
|
||||
self.flush_stylesheets(guard);
|
||||
}
|
||||
|
||||
/// Recreate the style data if the stylesheets have changed.
|
||||
pub fn flush_stylesheets(&mut self) {
|
||||
pub fn flush_stylesheets(&mut self, guard: &SharedRwLockReadGuard) {
|
||||
if self.stylesheets_changed {
|
||||
let mut stylist = Arc::get_mut(&mut self.stylist).unwrap();
|
||||
stylist.update(&self.stylesheets, None, true);
|
||||
stylist.update(&self.stylesheets, guard, None, true);
|
||||
self.stylesheets_changed = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue