Use parking_lot::RwLock instead of DOMRefCell for PropertyDeclarationBlock

This commit is contained in:
Simon Sapin 2016-09-27 16:02:36 +02:00
parent d986fd2d2f
commit 89a29a7f12
24 changed files with 121 additions and 106 deletions

1
ports/cef/Cargo.lock generated
View file

@ -1868,6 +1868,7 @@ dependencies = [
"num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"offscreen_gl_context 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"open 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_macros 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",

View file

@ -9,6 +9,7 @@ dependencies = [
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"style_traits 0.0.1",

View file

@ -17,6 +17,7 @@ lazy_static = "0.2"
libc = "0.2"
log = {version = "0.3.5", features = ["release_max_level_info"]}
num_cpus = "0.2.2"
parking_lot = "0.3"
selectors = "0.13"
style = {path = "../../components/style", features = ["gecko"]}
style_traits = {path = "../../components/style_traits"}

View file

@ -7,6 +7,7 @@
use app_units::Au;
use env_logger;
use euclid::Size2D;
use parking_lot::RwLock;
use std::mem::transmute;
use std::ptr;
use std::slice;
@ -16,7 +17,6 @@ use std::sync::atomic::{AtomicBool, AtomicPtr, Ordering};
use style::arc_ptr_eq;
use style::context::{LocalStyleContextCreationInfo, ReflowGoal, SharedStyleContext};
use style::dom::{NodeInfo, TDocument, TElement, TNode};
use style::domrefcell::DOMRefCell;
use style::error_reporting::StdoutErrorReporter;
use style::gecko::data::{NUM_THREADS, PerDocumentStyleData};
use style::gecko::selector_impl::{GeckoSelectorImpl, PseudoElement};
@ -346,7 +346,7 @@ pub extern "C" fn Servo_ParseStyleAttribute(bytes: *const u8, length: u32,
let value = unsafe { from_utf8_unchecked(slice::from_raw_parts(bytes, length as usize)) };
Arc::new(GeckoDeclarationBlock {
declarations: GeckoElement::parse_style_attribute(value).map(|block| {
Arc::new(DOMRefCell::new(block))
Arc::new(RwLock::new(block))
}),
cache: AtomicPtr::new(cache),
immutable: AtomicBool::new(false),

View file

@ -9,6 +9,7 @@ extern crate env_logger;
extern crate euclid;
extern crate libc;
#[macro_use] extern crate log;
extern crate parking_lot;
extern crate url;
#[allow(non_snake_case)]