mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Gracefully handle errors creating shared memory UA style sheets.
We still panic in a debug build, so that developers can notice when they need to add a new static atom after modifying UA sheets. We also add telemetry to note when this happens, add an app note to a crash report, in case any crash later on occurs, and re-up the existing, expired shared memory sheet telemetry probes so we can look at them again. Differential Revision: https://phabricator.services.mozilla.com/D73188
This commit is contained in:
parent
709c52fefb
commit
6bae0b99ca
10 changed files with 184 additions and 122 deletions
|
@ -13,7 +13,7 @@ use std::marker::PhantomData;
|
|||
use std::ops::{Deref, DerefMut};
|
||||
use std::ptr::NonNull;
|
||||
use std::{fmt, iter, mem, slice};
|
||||
use to_shmem::{SharedMemoryBuilder, ToShmem};
|
||||
use to_shmem::{self, SharedMemoryBuilder, ToShmem};
|
||||
|
||||
/// A struct that basically replaces a `Box<[T]>`, but which cbindgen can
|
||||
/// understand.
|
||||
|
@ -159,10 +159,10 @@ impl<T: MallocSizeOf + Sized> MallocSizeOf for OwnedSlice<T> {
|
|||
}
|
||||
|
||||
impl<T: ToShmem + Sized> ToShmem for OwnedSlice<T> {
|
||||
fn to_shmem(&self, builder: &mut SharedMemoryBuilder) -> mem::ManuallyDrop<Self> {
|
||||
fn to_shmem(&self, builder: &mut SharedMemoryBuilder) -> to_shmem::Result<Self> {
|
||||
unsafe {
|
||||
let dest = to_shmem::to_shmem_slice(self.iter(), builder);
|
||||
mem::ManuallyDrop::new(Self::from(Box::from_raw(dest)))
|
||||
let dest = to_shmem::to_shmem_slice(self.iter(), builder)?;
|
||||
Ok(mem::ManuallyDrop::new(Self::from(Box::from_raw(dest))))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue