mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +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
|
@ -88,6 +88,7 @@ use line::{
|
|||
TextRunLineItem,
|
||||
};
|
||||
use line_breaker::LineBreaker;
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use range::Range;
|
||||
use servo_arc::Arc;
|
||||
use style::Zero;
|
||||
|
@ -136,7 +137,7 @@ use crate::{ConstraintSpace, ContainingBlock, PropagatedBoxTreeData};
|
|||
static FONT_SUBSCRIPT_OFFSET_RATIO: f32 = 0.20;
|
||||
static FONT_SUPERSCRIPT_OFFSET_RATIO: f32 = 0.34;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, MallocSizeOf)]
|
||||
pub(crate) struct InlineFormattingContext {
|
||||
/// All [`InlineItem`]s in this [`InlineFormattingContext`] stored in a flat array.
|
||||
/// [`InlineItem::StartInlineBox`] and [`InlineItem::EndInlineBox`] allow representing
|
||||
|
@ -173,14 +174,14 @@ pub(crate) struct InlineFormattingContext {
|
|||
}
|
||||
|
||||
/// A collection of data used to cache [`FontMetrics`] in the [`InlineFormattingContext`]
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, MallocSizeOf)]
|
||||
pub(crate) struct FontKeyAndMetrics {
|
||||
pub key: FontInstanceKey,
|
||||
pub pt_size: Au,
|
||||
pub metrics: FontMetrics,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, MallocSizeOf)]
|
||||
pub(crate) enum InlineItem {
|
||||
StartInlineBox(ArcRefCell<InlineBox>),
|
||||
EndInlineBox,
|
||||
|
@ -189,9 +190,9 @@ pub(crate) enum InlineItem {
|
|||
ArcRefCell<AbsolutelyPositionedBox>,
|
||||
usize, /* offset_in_text */
|
||||
),
|
||||
OutOfFlowFloatBox(Arc<FloatBox>),
|
||||
OutOfFlowFloatBox(#[conditional_malloc_size_of] Arc<FloatBox>),
|
||||
Atomic(
|
||||
Arc<IndependentFormattingContext>,
|
||||
#[conditional_malloc_size_of] Arc<IndependentFormattingContext>,
|
||||
usize, /* offset_in_text */
|
||||
Level, /* bidi_level */
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue