Overly aggressive timer throttling in service workers
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 May 2018 22:31:40 +0000 (22:31 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 May 2018 22:31:40 +0000 (22:31 +0000)
commit130bfce151a2c594737534073192ca4ef8aa9b53
tree9a68da027b6f3c98b5896eb793e1c6ebbc81808d
parentf3bb28c8fdd5ee364cdb537fff862bbcb2b12bbf
Overly aggressive timer throttling in service workers
https://bugs.webkit.org/show_bug.cgi?id=185575
<rdar://problem/40219038>

Reviewed by Geoff Garen.

After ~30 seconds, the system would put the service worker process in "App Nap",
causing its timers to get aggressively throttled. This happens because the
service worker processes are WebProcesses that have no visible WebPages.

To address the issue, we now disable process suppression for all service worker
processes. This causes those processes to construct a UserActivity which prevents
App Nap.

This patch also refactors the code a bit to avoid duplication. The ProcessSuppression
suppression logic in now all on ChildProcessProxy / ChildProcess.

* NetworkProcess/NetworkProcess.messages.in:
* PluginProcess/PluginProcess.messages.in:
* Shared/ChildProcess.messages.in:
* UIProcess/ChildProcessProxy.cpp:
(WebKit::ChildProcessProxy::setProcessSuppressionEnabled):
* UIProcess/ChildProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/mac/NetworkProcessProxyMac.mm: Removed.
* UIProcess/Plugins/PluginProcessProxy.h:
* UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
* UIProcess/ServiceWorkerProcessProxy.cpp:
(WebKit::ServiceWorkerProcessProxy::didFinishLaunching):
* UIProcess/ServiceWorkerProcessProxy.h:
* UIProcess/WebProcessProxy.h:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebProcess.messages.in:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231771 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkProcess.messages.in
Source/WebKit/PluginProcess/PluginProcess.messages.in
Source/WebKit/Shared/ChildProcess.messages.in
Source/WebKit/UIProcess/ChildProcessProxy.cpp
Source/WebKit/UIProcess/ChildProcessProxy.h
Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
Source/WebKit/UIProcess/Network/mac/NetworkProcessProxyMac.mm [deleted file]
Source/WebKit/UIProcess/Plugins/PluginProcessProxy.h
Source/WebKit/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp
Source/WebKit/UIProcess/ServiceWorkerProcessProxy.h
Source/WebKit/UIProcess/WebProcessProxy.h
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/WebProcess.messages.in