Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 06fe365b16021e6ae0c4a3b66e5e8351de765902
      
https://github.com/WebKit/WebKit/commit/06fe365b16021e6ae0c4a3b66e5e8351de765902
  Author: Miguel Salinas <miguel_sali...@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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to