mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
fonts: Measure more FontContext heap usage. (#38733)
Replace a hand-written MallocSizeOf implementation with an automatically derived one. This exposes more than 1MB of previously-untracked heap data on servo.org. Testing: Compared about:memory output for servo.org before and after. Part of: #11559 Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
d490c5c06b
commit
9da8142e2a
8 changed files with 59 additions and 32 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
use std::borrow::ToOwned;
|
||||
use std::collections::HashMap;
|
||||
use std::ops::Deref;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::{Arc, OnceLock};
|
||||
use std::time::Instant;
|
||||
|
@ -548,7 +549,15 @@ impl Font {
|
|||
}
|
||||
}
|
||||
|
||||
pub type FontRef = Arc<Font>;
|
||||
#[derive(Clone, MallocSizeOf)]
|
||||
pub struct FontRef(#[conditional_malloc_size_of] pub(crate) Arc<Font>);
|
||||
|
||||
impl Deref for FontRef {
|
||||
type Target = Arc<Font>;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
/// A `FontGroup` is a prioritised list of fonts for a given set of font styles. It is used by
|
||||
/// `TextRun` to decide which font to render a character with. If none of the fonts listed in the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue