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

@ -7,7 +7,7 @@ use std::collections::hash_map::{Entry, Values, ValuesMut};
use base::id::WebViewId;
use crate::webview_renderer::UnknownWebView;
use crate::webview_renderer::{UnknownWebView, WebViewRenderer};
#[derive(Debug)]
pub struct WebViewManager<WebView> {
@ -109,6 +109,17 @@ impl<WebView> WebViewManager<WebView> {
}
}
impl WebViewManager<WebViewRenderer> {
pub(crate) fn scroll_trees_memory_usage(
&self,
ops: &mut malloc_size_of::MallocSizeOfOps,
) -> usize {
self.iter()
.map(|renderer| renderer.scroll_trees_memory_usage(ops))
.sum::<usize>()
}
}
#[cfg(test)]
mod test {
use base::id::{BrowsingContextId, Index, PipelineNamespace, PipelineNamespaceId, WebViewId};