stylo: Store servo computed values for animation properties

MozReview-Commit-ID: IoQLN5tdIBw
This commit is contained in:
Manish Goregaokar 2016-11-30 17:34:54 -08:00 committed by Manish Goregaokar
parent f6940f686c
commit d87b710fdd
7 changed files with 275 additions and 22 deletions

View file

@ -5,10 +5,12 @@
//! A rust helper to ease the use of Gecko's refcounted types.
use gecko_bindings::structs;
use gecko_bindings::sugar::ownership::HasArcFFI;
use heapsize::HeapSizeOf;
use std::{mem, ptr};
use std::marker::PhantomData;
use std::ops::{Deref, DerefMut};
use std::sync::Arc;
/// Trait for all objects that have Addref() and Release
/// methods and can be placed inside RefPtr<T>
@ -196,6 +198,14 @@ impl<T: RefCounted> structs::RefPtr<T> {
}
}
impl<T> structs::RefPtr<T> {
/// Sets the contents to an Arc<T>
/// will leak existing contents
pub fn set_arc_leaky<U>(&mut self, other: Arc<U>) where U: HasArcFFI<FFIType = T> {
*self = unsafe { mem::transmute(other) }; // Arc::into_raw is unstable :(
}
}
impl<T: RefCounted> Drop for RefPtr<T> {
fn drop(&mut self) {
unsafe { self.release() }