aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/layout_box_base.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/layout_box_base.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/layout_box_base.rs')
-rw-r--r--components/layout_2020/layout_box_base.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/components/layout_2020/layout_box_base.rs b/components/layout_2020/layout_box_base.rs
index 54f7575391c..71fbfdeced1 100644
--- a/components/layout_2020/layout_box_base.rs
+++ b/components/layout_2020/layout_box_base.rs
@@ -6,6 +6,7 @@ use std::fmt::{Debug, Formatter};
use app_units::Au;
use atomic_refcell::AtomicRefCell;
+use malloc_size_of_derive::MallocSizeOf;
use servo_arc::Arc;
use style::properties::ComputedValues;
@@ -23,8 +24,10 @@ use crate::{ConstraintSpace, ContainingBlockSize};
/// passes.
///
/// In the future, this will hold layout results to support incremental layout.
+#[derive(MallocSizeOf)]
pub(crate) struct LayoutBoxBase {
pub base_fragment_info: BaseFragmentInfo,
+ #[conditional_malloc_size_of]
pub style: Arc<ComputedValues>,
pub cached_inline_content_size:
AtomicRefCell<Option<Box<(SizeConstraint, InlineContentSizesResult)>>>,
@@ -95,7 +98,7 @@ impl Debug for LayoutBoxBase {
}
}
-#[derive(Clone)]
+#[derive(Clone, MallocSizeOf)]
pub(crate) struct CacheableLayoutResult {
pub fragments: Vec<Fragment>,
@@ -124,6 +127,7 @@ pub(crate) struct CacheableLayoutResult {
}
/// A collection of layout inputs and a cached layout result for a [`LayoutBoxBase`].
+#[derive(MallocSizeOf)]
pub(crate) struct CacheableLayoutResultAndInputs {
/// The [`CacheableLayoutResult`] for this layout.
pub result: CacheableLayoutResult,