mirror of
https://github.com/servo/servo.git
synced 2025-08-02 12:10:29 +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
|
@ -3,7 +3,6 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![allow(unsafe_code)]
|
||||
|
||||
// This is needed for the constants in atom_macro.rs, because we have some
|
||||
// atoms whose names differ only by case, e.g. datetime and dateTime.
|
||||
#![allow(non_upper_case_globals)]
|
||||
|
@ -30,7 +29,7 @@ use std::num::NonZeroUsize;
|
|||
use std::ops::Deref;
|
||||
use std::{slice, str};
|
||||
use style_traits::SpecifiedValueInfo;
|
||||
use to_shmem::{SharedMemoryBuilder, ToShmem};
|
||||
use to_shmem::{self, SharedMemoryBuilder, ToShmem};
|
||||
|
||||
#[macro_use]
|
||||
#[allow(improper_ctypes, non_camel_case_types, missing_docs)]
|
||||
|
@ -132,14 +131,15 @@ impl Borrow<WeakAtom> for Atom {
|
|||
}
|
||||
|
||||
impl ToShmem for Atom {
|
||||
fn to_shmem(&self, _builder: &mut SharedMemoryBuilder) -> ManuallyDrop<Self> {
|
||||
assert!(
|
||||
self.is_static(),
|
||||
"ToShmem failed for Atom: must be a static atom: {}",
|
||||
self
|
||||
);
|
||||
fn to_shmem(&self, _builder: &mut SharedMemoryBuilder) -> to_shmem::Result<Self> {
|
||||
if !self.is_static() {
|
||||
return Err(format!(
|
||||
"ToShmem failed for Atom: must be a static atom: {}",
|
||||
self
|
||||
));
|
||||
}
|
||||
|
||||
ManuallyDrop::new(Atom(self.0))
|
||||
Ok(ManuallyDrop::new(Atom(self.0)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue