From 594c04dc7c75a0a1d0d860ea1234cad97c322620 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Thu, 17 Apr 2025 07:57:04 -0400 Subject: [PATCH] Report memory usage for image frames. (#36581) These changes make the image-cache memory reporter report much larger values after loading image-heavy pages. Testing: Manual testing on https://www.nist.gov/image-gallery Fixes: #36559 Signed-off-by: Josh Matthews --- components/malloc_size_of/lib.rs | 6 ++++++ components/pixels/lib.rs | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/components/malloc_size_of/lib.rs b/components/malloc_size_of/lib.rs index f2da13883b9..dbecc0da2c3 100644 --- a/components/malloc_size_of/lib.rs +++ b/components/malloc_size_of/lib.rs @@ -688,6 +688,12 @@ impl MallocSizeOf for ipc_channel::ipc::IpcSender { } } +impl MallocSizeOf for ipc_channel::ipc::IpcSharedMemory { + fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize { + self.len() + } +} + impl MallocSizeOf for accountable_refcell::RefCell { fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize { self.borrow().size_of(ops) diff --git a/components/pixels/lib.rs b/components/pixels/lib.rs index b327d401262..7cba060ec74 100644 --- a/components/pixels/lib.rs +++ b/components/pixels/lib.rs @@ -123,7 +123,6 @@ pub struct Image { pub width: u32, pub height: u32, pub format: PixelFormat, - #[ignore_malloc_size_of = "Defined in webrender_api"] pub id: Option, pub cors_status: CorsStatus, pub frames: Vec, @@ -132,7 +131,6 @@ pub struct Image { #[derive(Clone, Deserialize, MallocSizeOf, Serialize)] pub struct ImageFrame { pub delay: Option, - #[ignore_malloc_size_of = "Defined in ipc-channel"] pub bytes: IpcSharedMemory, pub width: u32, pub height: u32,