HasServiceWorkerRegistration bit should be sent when creating a new page
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Feb 2018 21:24:09 +0000 (21:24 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Feb 2018 21:24:09 +0000 (21:24 +0000)
commit90fb27ef21b9d8289f9e706e3d2b793a07171346
tree8153176229873c489a4513e816f5ef715999344b
parent7d32d67f1b4ff5c423a1b4d97a8295a2e1c24569
HasServiceWorkerRegistration bit should be sent when creating a new page
https://bugs.webkit.org/show_bug.cgi?id=182410

Patch by Youenn Fablet <youenn@apple.com> on 2018-02-06
Reviewed by Chris Dumez.

Source/WebCore:

Covered by new API test.

Changed the default value of service workers being registered to false.
Every page created in the process will be responsible to change the value to true,
at which time the value will be kept to true for the lifetime of the process.

* workers/service/ServiceWorkerProvider.h:

Source/WebKit:

Move the bit computation at page creation time.
This allows computing the bit based on the web site data store and not only on the pool configuration.
WebPage uses that bit to activate service worker registration matching for the whole process.

In case there is a service worker process proxy created, the bit is set to true by default.

Bit is computed by checking for database file presence.
This information is cached in a map for efficiency reasons and cleared when a service worker process proxy is created.

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::initializeWebPage):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
(WebKit::WebProcessPool::initializeNewWebProcess):
(WebKit::WebProcessPool::mayHaveRegisteredServiceWorkers):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_cpuLimit):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228188 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
Source/WebCore/ChangeLog
Source/WebCore/workers/service/ServiceWorkerProvider.cpp
Source/WebCore/workers/service/ServiceWorkerProvider.h
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPageCreationParameters.cpp
Source/WebKit/Shared/WebPageCreationParameters.h
Source/WebKit/Shared/WebProcessCreationParameters.cpp
Source/WebKit/Shared/WebProcessCreationParameters.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebProcess.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm