mirror of
https://github.com/servo/servo.git
synced 2025-08-16 10:55:34 +01:00
Various memory measurement improvements (#36834)
The two significant changes here are 1) a commit that frees memory used to perform memory reporting once the reporting is complete, 2) memory reporting for the system font service. There are various other commits that remove `#[ignore_malloc_size_of]` attributes for data that we are now able to measure, but they do not significantly change our measurements when testing servo.org. Testing: Comparing the output of about:memory on servo.org. --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
e9f364ef51
commit
ba8f923201
19 changed files with 135 additions and 49 deletions
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::fmt::{Debug, Error, Formatter};
|
||||
use std::ops::RangeInclusive;
|
||||
use std::ops::{Deref, RangeInclusive};
|
||||
use std::sync::Arc;
|
||||
|
||||
use atomic_refcell::AtomicRefCell;
|
||||
|
@ -20,7 +20,21 @@ use crate::system_font_service::{
|
|||
};
|
||||
|
||||
/// A reference to a [`FontTemplate`] with shared ownership and mutability.
|
||||
pub type FontTemplateRef = Arc<AtomicRefCell<FontTemplate>>;
|
||||
#[derive(Clone, Debug, MallocSizeOf)]
|
||||
pub struct FontTemplateRef(#[conditional_malloc_size_of] Arc<AtomicRefCell<FontTemplate>>);
|
||||
|
||||
impl FontTemplateRef {
|
||||
pub fn new(template: FontTemplate) -> Self {
|
||||
Self(Arc::new(AtomicRefCell::new(template)))
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for FontTemplateRef {
|
||||
type Target = Arc<AtomicRefCell<FontTemplate>>;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
/// Describes how to select a font from a given family. This is very basic at the moment and needs
|
||||
/// to be expanded or refactored when we support more of the font styling parameters.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue