diff options
author | Manish Goregaokar <manishearth@gmail.com> | 2017-07-18 23:17:34 -0700 |
---|---|---|
committer | Manish Goregaokar <manishsmail@gmail.com> | 2017-07-21 08:33:11 -0700 |
commit | 3c3e4399da4fcddcb75255a1178ed71be7a5f46b (patch) | |
tree | 5a062a5c489624a332c93b0c2f1804982b11d754 /components/servo_arc/lib.rs | |
parent | 9776d070ea6def6162c7d7b5428078343c336daa (diff) | |
download | servo-3c3e4399da4fcddcb75255a1178ed71be7a5f46b.tar.gz servo-3c3e4399da4fcddcb75255a1178ed71be7a5f46b.zip |
stylo: Remove usage of ServoComputedValues from binding functions
Diffstat (limited to 'components/servo_arc/lib.rs')
-rw-r--r-- | components/servo_arc/lib.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/components/servo_arc/lib.rs b/components/servo_arc/lib.rs index b1f4f277a49..d8a74758247 100644 --- a/components/servo_arc/lib.rs +++ b/components/servo_arc/lib.rs @@ -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)) }; |