mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Remove ThinBoxedSlice
The only remaining consumers are ::-moz-tree pseudo-elements (we used to use ThinBoxedSlice for other data structures in the past). Those are not particularly performance sensitive so I think just double-boxing is fine. In the future, if we wanted to avoid the double indirection, we could probably use the "thin" crate (https://docs.rs/thin) or similar, which stores the length of the slice along with the allocation, making the pointer thin in all configurations, much like "ThinArc" does: https://searchfox.org/mozilla-central/rev/1ce2eea39442190a71a1f8f650d098f286bf4a01/servo/components/servo_arc/lib.rs#891 In practice though, I don't think it's particularly worth it for this specific case. Differential Revision: https://phabricator.services.mozilla.com/D134672
This commit is contained in:
parent
fc4d185079
commit
5b62f66f6e
7 changed files with 5 additions and 43 deletions
|
@ -32,7 +32,6 @@ use std::os::raw::c_void;
|
|||
use std::ptr::{self, NonNull};
|
||||
use std::slice;
|
||||
use std::str;
|
||||
use thin_slice::ThinBoxedSlice;
|
||||
|
||||
/// Result type for ToShmem::to_shmem.
|
||||
///
|
||||
|
@ -334,23 +333,6 @@ impl<T: ToShmem> ToShmem for Box<[T]> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: ToShmem> ToShmem for ThinBoxedSlice<T> {
|
||||
fn to_shmem(&self, builder: &mut SharedMemoryBuilder) -> Result<Self> {
|
||||
// We could support this if we needed but in practice we will never
|
||||
// need to handle such big ThinBoxedSlices.
|
||||
assert!(
|
||||
self.spilled_storage().is_none(),
|
||||
"ToShmem failed for ThinBoxedSlice: too many entries ({})",
|
||||
self.len(),
|
||||
);
|
||||
|
||||
unsafe {
|
||||
let dest = to_shmem_slice(self.iter(), builder)?;
|
||||
Ok(ManuallyDrop::new(ThinBoxedSlice::from_raw(dest)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToShmem for Box<str> {
|
||||
fn to_shmem(&self, builder: &mut SharedMemoryBuilder) -> Result<Self> {
|
||||
// Reserve space for the string bytes.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue