stylo: Remove usage of ServoComputedValues from binding functions

This commit is contained in:
Manish Goregaokar 2017-07-18 23:17:34 -07:00 committed by Manish Goregaokar
parent 9776d070ea
commit 3c3e4399da
7 changed files with 71 additions and 46 deletions

View file

@ -889,6 +889,12 @@ impl<'a, T> ArcBorrow<'a, T> {
arc
}
/// For constructing from a reference known to be Arc-backed,
/// e.g. if we obtain such a reference over FFI
pub unsafe fn from_ref(r: &'a T) -> Self {
ArcBorrow(r)
}
pub fn with_arc<F, U>(&self, f: F) -> U where F: FnOnce(&Arc<T>) -> U, T: 'static {
// Synthesize transient Arc, which never touches the refcount.
let transient = unsafe { NoDrop::new(Arc::from_raw(self.0)) };