mirror of
https://github.com/servo/servo.git
synced 2025-09-29 16:19: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
|
@ -3,6 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::ops::Deref;
|
||||
use std::sync::Arc;
|
||||
|
||||
use log::warn;
|
||||
|
@ -21,7 +22,16 @@ pub struct FontStore {
|
|||
web_fonts_loading_for_stylesheets: Vec<(DocumentStyleSheet, usize)>,
|
||||
web_fonts_loading_for_script: usize,
|
||||
}
|
||||
pub(crate) type CrossThreadFontStore = Arc<RwLock<FontStore>>;
|
||||
|
||||
#[derive(Default, MallocSizeOf)]
|
||||
pub(crate) struct CrossThreadFontStore(#[conditional_malloc_size_of] Arc<RwLock<FontStore>>);
|
||||
|
||||
impl Deref for CrossThreadFontStore {
|
||||
type Target = Arc<RwLock<FontStore>>;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl FontStore {
|
||||
pub(crate) fn clear(&mut self) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue