[webkit-changes] [WebKit/WebKit] 06fe36: [Cocoa] Prevent active background page processes f...
Miguel Salinas
noreply at github.com
Fri Feb 17 17:26:15 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 06fe365b16021e6ae0c4a3b66e5e8351de765902
https://github.com/WebKit/WebKit/commit/06fe365b16021e6ae0c4a3b66e5e8351de765902
Author: Miguel Salinas <miguel_salinas at apple.com>
Date: 2023-02-17 (Fri, 17 Feb 2023)
Changed paths:
M Source/WebKit/UIProcess/ProcessThrottler.cpp
M Source/WebKit/UIProcess/ProcessThrottler.h
M Source/WebKit/UIProcess/WebPageProxy.cpp
Log Message:
-----------
[Cocoa] Prevent active background page processes from suspending
https://bugs.webkit.org/show_bug.cgi?id=252415
rdar://105413250
Reviewed by Chris Dumez.
When a page is backgrounded we try to suspend its process if possible. When the
internal setting "Take WebKit:Suspended assertion..." is disabled, this will
cause the UI process to drop all of its process assertions on the web content
process, effectively making it un-schedulable. This means that pages which may
still be active will completely stop. This wasn't an issue before since the web
content process would still be schedulable because it was holding the
WebKit:Suspended assertion (this is very confusing since the WebKit:Suspended
process assertion actually _prevents_ suspension). Instead of dropping all
process assertions immediately upon being backgrounded, we should give the
page/process some time to be scheduled and if it performs any observable work
(e.g. changing document title text, sending a local notification, etc.) we
should delay suspending the process.
* Source/WebKit/UIProcess/ProcessThrottler.cpp:
(WebKit::ProcessThrottler::ProcessThrottler):
(WebKit::ProcessThrottler::assertionTypeForState):
(WebKit::ProcessThrottler::setThrottleState):
(WebKit::ProcessThrottler::updateThrottleStateIfNeeded):
(WebKit::ProcessThrottler::removeAllAssertionsTimerFired):
(WebKit::ProcessThrottler::setShouldTakeSuspendedAssertion):
(WebKit::ProcessThrottler::delaySuspension):
* Source/WebKit/UIProcess/ProcessThrottler.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didReceiveTitleForFrame):
(WebKit::WebPageProxy::showNotification):
Canonical link: https://commits.webkit.org/260482@main
More information about the webkit-changes
mailing list