Start writing ServiceWorker registrations to disk.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Dec 2017 00:41:14 +0000 (00:41 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Dec 2017 00:41:14 +0000 (00:41 +0000)
commit8ccae1f882ea79e8da11afdc4c21bb8e53da823d
tree5155a5851619115f002d642fcf44bd11058a64fd
parent261758f3cd7172dc817d791c756ad0ff7b8835d2
Start writing ServiceWorker registrations to disk.
https://bugs.webkit.org/show_bug.cgi?id=180488

Reviewed by Chris Dumez.

No new tests (No observable behavior change).

As registrations changes occurs, we now write them to disk.
We don't re-read them in yet.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:

* workers/service/ServiceWorkerRegistrationData.cpp:
(WebCore::ServiceWorkerRegistrationData::isolatedCopy const):
* workers/service/ServiceWorkerRegistrationData.h:
(WebCore::ServiceWorkerRegistrationData::encode const):
(WebCore::ServiceWorkerRegistrationData::decode):

* workers/service/ServiceWorkerRegistrationKey.cpp:
(WebCore::ServiceWorkerRegistrationKey::toDatabaseKey const):
* workers/service/ServiceWorkerRegistrationKey.h:

* workers/service/server/RegistrationDatabase.cpp: Added.
(WebCore::v1RecordsTableSchema):
(WebCore::v1RecordsTableSchemaAlternate):
(WebCore::databaseFilename):
(WebCore::RegistrationDatabase::RegistrationDatabase):
(WebCore::RegistrationDatabase::~RegistrationDatabase):
(WebCore::RegistrationDatabase::openSQLiteDatabase):
(WebCore::RegistrationDatabase::ensureValidRecordsTable):
(WebCore::updateViaCacheToString):
(WebCore::workerTypeToString):
(WebCore::RegistrationDatabase::pushChanges):
(WebCore::RegistrationDatabase::doPushChanges):
(WebCore::RegistrationDatabase::importRecords):
(WebCore::RegistrationDatabase::databaseFailedToOpen):
(WebCore::RegistrationDatabase::databaseOpenedAndRecordsImported):
* workers/service/server/RegistrationDatabase.h: Copied from Source/WebCore/workers/service/ServiceWorkerRegistrationData.cpp.
(WebCore::RegistrationDatabase::isClosed const):

* workers/service/server/RegistrationStore.cpp: Added.
(WebCore::RegistrationStore::RegistrationStore):
(WebCore::RegistrationStore::~RegistrationStore):
(WebCore::RegistrationStore::scheduleDatabasePushIfNecessary):
(WebCore::RegistrationStore::pushChangesToDatabase):
(WebCore::RegistrationStore::updateRegistration):
(WebCore::RegistrationStore::removeRegistration):
(WebCore::RegistrationStore::databaseFailedToOpen):
(WebCore::RegistrationStore::databaseOpenedAndRecordsImported):
* workers/service/server/RegistrationStore.h: Copied from Source/WebCore/workers/service/ServiceWorkerRegistrationData.cpp.

* workers/service/server/SWServer.cpp:
(WebCore::SWServer::removeRegistration):
(WebCore::SWServer::SWServer):
(WebCore::SWServer::updateWorker):
(WebCore::SWServer::installContextData):
* workers/service/server/SWServer.h:

* workers/service/server/SWServerRegistration.cpp:
(WebCore::SWServerRegistration::data const):
* workers/service/server/SWServerRegistration.h:
(WebCore::SWServerRegistration::setLastUpdateTime):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225610 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/workers/service/ServiceWorkerRegistrationData.cpp
Source/WebCore/workers/service/ServiceWorkerRegistrationData.h
Source/WebCore/workers/service/ServiceWorkerRegistrationKey.cpp
Source/WebCore/workers/service/ServiceWorkerRegistrationKey.h
Source/WebCore/workers/service/server/RegistrationDatabase.cpp [new file with mode: 0644]
Source/WebCore/workers/service/server/RegistrationDatabase.h [new file with mode: 0644]
Source/WebCore/workers/service/server/RegistrationStore.cpp [new file with mode: 0644]
Source/WebCore/workers/service/server/RegistrationStore.h [new file with mode: 0644]
Source/WebCore/workers/service/server/SWServer.cpp
Source/WebCore/workers/service/server/SWServer.h
Source/WebCore/workers/service/server/SWServerRegistration.cpp
Source/WebCore/workers/service/server/SWServerRegistration.h