mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
layout: Report memory usage for fragment and box trees. (#36553)
Add memory reporter integration for the fragment and box trees that are persisted in the layout thread. Testing: Looked at the numbers for https://servo.org and https://html.spec.whatwg.org/. The former was very small, but the latter was 700mb. --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
add8c51f47
commit
c787688afc
33 changed files with 230 additions and 69 deletions
|
@ -6,6 +6,7 @@ mod stylo_taffy;
|
|||
use std::fmt;
|
||||
|
||||
use app_units::Au;
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use servo_arc::Arc;
|
||||
use style::properties::ComputedValues;
|
||||
use stylo_taffy::TaffyStyloStyle;
|
||||
|
@ -20,9 +21,10 @@ use crate::formatting_contexts::IndependentFormattingContext;
|
|||
use crate::fragment_tree::Fragment;
|
||||
use crate::positioned::{AbsolutelyPositionedBox, PositioningContext};
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, MallocSizeOf)]
|
||||
pub(crate) struct TaffyContainer {
|
||||
children: Vec<ArcRefCell<TaffyItemBox>>,
|
||||
#[conditional_malloc_size_of]
|
||||
style: Arc<ComputedValues>,
|
||||
}
|
||||
|
||||
|
@ -69,15 +71,17 @@ impl TaffyContainer {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(MallocSizeOf)]
|
||||
pub(crate) struct TaffyItemBox {
|
||||
pub(crate) taffy_layout: taffy::Layout,
|
||||
pub(crate) child_fragments: Vec<Fragment>,
|
||||
pub(crate) positioning_context: PositioningContext,
|
||||
#[conditional_malloc_size_of]
|
||||
pub(crate) style: Arc<ComputedValues>,
|
||||
pub(crate) taffy_level_box: TaffyItemBoxInner,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, MallocSizeOf)]
|
||||
pub(crate) enum TaffyItemBoxInner {
|
||||
InFlowBox(IndependentFormattingContext),
|
||||
OutOfFlowAbsolutelyPositionedBox(ArcRefCell<AbsolutelyPositionedBox>),
|
||||
|
@ -145,7 +149,7 @@ impl TaffyItemBox {
|
|||
}
|
||||
|
||||
/// Details from Taffy grid layout that will be stored
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone, Debug, MallocSizeOf)]
|
||||
pub(crate) struct SpecificTaffyGridInfo {
|
||||
pub rows: SpecificTaffyGridTrackInfo,
|
||||
pub columns: SpecificTaffyGridTrackInfo,
|
||||
|
@ -174,7 +178,7 @@ impl SpecificTaffyGridInfo {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone, Debug, MallocSizeOf)]
|
||||
pub(crate) struct SpecificTaffyGridTrackInfo {
|
||||
pub sizes: Box<[Au]>,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue