Close service worker database on network process suspension
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Apr 2019 23:37:17 +0000 (23:37 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Apr 2019 23:37:17 +0000 (23:37 +0000)
commitd8c61251fed13ab022b60bc8798500610451c686
tree2f22f218c865177456a193f1d11b07dbe1956d23
parent9582c7da2f8045983d12604f148baca10a8b06ef
Close service worker database on network process suspension
https://bugs.webkit.org/show_bug.cgi?id=196623
<rdar://problem/48930869>

Reviewed by Alex Christensen.

Source/WebCore:

Add suspend/resume support to SWServer.
On suspend, close the service worker database and stop pushing for changes.
On resume, push changes if needed.

* workers/service/server/RegistrationDatabase.cpp:
(WebCore::RegistrationDatabase::close):
* workers/service/server/RegistrationDatabase.h:
(WebCore::RegistrationDatabase::isClosed const): Deleted.
* workers/service/server/RegistrationStore.cpp:
(WebCore::RegistrationStore::closeDatabase):
* workers/service/server/RegistrationStore.cpp:
(WebCore::RegistrationStore::pushChangesToDatabase):
(WebCore::RegistrationStore::clearAll):
(WebCore::RegistrationStore::startSuspension):
(WebCore::RegistrationStore::endSuspension):
* workers/service/server/RegistrationStore.h:
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::startSuspension):
(WebCore::SWServer::endSuspension):
* workers/service/server/SWServer.h:

Source/WebKit:

Close service worker database when preparing to suspend.
On resume, push changes if any is needed.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::actualPrepareToSuspend):
(WebKit::NetworkProcess::cancelPrepareToSuspend):
(WebKit::NetworkProcess::processDidResume):
* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _sendNetworkProcessWillSuspendImminently]):
(-[WKProcessPool _sendNetworkProcessDidResume]):
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminently):
(WebKit::WebProcessPool::sendNetworkProcessDidResume):
* UIProcess/WebProcessPool.h:

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/workers/service/server/RegistrationDatabase.cpp
Source/WebCore/workers/service/server/RegistrationDatabase.h
Source/WebCore/workers/service/server/RegistrationStore.cpp
Source/WebCore/workers/service/server/RegistrationStore.h
Source/WebCore/workers/service/server/SWServer.cpp
Source/WebCore/workers/service/server/SWServer.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.h
Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h
Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm