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

@ -29,7 +29,9 @@ use euclid::{Point2D, Rect, Scale, Size2D, Transform3D};
use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory};
use log::{debug, info, trace, warn};
use pixels::{CorsStatus, ImageFrame, ImageMetadata, PixelFormat, RasterImage};
use profile_traits::mem::{ProcessReports, ProfilerRegistration, Report, ReportKind};
use profile_traits::mem::{
ProcessReports, ProfilerRegistration, Report, ReportKind, perform_memory_report,
};
use profile_traits::time::{self as profile_time, ProfilerCategory};
use profile_traits::{path, time_profile};
use servo_config::{opts, pref};
@ -421,7 +423,7 @@ impl IOCompositor {
let ops =
wr_malloc_size_of::MallocSizeOfOps::new(servo_allocator::usable_size, None);
let report = self.global.borrow().webrender_api.report_memory(ops);
let reports = vec![
let mut reports = vec![
Report {
path: path!["webrender", "fonts"],
kind: ReportKind::ExplicitJemallocHeapSize,
@ -438,6 +440,15 @@ impl IOCompositor {
size: report.display_list,
},
];
perform_memory_report(|ops| {
reports.push(Report {
path: path!["compositor", "scroll-tree"],
kind: ReportKind::ExplicitJemallocHeapSize,
size: self.webview_renderers.scroll_trees_memory_usage(ops),
});
});
sender.send(ProcessReports::new(reports));
},