Update CacheStorage caches only if it is updated
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Aug 2017 23:20:03 +0000 (23:20 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Aug 2017 23:20:03 +0000 (23:20 +0000)
commit20e2186ac254c0e7cfac01430b2f2e2d59488c29
treec0005264381ff852840704516af74357c5251dcd
parent5e45ce72b29be9dfd07895cb819693112ff452e6
Update CacheStorage caches only if it is updated
https://bugs.webkit.org/show_bug.cgi?id=176135

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

Source/WebCore:

Covered by existing tests.

When retrieving caches from the engine, CacheStorage gets an update counter.
When this counter is different from the previous received one, CacheStorage will update its cache list.
Otherwise it will skip this update step.

* Modules/cache/CacheStorage.cpp:
(WebCore::CacheStorage::retrieveCaches):
* Modules/cache/CacheStorage.h:
* Modules/cache/CacheStorageConnection.cpp:
(WebCore::CacheStorageConnection::retrieveCaches):
* Modules/cache/CacheStorageConnection.h:
(WebCore::CacheStorageConnection::doRetrieveCaches):
* Modules/cache/DOMCache.cpp:
(WebCore::DOMCache::CacheInfos::isolatedCopy):
* Modules/cache/DOMCache.h:
(WebCore::DOMCache::CacheInfos::encode const):
(WebCore::DOMCache::CacheInfos::decode):
* Modules/cache/WorkerCacheStorageConnection.cpp:
(WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
* Modules/cache/WorkerCacheStorageConnection.h:

Source/WebKit:

For each change to CacheStorageEngineCaches list of cache, CacheStorageEngineCaches increments a counter.
When sending the list of caches, CacheStorageEngineCaches will compare its counter with the one provided.
If they sare the same, CacheStorageEngineCaches will return nothing.
Otherwise it returns the whole list of caches.

* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::retrieveCaches):
* NetworkProcess/cache/CacheStorageEngine.h:
* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::Caches::initialize):
(WebKit::CacheStorage::Caches::open):
(WebKit::CacheStorage::Caches::remove):
(WebKit::CacheStorage::Caches::clearMemoryRepresentation):
(WebKit::CacheStorage::Caches::cacheInfos const):
* NetworkProcess/cache/CacheStorageEngineCaches.h:
(WebKit::CacheStorage::Caches::updateCounter const):
* NetworkProcess/cache/CacheStorageEngineConnection.cpp:
(WebKit::CacheStorageEngineConnection::caches):
* NetworkProcess/cache/CacheStorageEngineConnection.h:
* NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
* WebProcess/Cache/WebCacheStorageConnection.cpp:
(WebKit::WebCacheStorageConnection::doRetrieveCaches):
* WebProcess/Cache/WebCacheStorageConnection.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221454 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/cache/CacheStorage.cpp
Source/WebCore/Modules/cache/CacheStorage.h
Source/WebCore/Modules/cache/CacheStorageConnection.cpp
Source/WebCore/Modules/cache/CacheStorageConnection.h
Source/WebCore/Modules/cache/DOMCache.cpp
Source/WebCore/Modules/cache/DOMCache.h
Source/WebCore/Modules/cache/WorkerCacheStorageConnection.cpp
Source/WebCore/Modules/cache/WorkerCacheStorageConnection.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp
Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h
Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp
Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.h
Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.cpp
Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.h
Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.messages.in
Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.cpp
Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.h