Bug 263096

Summary: Add a ProcessAssertion cache
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebKit2Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: kkinnunen, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Chris Dumez 2023-10-12 16:48:37 PDT
Add a ProcessAssertion cache to avoid hammering RunningBoard when switching quickly from one assertion type to another (e.g. background <-> foreground).
Taking RunningBoard assertions is expensive and this churn can result in high CPU usage.

We have evidence this can happen for example when we're holding a background assertion on the WebProcess but the client app keeps running JS in the view, causing us to take a foreground assertion for each JS execution request.

We now keep previous assertions around for 3 seconds when switching from one assertion type to another and we reuse them when possible.
Comment 1 Chris Dumez 2023-10-12 16:48:45 PDT
<rdar://113579564>
Comment 2 Chris Dumez 2023-10-12 16:51:08 PDT
Pull request: https://github.com/WebKit/WebKit/pull/19027
Comment 3 EWS 2023-10-13 14:55:53 PDT
Committed 269319@main (f6fade6a9e36): <https://commits.webkit.org/269319@main>

Reviewed commits have been landed. Closing PR #19027 and removing active labels.