Bug 1477883: Update parking_lot to 0.6. r=emilio

Cherry-pick of servo/servo#21216.

MozReview-Commit-ID: 4sTKSSCbrP4
This commit is contained in:
Bastien Orivel 2018-07-24 03:17:48 +02:00 committed by Emilio Cobos Álvarez
parent 91a3707d5f
commit 29f51fc11b
3 changed files with 10 additions and 8 deletions

View File

@ -52,7 +52,7 @@ num-integer = "0.1.32"
num-traits = "0.1.32"
new-ordered-float = "1.0"
owning_ref = "0.3.3"
parking_lot = "0.5"
parking_lot = "0.6"
precomputed-hash = "0.1.1"
rayon = "1"
selectors = { path = "../selectors" }

View File

@ -11,6 +11,8 @@ use parking_lot::RwLock;
use servo_arc::Arc;
use std::cell::UnsafeCell;
use std::fmt;
#[cfg(feature = "servo")]
use std::mem;
#[cfg(feature = "gecko")]
use std::ptr;
use str::{CssString, CssStringWriter};
@ -74,7 +76,7 @@ impl SharedRwLock {
/// Obtain the lock for reading (servo).
#[cfg(feature = "servo")]
pub fn read(&self) -> SharedRwLockReadGuard {
self.arc.raw_read();
mem::forget(self.arc.read());
SharedRwLockReadGuard(self)
}
@ -87,7 +89,7 @@ impl SharedRwLock {
/// Obtain the lock for writing (servo).
#[cfg(feature = "servo")]
pub fn write(&self) -> SharedRwLockWriteGuard {
self.arc.raw_write();
mem::forget(self.arc.write());
SharedRwLockWriteGuard(self)
}
@ -107,9 +109,9 @@ pub struct SharedRwLockReadGuard<'a>(AtomicRef<'a, SomethingZeroSizedButTyped>);
#[cfg(feature = "servo")]
impl<'a> Drop for SharedRwLockReadGuard<'a> {
fn drop(&mut self) {
// Unsafe: self.lock is private to this module, only ever set after `raw_read()`,
// Unsafe: self.lock is private to this module, only ever set after `read()`,
// and never copied or cloned (see `compile_time_assert` below).
unsafe { self.0.arc.raw_unlock_read() }
unsafe { self.0.arc.force_unlock_read() }
}
}
@ -122,9 +124,9 @@ pub struct SharedRwLockWriteGuard<'a>(AtomicRefMut<'a, SomethingZeroSizedButType
#[cfg(feature = "servo")]
impl<'a> Drop for SharedRwLockWriteGuard<'a> {
fn drop(&mut self) {
// Unsafe: self.lock is private to this module, only ever set after `raw_write()`,
// Unsafe: self.lock is private to this module, only ever set after `write()`,
// and never copied or cloned (see `compile_time_assert` below).
unsafe { self.0.arc.raw_unlock_write() }
unsafe { self.0.arc.force_unlock_write() }
}
}

View File

@ -21,7 +21,7 @@ libc = "0.2"
log = {version = "0.4", features = ["release_max_level_info"]}
malloc_size_of = {path = "../../components/malloc_size_of"}
nsstring = {path = "../../support/gecko/nsstring"}
parking_lot = "0.5"
parking_lot = "0.6"
selectors = {path = "../../components/selectors"}
servo_arc = {path = "../../components/servo_arc"}
smallvec = "0.6"