[Cache API] Unify WebCore and WebKit error handling
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Aug 2017 22:33:15 +0000 (22:33 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Aug 2017 22:33:15 +0000 (22:33 +0000)
commit8783f3444e8574b8d2ebb731d8adb0759af27303
treed865d28ff8716a5cdb34aca2ba9268fe2bf9b4e6
parent745e34caf786111aaa74fc358340d368a3d7bd82
[Cache API] Unify WebCore and WebKit error handling
https://bugs.webkit.org/show_bug.cgi?id=175902

Patch by Youenn Fablet <youenn@apple.com> on 2017-08-23
Reviewed by Alex Christensen.

Source/WebCore:

No change of behavior.

Introducing a DOMCache namespace enclosing structures, callbacks and function definitions
previously found in either WebCore::CacheStorageConnection or WebKit::CacheStorage.

Some previously used callbacks had no way to pass errors in WebCore while they had in WebKit.
Updated Cache, CacheStorage, CacheStorageConnection and WorkerCacheStorageConnection to deal with these potential errors.

* CMakeLists.txt:
* Modules/cache/Cache.cpp:
(WebCore::FetchTasksHandler::FetchTasksHandler):
(WebCore::FetchTasksHandler::records const):
(WebCore::FetchTasksHandler::addRecord):
(WebCore::Cache::addAll):
(WebCore::Cache::put):
(WebCore::Cache::retrieveRecords):
(WebCore::queryCacheMatch):
(WebCore::Cache::batchDeleteOperation):
(WebCore::toConnectionRecord):
(WebCore::Cache::batchPutOperation):
(WebCore::Cache::updateRecords):
* Modules/cache/Cache.h:
* Modules/cache/CacheStorage.cpp:
(WebCore::CacheStorage::retrieveCaches):
(WebCore::CacheStorage::open):
(WebCore::CacheStorage::remove):
* Modules/cache/CacheStorage.h:
* Modules/cache/CacheStorageConnection.cpp:
(WebCore::CacheStorageConnection::open):
(WebCore::CacheStorageConnection::remove):
(WebCore::CacheStorageConnection::retrieveCaches):
(WebCore::CacheStorageConnection::batchDeleteOperation):
(WebCore::CacheStorageConnection::batchPutOperation):
(WebCore::CacheStorageConnection::openOrRemoveCompleted):
(WebCore::CacheStorageConnection::updateCaches):
(WebCore::CacheStorageConnection::updateRecords):
(WebCore::CacheStorageConnection::deleteRecordsCompleted):
(WebCore::CacheStorageConnection::putRecordsCompleted):
* Modules/cache/CacheStorageConnection.h:
(WebCore::CacheStorageConnection::openCompleted):
(WebCore::CacheStorageConnection::removeCompleted):
(WebCore::CacheStorageConnection::doOpen):
(WebCore::CacheStorageConnection::doRemove):
(WebCore::CacheStorageConnection::doBatchDeleteOperation):
(WebCore::CacheStorageConnection::doBatchPutOperation):
* Modules/cache/WorkerCacheStorageConnection.cpp:
(WebCore::toCrossThreadRecordData):
(WebCore::fromCrossThreadRecordData):
(WebCore::WorkerCacheStorageConnection::doOpen):
(WebCore::WorkerCacheStorageConnection::doRemove):
(WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
(WebCore::recordsDataFromRecords):
(WebCore::recordsDataOrErrorFromRecords):
(WebCore::recordsFromRecordsData):
(WebCore::recordsOrErrorFromRecordsData):
(WebCore::WorkerCacheStorageConnection::doRetrieveRecords):
(WebCore::WorkerCacheStorageConnection::doBatchDeleteOperation):
(WebCore::WorkerCacheStorageConnection::doBatchPutOperation):
* Modules/cache/DOMCache.cpp: Added.
* Modules/cache/DOMCache.h: Added.
* Modules/cache/WorkerCacheStorageConnection.h:
* WebCore.xcodeproj/project.pbxproj:

Source/WebKit:

Removing all callbacks and error definitions from WebKit
and reusing DOMCache ones instead.

* NetworkProcess/cache/CacheStorage.h: Removed.
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::caches const):
(WebKit::CacheStorage::Engine::queryCache):
* NetworkProcess/cache/CacheStorageEngine.h:
* NetworkProcess/cache/CacheStorageEngineCache.h:
* NetworkProcess/cache/CacheStorageEngineConnection.cpp:
(WebKit::CacheStorageEngineConnection::open):
(WebKit::CacheStorageEngineConnection::remove):
(WebKit::CacheStorageEngineConnection::putRecords):
* NetworkProcess/cache/CacheStorageEngineConnection.h:
* NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<DOMCache::CacheInfo>::encode):
(IPC::ArgumentCoder<DOMCache::CacheInfo>::decode):
(IPC::ArgumentCoder<DOMCache::Record>::encode):
(IPC::ArgumentCoder<DOMCache::Record>::decode):
* Shared/WebCoreArgumentCoders.h:
* WebProcess/Cache/WebCacheStorageConnection.cpp:
(WebKit::WebCacheStorageConnection::doBatchPutOperation):
(WebKit::WebCacheStorageConnection::openCompleted):
(WebKit::WebCacheStorageConnection::removeCompleted):
(WebKit::WebCacheStorageConnection::updateCaches):
(WebKit::WebCacheStorageConnection::updateRecords):
(WebKit::WebCacheStorageConnection::deleteRecordsCompleted):
(WebKit::WebCacheStorageConnection::putRecordsCompleted):
* WebProcess/Cache/WebCacheStorageConnection.h:
* WebProcess/Cache/WebCacheStorageConnection.messages.in:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221112 268f45cc-cd09-0410-ab3c-d52691b4dbfc
25 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/cache/Cache.cpp
Source/WebCore/Modules/cache/Cache.h
Source/WebCore/Modules/cache/CacheStorage.cpp
Source/WebCore/Modules/cache/CacheStorageConnection.cpp
Source/WebCore/Modules/cache/CacheStorageConnection.h
Source/WebCore/Modules/cache/DOMCache.cpp [new file with mode: 0644]
Source/WebCore/Modules/cache/DOMCache.h [moved from Source/WebKit/NetworkProcess/cache/CacheStorage.h with 52% similarity]
Source/WebCore/Modules/cache/WorkerCacheStorageConnection.cpp
Source/WebCore/Modules/cache/WorkerCacheStorageConnection.h
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp
Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h
Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.h
Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.cpp
Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.h
Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.messages.in
Source/WebKit/Shared/WebCoreArgumentCoders.cpp
Source/WebKit/Shared/WebCoreArgumentCoders.h
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.cpp
Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.h
Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.messages.in