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.
<rdar://113579564>
Pull request: https://github.com/WebKit/WebKit/pull/19027
Committed 269319@main (f6fade6a9e36): <https://commits.webkit.org/269319@main> Reviewed commits have been landed. Closing PR #19027 and removing active labels.