Add memory reporting for public suffix list (#37049)

Plumbs in the memory reporting into resource_thread since that's where
the other user of the public suffix list (HSTS) reports.

Testing: Checked about:memory on servo.org

Signed-off-by: Sebastian C <sebsebmc@gmail.com>
This commit is contained in:
Sebastian C 2025-05-19 13:50:22 -05:00 committed by GitHub
parent ec448b1423
commit e7432cda09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 6 deletions

View file

@ -24,6 +24,7 @@ use log::{debug, trace, warn};
use malloc_size_of::MallocSizeOf;
use net_traits::blob_url_store::parse_blob_url;
use net_traits::filemanager_thread::FileTokenCheck;
use net_traits::pub_domains::public_suffix_list_size_of;
use net_traits::request::{Destination, RequestBuilder, RequestId};
use net_traits::response::{Response, ResponseInit};
use net_traits::storage_thread::StorageThreadMsg;
@ -287,11 +288,18 @@ impl ResourceChannelManager {
perform_memory_report(|ops| {
let mut reports = public_http_state.memory_reports("public", ops);
reports.extend(private_http_state.memory_reports("private", ops));
reports.push(Report {
path: path!["hsts-preload-list"],
kind: ReportKind::ExplicitJemallocHeapSize,
size: hsts::PRELOAD_LIST_ENTRIES.size_of(ops),
});
reports.extend(vec![
Report {
path: path!["hsts-preload-list"],
kind: ReportKind::ExplicitJemallocHeapSize,
size: hsts::PRELOAD_LIST_ENTRIES.size_of(ops),
},
Report {
path: path!["public-suffix-list"],
kind: ReportKind::ExplicitJemallocHeapSize,
size: public_suffix_list_size_of(ops),
},
]);
msg.send(ProcessReports::new(reports));
})
}