aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/fragment_tree/box_fragment.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/fragment_tree/box_fragment.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/fragment_tree/box_fragment.rs')
-rw-r--r--components/layout_2020/fragment_tree/box_fragment.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/components/layout_2020/fragment_tree/box_fragment.rs b/components/layout_2020/fragment_tree/box_fragment.rs
index d0c96b3ea03..30be154caf1 100644
--- a/components/layout_2020/fragment_tree/box_fragment.rs
+++ b/components/layout_2020/fragment_tree/box_fragment.rs
@@ -5,6 +5,7 @@
use app_units::Au;
use atomic_refcell::AtomicRefCell;
use base::print_tree::PrintTree;
+use malloc_size_of_derive::MallocSizeOf;
use servo_arc::Arc as ServoArc;
use style::Zero;
use style::computed_values::border_collapse::T as BorderCollapse;
@@ -24,6 +25,7 @@ use crate::table::SpecificTableGridInfo;
use crate::taffy::SpecificTaffyGridInfo;
/// Describes how a [`BoxFragment`] paints its background.
+#[derive(MallocSizeOf)]
pub(crate) enum BackgroundMode {
/// Draw the normal [`BoxFragment`] background as well as the extra backgrounds
/// based on the style and positioning rectangles in this data structure.
@@ -36,12 +38,14 @@ pub(crate) enum BackgroundMode {
Normal,
}
+#[derive(MallocSizeOf)]
pub(crate) struct ExtraBackground {
+ #[conditional_malloc_size_of]
pub style: ServoArc<ComputedValues>,
pub rect: PhysicalRect<Au>,
}
-#[derive(Clone, Debug)]
+#[derive(Clone, Debug, MallocSizeOf)]
pub(crate) enum SpecificLayoutInfo {
Grid(Box<SpecificTaffyGridInfo>),
TableCellWithCollapsedBorders,
@@ -49,9 +53,11 @@ pub(crate) enum SpecificLayoutInfo {
TableWrapper,
}
+#[derive(MallocSizeOf)]
pub(crate) struct BoxFragment {
pub base: BaseFragment,
+ #[conditional_malloc_size_of]
pub style: ServoArc<ComputedValues>,
pub children: Vec<Fragment>,