Bug 259170 - don't call deferNonVisibleProcessEearlyMemoryCleanupTimer from worker threads
Summary: don't call deferNonVisibleProcessEearlyMemoryCleanupTimer from worker threads
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Process Model (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Cameron McCormack (:heycam)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-07-12 18:38 PDT by Cameron McCormack (:heycam)
Modified: 2023-07-12 21:53 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron McCormack (:heycam) 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.
Comment 1 Cameron McCormack (:heycam) 2023-07-12 18:39:16 PDT
rdar://110910174
Comment 2 Cameron McCormack (:heycam) 2023-07-12 19:11:16 PDT
Pull request: https://github.com/WebKit/WebKit/pull/15805
Comment 3 EWS 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.