diff --git a/sixtyfps_runtime/corelib/Cargo.toml b/sixtyfps_runtime/corelib/Cargo.toml index d68bf036a..1e072b813 100644 --- a/sixtyfps_runtime/corelib/Cargo.toml +++ b/sixtyfps_runtime/corelib/Cargo.toml @@ -21,7 +21,7 @@ corelib_macro = { path = "../corelib_macro" } winit = "0.22.1" lyon = { version = "0.15.8" } euclid = "0.20.11" -servo_arc = "0.1.1" #we need the Arc::from_header_and_iter +triomphe = "0.1.1" once_cell = "1.4" instant = { version = "0.1", features = [ "now" ] } derive_more = "0.99.5" diff --git a/sixtyfps_runtime/corelib/abi/sharedarray.rs b/sixtyfps_runtime/corelib/abi/sharedarray.rs index 3dc2ed12a..80475c93e 100644 --- a/sixtyfps_runtime/corelib/abi/sharedarray.rs +++ b/sixtyfps_runtime/corelib/abi/sharedarray.rs @@ -1,7 +1,7 @@ //! module for the SharedArray and related things use core::mem::MaybeUninit; -use servo_arc::ThinArc; use std::{fmt::Debug, fmt::Display, ops::Deref}; +use triomphe::{Arc, HeaderWithLength, ThinArc}; #[derive(Clone)] #[repr(C)] @@ -81,8 +81,8 @@ impl SharedArray { let iter = PaddingFillingIter::new(len, item_iter); SharedArray { - inner: servo_arc::Arc::into_thin(servo_arc::Arc::from_header_and_iter( - servo_arc::HeaderWithLength::new(len, iter.size_hint().0), + inner: Arc::into_thin(Arc::from_header_and_iter( + HeaderWithLength::new(len, iter.size_hint().0), iter, )), } @@ -110,8 +110,8 @@ impl StaticNull for T { let null_iter = &mut std::iter::empty(); let iter = PaddingFillingIter::new(len, null_iter); - servo_arc::Arc::into_thin(servo_arc::Arc::from_header_and_iter( - servo_arc::HeaderWithLength::new(len, iter.size_hint().0), + Arc::into_thin(Arc::from_header_and_iter( + HeaderWithLength::new(len, iter.size_hint().0), iter, )) }); diff --git a/sixtyfps_runtime/corelib/abi/string.rs b/sixtyfps_runtime/corelib/abi/string.rs index 561453bb6..121d2db60 100644 --- a/sixtyfps_runtime/corelib/abi/string.rs +++ b/sixtyfps_runtime/corelib/abi/string.rs @@ -1,7 +1,7 @@ //! module for the SharedString and related things use core::mem::MaybeUninit; -use servo_arc::ThinArc; use std::{fmt::Debug, fmt::Display, ops::Deref}; +use triomphe::{Arc, HeaderWithLength, ThinArc}; /// The string type suitable for properties. It is shared meaning passing copies /// around will not allocate, and that different properties with the same string @@ -46,8 +46,8 @@ impl SharedString { pub fn push_str(&mut self, x: &str) { let new_len = self.inner.header.header + x.len(); if new_len + 1 < self.inner.slice.len() { - let mut arc = servo_arc::Arc::from_thin(self.inner.clone()); - if let Some(inner) = servo_arc::Arc::get_mut(&mut arc) { + let mut arc = Arc::from_thin(self.inner.clone()); + if let Some(inner) = Arc::get_mut(&mut arc) { unsafe { core::ptr::copy_nonoverlapping( x.as_ptr(), @@ -91,7 +91,7 @@ impl SharedString { return Some(MaybeUninit::new(0)); } // I don't know if the compiler will be smart enough to exit the loop here. - // It would be nice if servo_arc::Arc would allow to leave uninitialized memory + // It would be nice if triomphe::Arc would allow to leave uninitialized memory Some(MaybeUninit::uninit()) } fn size_hint(&self) -> (usize, Option) { @@ -110,8 +110,8 @@ impl SharedString { new_alloc, }; - self.inner = servo_arc::Arc::into_thin(servo_arc::Arc::from_header_and_iter( - servo_arc::HeaderWithLength::new(new_len, new_alloc), + self.inner = Arc::into_thin(Arc::from_header_and_iter( + HeaderWithLength::new(new_len, new_alloc), iter, )); } @@ -129,8 +129,8 @@ impl Default for SharedString { // Unfortunately, the Arc constructor is not const, so we must use a Lazy static for that static NULL: once_cell::sync::Lazy>> = once_cell::sync::Lazy::new(|| { - servo_arc::Arc::into_thin(servo_arc::Arc::from_header_and_iter( - servo_arc::HeaderWithLength::new(0, core::mem::align_of::()), + Arc::into_thin(Arc::from_header_and_iter( + HeaderWithLength::new(0, core::mem::align_of::()), [MaybeUninit::new(0); core::mem::align_of::()].iter().cloned(), )) }); @@ -174,8 +174,8 @@ impl From<&str> for SharedString { let iter = AddNullIter { str: value.as_bytes(), pos: 0 }; SharedString { - inner: servo_arc::Arc::into_thin(servo_arc::Arc::from_header_and_iter( - servo_arc::HeaderWithLength::new(value.len(), iter.size_hint().0), + inner: Arc::into_thin(Arc::from_header_and_iter( + HeaderWithLength::new(value.len(), iter.size_hint().0), iter, )), }