Bug 259170

Summary: don't call deferNonVisibleProcessEearlyMemoryCleanupTimer from worker threads
Product: WebKit Reporter: Cameron McCormack (:heycam) <heycam>
Component: WebKit Process ModelAssignee: Cameron McCormack (:heycam) <heycam>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Cameron McCormack (:heycam)
Reported 2023-07-12 18:38:28 PDT
We call deferNonVisibleProcessEearlyMemoryCleanupTimer in RemoteResourceCacheProxy::recordNativeImageUse. The idea there is to avoid discarding decoded image data in background tabs if the background tab is drawing images, which might be some canvas work, or it could be other things like Safari taking a tab snapshot. If we didn't avoid this, we could thrash between discarding decoded data and redecoding. OffscreenCanvas can also draw images on worker threads, but deferNonVisibleProcessEearlyMemoryCleanupTimer is not safe to call from non-main threads. We can safely skip this call if we're not on the main thread: workers do not have access to images which are stored in the MemoryCache, so we are not at risk of discarding decoded image data that the worker will want to re-decode to draw.
Attachments
Cameron McCormack (:heycam)
Comment 1 2023-07-12 18:39:16 PDT
Cameron McCormack (:heycam)
Comment 2 2023-07-12 19:11:16 PDT
EWS
Comment 3 2023-07-12 21:53:02 PDT
Committed 266024@main (1ace3d3f33b2): <https://commits.webkit.org/266024@main> Reviewed commits have been landed. Closing PR #15805 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.