aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/flow/inline/inline_box.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2025-04-18 16:05:15 -0400
committerGitHub <noreply@github.com>2025-04-18 20:05:15 +0000
commitc787688afc873e78d9526809cf7d2cde689c0ae4 (patch)
treebf852fcac1370e251e5282c331227c13c7fbd3dd /components/layout_2020/flow/inline/inline_box.rs
parentadd8c51f4728fbafe56781670f9ae4b1a754e094 (diff)
downloadservo-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/flow/inline/inline_box.rs')
-rw-r--r--components/layout_2020/flow/inline/inline_box.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/components/layout_2020/flow/inline/inline_box.rs b/components/layout_2020/flow/inline/inline_box.rs
index 2eceae944f2..97398d6e708 100644
--- a/components/layout_2020/flow/inline/inline_box.rs
+++ b/components/layout_2020/flow/inline/inline_box.rs
@@ -6,6 +6,7 @@ use std::vec::IntoIter;
use app_units::Au;
use fonts::FontMetrics;
+use malloc_size_of_derive::MallocSizeOf;
use super::{InlineContainerState, InlineContainerStateFlags, inline_container_needs_strut};
use crate::ContainingBlock;
@@ -17,7 +18,7 @@ use crate::fragment_tree::BaseFragmentInfo;
use crate::layout_box_base::LayoutBoxBase;
use crate::style_ext::{LayoutStyle, PaddingBorderMargin};
-#[derive(Debug)]
+#[derive(Debug, MallocSizeOf)]
pub(crate) struct InlineBox {
pub base: LayoutBoxBase,
/// The identifier of this inline box in the containing [`super::InlineFormattingContext`].
@@ -56,7 +57,7 @@ impl InlineBox {
}
}
-#[derive(Debug, Default)]
+#[derive(Debug, Default, MallocSizeOf)]
pub(crate) struct InlineBoxes {
/// A collection of all inline boxes in a particular [`super::InlineFormattingContext`].
inline_boxes: Vec<ArcRefCell<InlineBox>>,
@@ -162,7 +163,7 @@ impl InlineBoxes {
}
}
-#[derive(Clone, Copy, Debug, PartialEq)]
+#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq)]
pub(super) enum InlineBoxTreePathToken {
Start(InlineBoxIdentifier),
End(InlineBoxIdentifier),
@@ -183,7 +184,7 @@ impl InlineBoxTreePathToken {
/// [`u32`] is used for the index, in order to save space. The value refers to the token
/// in the start tree data structure which can be fetched to find the actual index of
/// of the [`InlineBox`] in [`InlineBoxes::inline_boxes`].
-#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
+#[derive(Clone, Copy, Debug, Default, Eq, Hash, MallocSizeOf, PartialEq)]
pub(crate) struct InlineBoxIdentifier {
pub index_of_start_in_tree: u32,
pub index_in_inline_boxes: u32,