diff options
author | Josh Matthews <josh@joshmatthews.net> | 2025-04-18 16:05:15 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-18 20:05:15 +0000 |
commit | c787688afc873e78d9526809cf7d2cde689c0ae4 (patch) | |
tree | bf852fcac1370e251e5282c331227c13c7fbd3dd /components/layout_2020/flexbox/mod.rs | |
parent | add8c51f4728fbafe56781670f9ae4b1a754e094 (diff) | |
download | servo-c787688afc873e78d9526809cf7d2cde689c0ae4.tar.gz servo-c787688afc873e78d9526809cf7d2cde689c0ae4.zip |
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>
Diffstat (limited to 'components/layout_2020/flexbox/mod.rs')
-rw-r--r-- | components/layout_2020/flexbox/mod.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/components/layout_2020/flexbox/mod.rs b/components/layout_2020/flexbox/mod.rs index f51caca65e8..e1f8213f1e9 100644 --- a/components/layout_2020/flexbox/mod.rs +++ b/components/layout_2020/flexbox/mod.rs @@ -3,6 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use geom::{FlexAxis, MainStartCrossStart}; +use malloc_size_of_derive::MallocSizeOf; use servo_arc::Arc as ServoArc; use style::logical_geometry::WritingMode; use style::properties::ComputedValues; @@ -27,7 +28,7 @@ mod layout; /// A structure to hold the configuration of a flex container for use during layout /// and preferred width calculation. -#[derive(Clone, Debug)] +#[derive(Clone, Debug, MallocSizeOf)] pub(crate) struct FlexContainerConfig { container_is_single_line: bool, writing_mode: WritingMode, @@ -85,10 +86,11 @@ impl FlexContainerConfig { } } -#[derive(Debug)] +#[derive(Debug, MallocSizeOf)] pub(crate) struct FlexContainer { children: Vec<ArcRefCell<FlexLevelBox>>, + #[conditional_malloc_size_of] style: ServoArc<ComputedValues>, /// The configuration of this [`FlexContainer`]. @@ -137,7 +139,7 @@ impl FlexContainer { } } -#[derive(Debug)] +#[derive(Debug, MallocSizeOf)] pub(crate) enum FlexLevelBox { FlexItem(FlexItemBox), OutOfFlowAbsolutelyPositionedBox(ArcRefCell<AbsolutelyPositionedBox>), @@ -171,6 +173,7 @@ impl FlexLevelBox { } } +#[derive(MallocSizeOf)] pub(crate) struct FlexItemBox { independent_formatting_context: IndependentFormattingContext, } |