mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Wrap most CSS rules in Locked<_> instead of RwLock<_>
This commit is contained in:
parent
f35b4e27b3
commit
adb97d4cbe
17 changed files with 194 additions and 139 deletions
|
@ -10,20 +10,19 @@ use dom::cssrule::{CSSRule, SpecificCSSRule};
|
|||
use dom::cssstylesheet::CSSStyleSheet;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use parking_lot::RwLock;
|
||||
use std::sync::Arc;
|
||||
use style::font_face::FontFaceRule;
|
||||
use style::shared_lock::ToCssWithGuard;
|
||||
use style::shared_lock::{Locked, ToCssWithGuard};
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSSFontFaceRule {
|
||||
cssrule: CSSRule,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
fontfacerule: Arc<RwLock<FontFaceRule>>,
|
||||
fontfacerule: Arc<Locked<FontFaceRule>>,
|
||||
}
|
||||
|
||||
impl CSSFontFaceRule {
|
||||
fn new_inherited(parent_stylesheet: &CSSStyleSheet, fontfacerule: Arc<RwLock<FontFaceRule>>)
|
||||
fn new_inherited(parent_stylesheet: &CSSStyleSheet, fontfacerule: Arc<Locked<FontFaceRule>>)
|
||||
-> CSSFontFaceRule {
|
||||
CSSFontFaceRule {
|
||||
cssrule: CSSRule::new_inherited(parent_stylesheet),
|
||||
|
@ -33,7 +32,7 @@ impl CSSFontFaceRule {
|
|||
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet,
|
||||
fontfacerule: Arc<RwLock<FontFaceRule>>) -> Root<CSSFontFaceRule> {
|
||||
fontfacerule: Arc<Locked<FontFaceRule>>) -> Root<CSSFontFaceRule> {
|
||||
reflect_dom_object(box CSSFontFaceRule::new_inherited(parent_stylesheet, fontfacerule),
|
||||
window,
|
||||
CSSFontFaceRuleBinding::Wrap)
|
||||
|
@ -48,6 +47,6 @@ impl SpecificCSSRule for CSSFontFaceRule {
|
|||
|
||||
fn get_css(&self) -> DOMString {
|
||||
let guard = self.cssrule.shared_lock().read();
|
||||
self.fontfacerule.read().to_css_string(&guard).into()
|
||||
self.fontfacerule.read_with(&guard).to_css_string(&guard).into()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue