Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b0259bf3dba0415fb969fba15169c1ec7646917a
      
https://github.com/WebKit/WebKit/commit/b0259bf3dba0415fb969fba15169c1ec7646917a
  Author: Ben Nham <n...@apple.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.h
    M Source/WebKit/Shared/WebPreferencesDefaultValues.cpp
    M Source/WebKit/Shared/WebPreferencesDefaultValues.h
    M Source/WebKit/UIProcess/WebProcessProxy.cpp
    M Source/WebKit/WebProcess/WebProcess.cpp
    M Source/WebKit/WebProcess/WebProcess.h
    M Source/WebKit/WebProcess/WebProcess.messages.in

  Log Message:
  -----------
  Don't wait 8 minutes to suspend background tabs on iOS
https://bugs.webkit.org/show_bug.cgi?id=265064
rdar://118578232

Reviewed by Chris Dumez.

Disable the NearSuspended state, which allows background WebContent processes 
to suspend immediately
rather than after 8 minutes.

To do this, we need to fix the heuristic in `prepareToDropLastAssertion`, which 
fires just before a
process task_suspends. Previously it was generally called after a process ended 
up in the process
cache. Now that we are calling it earlier, we want it to prevent clearing out 
the caches from
processes that might end up in the process cache in the future, so we have to 
consult
`canBeAddedToWebProcessCache` about that.

Another change is that the `SetIsInProcessCache` message might be sent while 
the process is
task_suspended. To fix this, change that message to one with an async reply 
handler so that it takes
out a background activity while the IPC is being handled.

Finally, the `WebProcess::releaseMemory` IPC handler was often causing the 
process to completely exit,
since it invokes the memory pressure handler, and the memory pressure handler 
exits if there are no
active pages in the process. This seems undesired (if the UIProcess really 
wanted to terminate the
WebProcess, it could just send the `AuxiliaryProcess::ShutDown` message). So we 
now suppress the
memory pressure handler called by `WebProcess::releaseMemory` from exiting the 
process.

* Source/WebKit/UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::setIsInProcessCache):
(WebKit::WebProcessProxy::prepareToDropLastAssertion):
* Source/WebKit/WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
(WebKit::WebProcess::setIsInProcessCache):
(WebKit::WebProcess::releaseMemory):
(WebKit::WebProcess::prepareToSuspend):
* Source/WebKit/WebProcess/WebProcess.h:
* Source/WebKit/WebProcess/WebProcess.messages.in:

Canonical link: https://commits.webkit.org/272937@main


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

Reply via email to