Update parking_lot to 0.6

This commit is contained in:
Bastien Orivel 2018-07-19 23:16:26 +02:00
parent 908a642063
commit ba9cbd87fb
7 changed files with 37 additions and 25 deletions

View file

@ -28,7 +28,7 @@ malloc_size_of = { path = "../malloc_size_of" }
msg = {path = "../msg"}
net_traits = {path = "../net_traits"}
new-ordered-float = "1.0"
parking_lot = "0.5"
parking_lot = "0.6"
profile_traits = {path = "../profile_traits"}
range = {path = "../range"}
rayon = "1"

View file

@ -33,7 +33,7 @@ malloc_size_of = { path = "../malloc_size_of" }
metrics = {path = "../metrics"}
msg = {path = "../msg"}
net_traits = {path = "../net_traits"}
parking_lot = "0.5"
parking_lot = "0.6"
profile_traits = {path = "../profile_traits"}
range = {path = "../range"}
rayon = "1"

View file

@ -70,7 +70,7 @@ msg = {path = "../msg"}
net_traits = {path = "../net_traits"}
num-traits = "0.1.32"
offscreen_gl_context = {version = "0.20", features = ["serde"]}
parking_lot = "0.5"
parking_lot = "0.6"
phf = "0.7.18"
profile_traits = {path = "../profile_traits"}
ref_filter_map = "1.0.1"

View file

@ -51,7 +51,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() }
}
}