mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Use parking_lot::RwLock instead of DOMRefCell for PropertyDeclarationBlock
This commit is contained in:
parent
d986fd2d2f
commit
89a29a7f12
24 changed files with 121 additions and 106 deletions
|
@ -32,6 +32,7 @@ use gecko_bindings::structs::{nsChangeHint, nsIAtom, nsIContent, nsStyleContext}
|
|||
use gecko_bindings::structs::OpaqueStyleData;
|
||||
use gecko_bindings::sugar::ownership::{FFIArcHelpers, HasArcFFI, HasFFI};
|
||||
use libc::uintptr_t;
|
||||
use parking_lot::RwLock;
|
||||
use parser::ParserContextExtraData;
|
||||
use properties::{ComputedValues, parse_style_attribute};
|
||||
use properties::PropertyDeclarationBlock;
|
||||
|
@ -46,7 +47,6 @@ use std::ptr;
|
|||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicBool, AtomicPtr};
|
||||
use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
|
||||
use style::domrefcell::DOMRefCell;
|
||||
use url::Url;
|
||||
|
||||
pub struct NonOpaqueStyleData(AtomicRefCell<PersistentStyleData>);
|
||||
|
@ -59,7 +59,7 @@ impl NonOpaqueStyleData {
|
|||
|
||||
|
||||
pub struct GeckoDeclarationBlock {
|
||||
pub declarations: Option<Arc<PropertyDeclarationBlock>>,
|
||||
pub declarations: Option<Arc<RwLock<PropertyDeclarationBlock>>>,
|
||||
// XXX The following two fields are made atomic to work around the
|
||||
// ownership system so that they can be changed inside a shared
|
||||
// instance. It wouldn't provide safety as Rust usually promises,
|
||||
|
@ -469,7 +469,7 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
unsafe { GeckoNode(&*(self.0 as *const _ as *const RawGeckoNode)) }
|
||||
}
|
||||
|
||||
fn style_attribute(&self) -> Option<&Arc<DOMRefCell<PropertyDeclarationBlock>>> {
|
||||
fn style_attribute(&self) -> Option<&Arc<RwLock<PropertyDeclarationBlock>>> {
|
||||
let declarations = unsafe { Gecko_GetServoDeclarationBlock(self.0) };
|
||||
if declarations.is_null() {
|
||||
None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue