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
|
@ -4,6 +4,7 @@
|
|||
|
||||
//! <https://drafts.csswg.org/css-flexbox/#box-model>
|
||||
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use style::properties::longhands::flex_direction::computed_value::T as FlexDirection;
|
||||
|
||||
use crate::geom::{LogicalRect, LogicalSides, LogicalVec2};
|
||||
|
@ -67,7 +68,7 @@ impl<T> FlexRelativeSides<T> {
|
|||
|
||||
/// One of the two bits set by the `flex-direction` property
|
||||
/// (The other is "forward" v.s. reverse.)
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq)]
|
||||
pub(super) enum FlexAxis {
|
||||
/// The main axis is the inline axis of the container (not necessarily of flex items!),
|
||||
/// cross is block.
|
||||
|
@ -78,7 +79,7 @@ pub(super) enum FlexAxis {
|
|||
|
||||
/// Which flow-relative sides map to the main-start and cross-start sides, respectively.
|
||||
/// See <https://drafts.csswg.org/css-flexbox/#box-model>
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf)]
|
||||
pub(super) enum MainStartCrossStart {
|
||||
InlineStartBlockStart,
|
||||
InlineStartBlockEnd,
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue