mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
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:
parent
ec448b1423
commit
e7432cda09
2 changed files with 20 additions and 6 deletions
|
@ -24,6 +24,7 @@ use log::{debug, trace, warn};
|
||||||
use malloc_size_of::MallocSizeOf;
|
use malloc_size_of::MallocSizeOf;
|
||||||
use net_traits::blob_url_store::parse_blob_url;
|
use net_traits::blob_url_store::parse_blob_url;
|
||||||
use net_traits::filemanager_thread::FileTokenCheck;
|
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::request::{Destination, RequestBuilder, RequestId};
|
||||||
use net_traits::response::{Response, ResponseInit};
|
use net_traits::response::{Response, ResponseInit};
|
||||||
use net_traits::storage_thread::StorageThreadMsg;
|
use net_traits::storage_thread::StorageThreadMsg;
|
||||||
|
@ -287,11 +288,18 @@ impl ResourceChannelManager {
|
||||||
perform_memory_report(|ops| {
|
perform_memory_report(|ops| {
|
||||||
let mut reports = public_http_state.memory_reports("public", ops);
|
let mut reports = public_http_state.memory_reports("public", ops);
|
||||||
reports.extend(private_http_state.memory_reports("private", ops));
|
reports.extend(private_http_state.memory_reports("private", ops));
|
||||||
reports.push(Report {
|
reports.extend(vec![
|
||||||
path: path!["hsts-preload-list"],
|
Report {
|
||||||
kind: ReportKind::ExplicitJemallocHeapSize,
|
path: path!["hsts-preload-list"],
|
||||||
size: hsts::PRELOAD_LIST_ENTRIES.size_of(ops),
|
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));
|
msg.send(ProcessReports::new(reports));
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,11 @@ use std::iter::FromIterator;
|
||||||
use std::sync::LazyLock;
|
use std::sync::LazyLock;
|
||||||
|
|
||||||
use embedder_traits::resources::{self, Resource};
|
use embedder_traits::resources::{self, Resource};
|
||||||
|
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||||
|
use malloc_size_of_derive::MallocSizeOf;
|
||||||
use servo_url::{Host, ImmutableOrigin, ServoUrl};
|
use servo_url::{Host, ImmutableOrigin, ServoUrl};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default)]
|
#[derive(Clone, Debug, Default, MallocSizeOf)]
|
||||||
pub struct PubDomainRules {
|
pub struct PubDomainRules {
|
||||||
rules: HashSet<String>,
|
rules: HashSet<String>,
|
||||||
wildcards: HashSet<String>,
|
wildcards: HashSet<String>,
|
||||||
|
@ -30,6 +32,10 @@ pub struct PubDomainRules {
|
||||||
|
|
||||||
static PUB_DOMAINS: LazyLock<PubDomainRules> = LazyLock::new(load_pub_domains);
|
static PUB_DOMAINS: LazyLock<PubDomainRules> = LazyLock::new(load_pub_domains);
|
||||||
|
|
||||||
|
pub fn public_suffix_list_size_of(ops: &mut MallocSizeOfOps) -> usize {
|
||||||
|
PUB_DOMAINS.size_of(ops)
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a> FromIterator<&'a str> for PubDomainRules {
|
impl<'a> FromIterator<&'a str> for PubDomainRules {
|
||||||
fn from_iter<T>(iter: T) -> Self
|
fn from_iter<T>(iter: T) -> Self
|
||||||
where
|
where
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue