Bug 187964

Summary: ImageBitmap should report its memory cost
Product: WebKit Reporter: Zan Dobersek <zan>
Component: CanvasAssignee: Kimmo Kinnunen <kkinnunen>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, changseok, dino, esprehn+autocc, ews-watchlist, gyuyoung.kim, kkinnunen, kondapallykalyan, Ms2ger, sabouhallawa, simon.fraser, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=232139
https://bugs.webkit.org/show_bug.cgi?id=232357
Bug Depends on:    
Bug Blocks: 229825    
Attachments:
Description Flags
Patch
none
Patch none

Description Zan Dobersek 2018-07-24 10:53:17 PDT
ImageBitmap should report its memory cost
Comment 1 Zan Dobersek 2018-07-24 10:59:52 PDT
Created attachment 345690 [details]
Patch
Comment 2 Simon Fraser (smfr) 2018-07-24 16:00:59 PDT
Comment on attachment 345690 [details]
Patch

This should be testable somehow, right?
Comment 3 Zan Dobersek 2018-07-25 10:53:05 PDT
(In reply to Simon Fraser (smfr) from comment #2)
> Comment on attachment 345690 [details]
> Patch
> 
> This should be testable somehow, right?

I don't know, I can't find a comparable test for e.g. HTMLCanvasElement.

The changes here primarily increase the reported memory cost of ImageBitmap objects, bringing down the delay in which GC is triggered. This helps destroying stale ImageBitmaps and underlying pixel data. Any pointers about how to test this are welcome.
Comment 4 Kimmo Kinnunen 2021-10-22 03:40:41 PDT
Created attachment 442145 [details]
Patch
Comment 5 Kimmo Kinnunen 2021-10-22 03:44:26 PDT
Taking the liberty to taking the bug, feel free to comment if you disagree.

For the test I could only find internals.memoryInfo() but didn't feel confident it was working since none of the tests use it..
I can add the test but I uploaded the patch if it's useful for bug 232139
Comment 6 Radar WebKit Bug Importer 2021-10-22 07:11:58 PDT
<rdar://problem/84548359>
Comment 7 EWS 2021-10-24 23:47:57 PDT
Committed r284772 (243481@main): <https://commits.webkit.org/243481@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 442145 [details].