[iOS] Take process assertion to prevent the service worker process from getting suspended
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Dec 2017 18:13:47 +0000 (18:13 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Dec 2017 18:13:47 +0000 (18:13 +0000)
commita9d8f7bb3f22bb09c26094f21c370f81fbccd234
treed9fb6e131f32bb9768194aa683f943c716e81f3f
parent0e366578df374e228af7fc88442354e71216f6ec
[iOS] Take process assertion to prevent the service worker process from getting suspended
https://bugs.webkit.org/show_bug.cgi?id=180735

Reviewed by Brady Eidson.

Take process assertion to prevent the service worker process from getting suspended while
it is still needed. We use the same policy as for the network process, meaning that
unsuspended WebContent processes prevent the service worker process from getting suspended.

This patch still does not enable service workers on iOS. The demo at https://mdn.github.io/sw-test/
appears to work. However, things are not working as expected for mobile.twitter.com where I
see the fetches intercepted by the service worker fail when offline for some reason (unrelated
to process suspension).

* UIProcess/WebProcessPool.cpp:
(WebKit::m_foregroundWebProcessCounter):
(WebKit::m_backgroundWebProcessCounter):
(WebKit::WebProcessPool::ensureNetworkProcess):
(WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
(WebKit::WebProcessPool::disconnectProcess):
(WebKit::WebProcessPool::updateProcessAssertions):
(WebKit::WebProcessPool::reinstateNetworkProcessAssertionState):
* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didSetAssertionState):
* UIProcess/WebProcessProxy.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225850 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/UIProcess/WebProcessProxy.cpp
Source/WebKit/UIProcess/WebProcessProxy.h