Update cache header after revalidation without rewriting the body data
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Feb 2015 12:41:52 +0000 (12:41 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Feb 2015 12:41:52 +0000 (12:41 +0000)
commite943c5167238a517b31a05918d479eea523cb2ff
tree8fec63611138b02b5db770e1c2638c25ec57e6d6
parent2ed31923b88f6eb3b8b20d87e3c89fb02ee2d44b
Update cache header after revalidation without rewriting the body data
https://bugs.webkit.org/show_bug.cgi?id=141182

Reviewed by Andreas Kling.

Currently we just rewrite the entire entry after revalidation.

* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::decodeStorageEntry):

    Include the strorage entry to the cache response so we can more easily update it.

(WebKit::NetworkCache::update):

    Call the storage update function with the new and the exisiting storage entry.

* NetworkProcess/cache/NetworkCache.h:
* NetworkProcess/cache/NetworkCacheStorage.h:
* NetworkProcess/cache/NetworkCacheStorageCocoa.mm:
(WebKit::openFileForKey):

    Added an option for opening a file for writing without creating a new one.
    Renamed for clarity.

(WebKit::encodeEntryHeader):

    Separate header encoding to a function.

(WebKit::encodeEntry):
(WebKit::NetworkCacheStorage::dispatchRetrieveOperation):
(WebKit::NetworkCacheStorage::store):
(WebKit::NetworkCacheStorage::update):

    New update function.
    If the page-rounded header size would stay unchanged we can just write the new header over the old one.
    In the unlikely event it doesn't we rewrite the whole thing.

(WebKit::createIOChannelForKey): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp
Source/WebKit2/NetworkProcess/cache/NetworkCache.h
Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.h
Source/WebKit2/NetworkProcess/cache/NetworkCacheStorageCocoa.mm