Add scroll tree measurement in IOCompositor (#38922)

Adds a new memory report that aggregates the size of all scroll trees
from within all pipelines for each web view.

Testing: Acessing `about:memory`
Fixes: #38726

---------

Signed-off-by: criskell <96352451+criskell@users.noreply.github.com>
This commit is contained in:
criskell 2025-08-26 09:47:04 -03:00 committed by GitHub
parent 55be274777
commit 7339e2b421
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 38 additions and 3 deletions

View file

@ -22,6 +22,7 @@ use embedder_traits::{
use euclid::{Point2D, Scale, Vector2D};
use fnv::FnvHashSet;
use log::{debug, warn};
use malloc_size_of::MallocSizeOf;
use servo_geometry::DeviceIndependentPixel;
use style_traits::{CSSPixel, PinchZoomFactor};
use webrender_api::units::{DeviceIntPoint, DevicePixel, DevicePoint, DeviceRect, LayoutVector2D};
@ -1001,6 +1002,16 @@ impl WebViewRenderer {
));
self.viewport_description = Some(viewport_description);
}
pub(crate) fn scroll_trees_memory_usage(
&self,
ops: &mut malloc_size_of::MallocSizeOfOps,
) -> usize {
self.pipelines
.values()
.map(|pipeline| pipeline.scroll_tree.size_of(ops))
.sum::<usize>()
}
}
#[derive(Clone, Copy, Debug, PartialEq)]