Move all PropertyDeclarationBlock from RwLock<_> to Locked<_>

This commit is contained in:
Simon Sapin 2017-03-18 02:10:00 +01:00
parent aeffca2a59
commit 1bacd0eb15
28 changed files with 321 additions and 208 deletions

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use parking_lot::RwLock;
use std::sync::Arc;
use style::keyframes::{Keyframe, KeyframesAnimation, KeyframePercentage, KeyframeSelector};
use style::keyframes::{KeyframesStep, KeyframesStepValue};
@ -30,7 +29,7 @@ fn test_no_property_in_keyframe() {
let keyframes = vec![
Arc::new(shared_lock.wrap(Keyframe {
selector: KeyframeSelector::new_for_unit_testing(vec![KeyframePercentage::new(1.)]),
block: Arc::new(RwLock::new(PropertyDeclarationBlock::new()))
block: Arc::new(shared_lock.wrap(PropertyDeclarationBlock::new()))
})),
];
let animation = KeyframesAnimation::from_keyframes(&keyframes, &shared_lock.read());
@ -46,14 +45,14 @@ fn test_no_property_in_keyframe() {
fn test_missing_property_in_initial_keyframe() {
let shared_lock = SharedRwLock::new();
let declarations_on_initial_keyframe =
Arc::new(RwLock::new(PropertyDeclarationBlock::with_one(
Arc::new(shared_lock.wrap(PropertyDeclarationBlock::with_one(
PropertyDeclaration::Width(
LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(20f32))),
Importance::Normal
)));
let declarations_on_final_keyframe =
Arc::new(RwLock::new({
Arc::new(shared_lock.wrap({
let mut block = PropertyDeclarationBlock::new();
block.push(
PropertyDeclaration::Width(
@ -103,7 +102,7 @@ fn test_missing_property_in_initial_keyframe() {
fn test_missing_property_in_final_keyframe() {
let shared_lock = SharedRwLock::new();
let declarations_on_initial_keyframe =
Arc::new(RwLock::new({
Arc::new(shared_lock.wrap({
let mut block = PropertyDeclarationBlock::new();
block.push(
PropertyDeclaration::Width(
@ -119,7 +118,7 @@ fn test_missing_property_in_final_keyframe() {
}));
let declarations_on_final_keyframe =
Arc::new(RwLock::new(PropertyDeclarationBlock::with_one(
Arc::new(shared_lock.wrap(PropertyDeclarationBlock::with_one(
PropertyDeclaration::Height(
LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(20f32))),
Importance::Normal,
@ -160,7 +159,7 @@ fn test_missing_property_in_final_keyframe() {
fn test_missing_keyframe_in_both_of_initial_and_final_keyframe() {
let shared_lock = SharedRwLock::new();
let declarations =
Arc::new(RwLock::new({
Arc::new(shared_lock.wrap({
let mut block = PropertyDeclarationBlock::new();
block.push(
PropertyDeclaration::Width(
@ -178,7 +177,7 @@ fn test_missing_keyframe_in_both_of_initial_and_final_keyframe() {
let keyframes = vec![
Arc::new(shared_lock.wrap(Keyframe {
selector: KeyframeSelector::new_for_unit_testing(vec![KeyframePercentage::new(0.)]),
block: Arc::new(RwLock::new(PropertyDeclarationBlock::new()))
block: Arc::new(shared_lock.wrap(PropertyDeclarationBlock::new()))
})),
Arc::new(shared_lock.wrap(Keyframe {
selector: KeyframeSelector::new_for_unit_testing(vec![KeyframePercentage::new(0.5)]),
@ -191,7 +190,7 @@ fn test_missing_keyframe_in_both_of_initial_and_final_keyframe() {
KeyframesStep {
start_percentage: KeyframePercentage(0.),
value: KeyframesStepValue::Declarations {
block: Arc::new(RwLock::new(
block: Arc::new(shared_lock.wrap(
// XXX: Should we use ComputedValues in this case?
PropertyDeclarationBlock::new()
))