Separate entry decoding from validation
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Mar 2015 20:59:18 +0000 (20:59 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Mar 2015 20:59:18 +0000 (20:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=143052

Reviewed by Chris Dumez.

Make NetworkCache::Cache a class and move it to a file of its own.
Move the encoding/decoding code there.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::fetchDiskCacheEntries):
(WebKit::clearDiskCacheEntries):
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::sendReplyToSynchronousRequest):
(WebKit::NetworkResourceLoader::start):
(WebKit::NetworkResourceLoader::sendBufferMaybeAborting):
(WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
(WebKit::NetworkResourceLoader::validateCacheEntry):
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::collectVaryingRequestHeaders):
(WebKit::NetworkCache::canUse):

    Focused function for deciding if we can use a cache entry and if it needs validation.

(WebKit::NetworkCache::Cache::retrieve):
(WebKit::NetworkCache::Cache::store):
(WebKit::NetworkCache::Cache::update):
(WebKit::NetworkCache::Cache::traverse):
(WebKit::NetworkCache::encodeStorageEntry): Deleted.
(WebKit::NetworkCache::decodeStorageEntry): Deleted.
* NetworkProcess/cache/NetworkCache.h:
* NetworkProcess/cache/NetworkCacheEntry.cpp: Added.
(WebKit::NetworkCache::Entry::Entry):
(WebKit::NetworkCache::Entry::encode):
(WebKit::NetworkCache::Entry::decode):
(WebKit::NetworkCache::Entry::initializeBufferFromStorageEntry):
(WebKit::NetworkCache::Entry::buffer):
(WebKit::NetworkCache::Entry::shareableResourceHandle):
(WebKit::NetworkCache::Entry::needsValidation):
(WebKit::NetworkCache::Entry::setNeedsValidation):
* NetworkProcess/cache/NetworkCacheEntry.h: Added.
(WebKit::NetworkCache::Entry::key):
(WebKit::NetworkCache::Entry::timeStamp):
(WebKit::NetworkCache::Entry::response):
(WebKit::NetworkCache::Entry::varyingRequestHeaders):
(WebKit::NetworkCache::Entry::sourceStorageEntry):
* NetworkProcess/cache/NetworkCacheStatistics.h:
* NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm:
(WebKit::NetworkCache::cachedEntryReuseFailureToDiagnosticKey):
(WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry):
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181970 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/NetworkProcess.cpp
Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp
Source/WebKit2/NetworkProcess/NetworkResourceLoader.h
Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp
Source/WebKit2/NetworkProcess/cache/NetworkCache.h
Source/WebKit2/NetworkProcess/cache/NetworkCacheEntry.cpp [new file with mode: 0644]
Source/WebKit2/NetworkProcess/cache/NetworkCacheEntry.h [new file with mode: 0644]
Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.h
Source/WebKit2/NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

index 7bfce46..c55f12a 100644 (file)
@@ -1,3 +1,57 @@
+2015-03-25  Antti Koivisto  <antti@apple.com>
+
+        Separate entry decoding from validation
+        https://bugs.webkit.org/show_bug.cgi?id=143052
+
+        Reviewed by Chris Dumez.
+
+        Make NetworkCache::Cache a class and move it to a file of its own.
+        Move the encoding/decoding code there.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::fetchDiskCacheEntries):
+        (WebKit::clearDiskCacheEntries):
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::sendReplyToSynchronousRequest):
+        (WebKit::NetworkResourceLoader::start):
+        (WebKit::NetworkResourceLoader::sendBufferMaybeAborting):
+        (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
+        (WebKit::NetworkResourceLoader::validateCacheEntry):
+        * NetworkProcess/NetworkResourceLoader.h:
+        * NetworkProcess/cache/NetworkCache.cpp:
+        (WebKit::NetworkCache::collectVaryingRequestHeaders):
+        (WebKit::NetworkCache::canUse):
+
+            Focused function for deciding if we can use a cache entry and if it needs validation.
+
+        (WebKit::NetworkCache::Cache::retrieve):
+        (WebKit::NetworkCache::Cache::store):
+        (WebKit::NetworkCache::Cache::update):
+        (WebKit::NetworkCache::Cache::traverse):
+        (WebKit::NetworkCache::encodeStorageEntry): Deleted.
+        (WebKit::NetworkCache::decodeStorageEntry): Deleted.
+        * NetworkProcess/cache/NetworkCache.h:
+        * NetworkProcess/cache/NetworkCacheEntry.cpp: Added.
+        (WebKit::NetworkCache::Entry::Entry):
+        (WebKit::NetworkCache::Entry::encode):
+        (WebKit::NetworkCache::Entry::decode):
+        (WebKit::NetworkCache::Entry::initializeBufferFromStorageEntry):
+        (WebKit::NetworkCache::Entry::buffer):
+        (WebKit::NetworkCache::Entry::shareableResourceHandle):
+        (WebKit::NetworkCache::Entry::needsValidation):
+        (WebKit::NetworkCache::Entry::setNeedsValidation):
+        * NetworkProcess/cache/NetworkCacheEntry.h: Added.
+        (WebKit::NetworkCache::Entry::key):
+        (WebKit::NetworkCache::Entry::timeStamp):
+        (WebKit::NetworkCache::Entry::response):
+        (WebKit::NetworkCache::Entry::varyingRequestHeaders):
+        (WebKit::NetworkCache::Entry::sourceStorageEntry):
+        * NetworkProcess/cache/NetworkCacheStatistics.h:
+        * NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm:
+        (WebKit::NetworkCache::cachedEntryReuseFailureToDiagnosticKey):
+        (WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry):
+        * WebKit2.xcodeproj/project.pbxproj:
+
 2015-03-25  David Hyatt  <hyatt@apple.com>
 
         Add a pref to enable the new block-inside-inline model
index 4e4914b..9f27e04 100644 (file)
@@ -287,7 +287,7 @@ static void fetchDiskCacheEntries(SessionID sessionID, std::function<void (Vecto
                 return;
             }
 
-            origins->add(SecurityOrigin::create(entry->response.url()));
+            origins->add(SecurityOrigin::create(entry->response().url()));
         });
 
         return;
@@ -379,8 +379,8 @@ static void clearDiskCacheEntries(const Vector<SecurityOriginData>& origins, std
         NetworkCache::singleton().traverse([completionHandler, originsToDelete, cacheKeysToDelete](const NetworkCache::Entry *entry) {
 
             if (entry) {
-                if (originsToDelete->contains(SecurityOrigin::create(entry->response.url())))
-                    cacheKeysToDelete->append(entry->storageEntry.key);
+                if (originsToDelete->contains(SecurityOrigin::create(entry->response().url())))
+                    cacheKeysToDelete->append(entry->key());
                 return;
             }
 
index e1c9a57..93f8581 100644 (file)
@@ -69,7 +69,7 @@ struct NetworkResourceLoader::SynchronousLoadData {
     WebCore::ResourceError error;
 };
 
-static void sendReplyToSynchronousRequest(NetworkResourceLoader::SynchronousLoadData& data, WebCore::SharedBuffer* buffer)
+static void sendReplyToSynchronousRequest(NetworkResourceLoader::SynchronousLoadData& data, const WebCore::SharedBuffer* buffer)
 {
     ASSERT(data.delayedReply);
     ASSERT(!data.response.isNull() || !data.error.isNull());
@@ -150,11 +150,11 @@ void NetworkResourceLoader::start()
             loader->startNetworkLoad();
             return;
         }
-        if (loader->m_parameters.needsCertificateInfo && !entry->response.containsCertificateInfo()) {
+        if (loader->m_parameters.needsCertificateInfo && !entry->response().containsCertificateInfo()) {
             loader->startNetworkLoad();
             return;
         }
-        if (entry->needsRevalidation) {
+        if (entry->needsValidation()) {
             loader->validateCacheEntry(WTF::move(entry));
             return;
         }
@@ -529,13 +529,13 @@ void NetworkResourceLoader::bufferingTimerFired()
     sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveData(dataReference, encodedLength));
 }
 
-bool NetworkResourceLoader::sendBufferMaybeAborting(WebCore::SharedBuffer& buffer, size_t encodedDataLength)
+bool NetworkResourceLoader::sendBufferMaybeAborting(const WebCore::SharedBuffer& buffer, size_t encodedDataLength)
 {
     ASSERT(!isSynchronous());
 
 #if PLATFORM(COCOA)
     ShareableResource::Handle shareableResourceHandle;
-    NetworkResourceLoader::tryGetShareableHandleFromSharedBuffer(shareableResourceHandle, buffer);
+    NetworkResourceLoader::tryGetShareableHandleFromSharedBuffer(shareableResourceHandle, const_cast<WebCore::SharedBuffer&>(buffer));
     if (!shareableResourceHandle.isNull()) {
         send(Messages::WebResourceLoader::DidReceiveResource(shareableResourceHandle, currentTime()));
         abort();
@@ -543,7 +543,7 @@ bool NetworkResourceLoader::sendBufferMaybeAborting(WebCore::SharedBuffer& buffe
     }
 #endif
 
-    IPC::SharedBufferDataReference dataReference(&buffer);
+    IPC::SharedBufferDataReference dataReference(&const_cast<WebCore::SharedBuffer&>(buffer));
     return sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveData(dataReference, encodedDataLength));
 }
 
@@ -551,17 +551,17 @@ bool NetworkResourceLoader::sendBufferMaybeAborting(WebCore::SharedBuffer& buffe
 void NetworkResourceLoader::didRetrieveCacheEntry(std::unique_ptr<NetworkCache::Entry> entry)
 {
     if (isSynchronous()) {
-        m_synchronousLoadData->response = entry->response;
-        sendReplyToSynchronousRequest(*m_synchronousLoadData, entry->buffer.get());
+        m_synchronousLoadData->response = entry->response();
+        sendReplyToSynchronousRequest(*m_synchronousLoadData, entry->buffer());
     } else {
-        sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveResponse(entry->response, m_parameters.isMainResource));
+        sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveResponse(entry->response(), m_parameters.isMainResource));
 
 #if ENABLE(SHAREABLE_RESOURCE)
-        if (!entry->shareableResourceHandle.isNull())
-            send(Messages::WebResourceLoader::DidReceiveResource(entry->shareableResourceHandle, currentTime()));
+        if (!entry->shareableResourceHandle().isNull())
+            send(Messages::WebResourceLoader::DidReceiveResource(entry->shareableResourceHandle(), currentTime()));
         else {
 #endif
-            bool shouldContinue = sendBufferMaybeAborting(*entry->buffer, entry->buffer->size());
+            bool shouldContinue = sendBufferMaybeAborting(*entry->buffer(), entry->buffer()->size());
             if (!shouldContinue)
                 return;
             send(Messages::WebResourceLoader::DidFinishResourceLoad(currentTime()));
@@ -577,8 +577,8 @@ void NetworkResourceLoader::validateCacheEntry(std::unique_ptr<NetworkCache::Ent
 {
     ASSERT(!m_handle);
 
-    String eTag = entry->response.httpHeaderField(WebCore::HTTPHeaderName::ETag);
-    String lastModified = entry->response.httpHeaderField(WebCore::HTTPHeaderName::LastModified);
+    String eTag = entry->response().httpHeaderField(WebCore::HTTPHeaderName::ETag);
+    String lastModified = entry->response().httpHeaderField(WebCore::HTTPHeaderName::LastModified);
     if (!eTag.isEmpty())
         m_currentRequest.setHTTPHeaderField(WebCore::HTTPHeaderName::IfNoneMatch, eTag);
     if (!lastModified.isEmpty())
index b512b68..ca94be6 100644 (file)
@@ -161,7 +161,7 @@ private:
 
     void startBufferingTimerIfNeeded();
     void bufferingTimerFired();
-    bool sendBufferMaybeAborting(WebCore::SharedBuffer&, size_t encodedDataLength);
+    bool sendBufferMaybeAborting(const WebCore::SharedBuffer&, size_t encodedDataLength);
 
     bool isSynchronous() const;
 
index 94a0f12..47ea599 100644 (file)
 #if ENABLE(NETWORK_CACHE)
 
 #include "Logging.h"
-#include "NetworkCacheCoders.h"
 #include "NetworkCacheStatistics.h"
 #include "NetworkCacheStorage.h"
-#include "NetworkResourceLoader.h"
-#include "WebCoreArgumentCoders.h"
-#include <JavaScriptCore/JSONObject.h>
 #include <WebCore/CacheValidation.h>
 #include <WebCore/FileSystem.h>
 #include <WebCore/HTTPHeaderNames.h>
 #include <WebCore/NetworkStorageSession.h>
 #include <WebCore/PlatformCookieJar.h>
+#include <WebCore/ResourceRequest.h>
 #include <WebCore/ResourceResponse.h>
 #include <WebCore/SharedBuffer.h>
 #include <wtf/NeverDestroyed.h>
-#include <wtf/StringHasher.h>
 #include <wtf/text/StringBuilder.h>
 
 #if PLATFORM(COCOA)
@@ -110,37 +106,21 @@ static String headerValueForVary(const WebCore::ResourceRequest& request, const
     return request.httpHeaderField(headerName);
 }
 
-static Storage::Entry encodeStorageEntry(const WebCore::ResourceRequest& request, const WebCore::ResourceResponse& response, PassRefPtr<WebCore::SharedBuffer> responseData)
+static Vector<std::pair<String, String>> collectVaryingRequestHeaders(const WebCore::ResourceRequest& request, const WebCore::ResourceResponse& response)
 {
-    Encoder encoder;
-    encoder << response;
-
     String varyValue = response.httpHeaderField(WebCore::HTTPHeaderName::Vary);
-    bool hasVaryingRequestHeaders = !varyValue.isEmpty();
-
-    encoder << hasVaryingRequestHeaders;
-
-    if (hasVaryingRequestHeaders) {
-        Vector<String> varyingHeaderNames;
-        varyValue.split(',', false, varyingHeaderNames);
-
-        Vector<std::pair<String, String>> varyingRequestHeaders;
-        for (auto& varyHeaderName : varyingHeaderNames) {
-            String headerName = varyHeaderName.stripWhiteSpace();
-            String headerValue = headerValueForVary(request, headerName);
-            varyingRequestHeaders.append(std::make_pair(headerName, headerValue));
-        }
-        encoder << varyingRequestHeaders;
+    if (varyValue.isEmpty())
+        return { };
+    Vector<String> varyingHeaderNames;
+    varyValue.split(',', /*allowEmptyEntries*/ false, varyingHeaderNames);
+    Vector<std::pair<String, String>> varyingRequestHeaders;
+    varyingRequestHeaders.reserveCapacity(varyingHeaderNames.size());
+    for (auto& varyHeaderName : varyingHeaderNames) {
+        String headerName = varyHeaderName.stripWhiteSpace();
+        String headerValue = headerValueForVary(request, headerName);
+        varyingRequestHeaders.append(std::make_pair(headerName, headerValue));
     }
-    encoder.encodeChecksum();
-
-    auto timeStamp = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch());
-    Data header(encoder.buffer(), encoder.bufferSize());
-    Data body;
-    if (responseData)
-        body = { reinterpret_cast<const uint8_t*>(responseData->data()), responseData->size() };
-
-    return { makeCacheKey(request), timeStamp, header, body };
+    return varyingRequestHeaders;
 }
 
 static bool verifyVaryingRequestHeaders(const Vector<std::pair<String, String>>& varyingRequestHeaders, const WebCore::ResourceRequest& request)
@@ -170,77 +150,29 @@ static bool cachePolicyAllowsExpired(WebCore::ResourceRequestCachePolicy policy)
     return false;
 }
 
-static std::unique_ptr<Entry> decodeStorageEntry(const Storage::Entry& storageEntry, const WebCore::ResourceRequest& request, CachedEntryReuseFailure& failure)
+static UseDecision canUse(const Entry& entry, const WebCore::ResourceRequest& request)
 {
-    Decoder decoder(storageEntry.header.data(), storageEntry.header.size());
-
-    WebCore::ResourceResponse cachedResponse;
-    if (!decoder.decode(cachedResponse)) {
-        LOG(NetworkCache, "(NetworkProcess) response decoding failed\n");
-        failure = CachedEntryReuseFailure::Other;
-        return nullptr;
-    }
-
-    bool hasVaryingRequestHeaders;
-    if (!decoder.decode(hasVaryingRequestHeaders)) {
-        failure = CachedEntryReuseFailure::Other;
-        return nullptr;
-    }
-
-    if (hasVaryingRequestHeaders) {
-        Vector<std::pair<String, String>> varyingRequestHeaders;
-        if (!decoder.decode(varyingRequestHeaders)) {
-            failure = CachedEntryReuseFailure::Other;
-            return nullptr;
-        }
-
-        if (!verifyVaryingRequestHeaders(varyingRequestHeaders, request)) {
-            LOG(NetworkCache, "(NetworkProcess) varying header mismatch\n");
-            failure = CachedEntryReuseFailure::VaryingHeaderMismatch;
-            return nullptr;
-        }
-    }
-    if (!decoder.verifyChecksum()) {
-        LOG(NetworkCache, "(NetworkProcess) checksum verification failure\n");
-        failure = CachedEntryReuseFailure::Other;
-        return nullptr;
+    if (!verifyVaryingRequestHeaders(entry.varyingRequestHeaders(), request)) {
+        LOG(NetworkCache, "(NetworkProcess) varying header mismatch\n");
+        return UseDecision::NoDueToVaryingHeaderMismatch;
     }
 
     bool allowExpired = cachePolicyAllowsExpired(request.cachePolicy());
-    auto timeStamp = std::chrono::duration_cast<std::chrono::duration<double>>(storageEntry.timeStamp);
-    double age = WebCore::computeCurrentAge(cachedResponse, timeStamp.count());
-    double lifetime = WebCore::computeFreshnessLifetimeForHTTPFamily(cachedResponse, timeStamp.count());
+    auto doubleTimeStamp = std::chrono::duration<double>(entry.timeStamp());
+    double age = WebCore::computeCurrentAge(entry.response(), doubleTimeStamp.count());
+    double lifetime = WebCore::computeFreshnessLifetimeForHTTPFamily(entry.response(), doubleTimeStamp.count());
     bool isExpired = age > lifetime;
     // We never revalidate in the case of a history navigation (i.e. allowExpired is true).
-    bool needsRevalidation = !allowExpired && (cachedResponse.cacheControlContainsNoCache() || isExpired);
-
-    if (needsRevalidation) {
-        bool hasValidatorFields = cachedResponse.hasCacheValidatorFields();
-        LOG(NetworkCache, "(NetworkProcess) needsRevalidation hasValidatorFields=%d isExpired=%d age=%f lifetime=%f", isExpired, hasValidatorFields, age, lifetime);
-        if (!hasValidatorFields) {
-            failure = CachedEntryReuseFailure::MissingValidatorFields;
-            return nullptr;
-        }
-    }
-
-    auto entry = std::make_unique<Entry>();
-    entry->storageEntry = storageEntry;
-    entry->needsRevalidation = needsRevalidation;
+    bool needsRevalidation = !allowExpired && (entry.response().cacheControlContainsNoCache() || isExpired);
+    if (!needsRevalidation)
+        return UseDecision::Use;
 
-    cachedResponse.setSource(needsRevalidation ? WebCore::ResourceResponse::Source::DiskCacheAfterValidation : WebCore::ResourceResponse::Source::DiskCache);
-    entry->response = cachedResponse;
-
-#if ENABLE(SHAREABLE_RESOURCE)
-    RefPtr<SharedMemory> sharedMemory = storageEntry.body.isMap() ? SharedMemory::createFromVMBuffer(const_cast<uint8_t*>(storageEntry.body.data()), storageEntry.body.size()) : nullptr;
-    RefPtr<ShareableResource> shareableResource = sharedMemory ? ShareableResource::create(sharedMemory.release(), 0, storageEntry.body.size()) : nullptr;
+    bool hasValidatorFields = entry.response().hasCacheValidatorFields();
+    LOG(NetworkCache, "(NetworkProcess) needsRevalidation hasValidatorFields=%d isExpired=%d age=%f lifetime=%f", isExpired, hasValidatorFields, age, lifetime);
+    if (!hasValidatorFields)
+        return UseDecision::NoDueToMissingValidatorFields;
 
-    if (shareableResource && shareableResource->createHandle(entry->shareableResourceHandle))
-        entry->buffer = entry->shareableResourceHandle.tryWrapInSharedBuffer();
-    else
-#endif
-        entry->buffer = WebCore::SharedBuffer::create(storageEntry.body.data(), storageEntry.body.size());
-
-    return entry;
+    return UseDecision::Validate;
 }
 
 static RetrieveDecision canRetrieve(const WebCore::ResourceRequest& request)
@@ -280,8 +212,8 @@ void Cache::retrieve(const WebCore::ResourceRequest& originalRequest, uint64_t w
     auto startTime = std::chrono::system_clock::now();
     unsigned priority = originalRequest.priority();
 
-    m_storage->retrieve(storageKey, priority, [this, originalRequest, completionHandler, startTime, storageKey, webPageID](std::unique_ptr<Storage::Entry> entry) {
-        if (!entry) {
+    m_storage->retrieve(storageKey, priority, [this, originalRequest, completionHandler, startTime, storageKey, webPageID](std::unique_ptr<Storage::Entry> storageEntry) {
+        if (!storageEntry) {
             LOG(NetworkCache, "(NetworkProcess) not found in storage");
 
             if (m_statistics)
@@ -290,20 +222,31 @@ void Cache::retrieve(const WebCore::ResourceRequest& originalRequest, uint64_t w
             completionHandler(nullptr);
             return false;
         }
-        ASSERT(entry->key == storageKey);
 
-        CachedEntryReuseFailure failure = CachedEntryReuseFailure::None;
-        auto decodedEntry = decodeStorageEntry(*entry, originalRequest, failure);
-        bool success = !!decodedEntry;
-        if (m_statistics)
-            m_statistics->recordRetrievedCachedEntry(webPageID, storageKey, originalRequest, failure);
+        ASSERT(storageEntry->key == storageKey);
+
+        auto cacheEntry = Entry::decode(*storageEntry);
+
+        auto useDecision = cacheEntry ? canUse(*cacheEntry, originalRequest) : UseDecision::NoDueToDecodeFailure;
+        switch (useDecision) {
+        case UseDecision::Use:
+            break;
+        case UseDecision::Validate:
+            cacheEntry->setNeedsValidation();
+            break;
+        default:
+            cacheEntry = nullptr;
+        };
 
 #if !LOG_DISABLED
         auto elapsedMS = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - startTime).count();
 #endif
-        LOG(NetworkCache, "(NetworkProcess) retrieve complete success=%d priority=%u time=%lldms", success, originalRequest.priority(), elapsedMS);
-        completionHandler(WTF::move(decodedEntry));
-        return success;
+        LOG(NetworkCache, "(NetworkProcess) retrieve complete useDecision=%d priority=%u time=%lldms", useDecision, originalRequest.priority(), elapsedMS);
+        completionHandler(WTF::move(cacheEntry));
+
+        if (m_statistics)
+            m_statistics->recordRetrievedCachedEntry(webPageID, storageKey, originalRequest, useDecision);
+        return useDecision != UseDecision::NoDueToDecodeFailure;
     });
 }
 
@@ -356,7 +299,9 @@ void Cache::store(const WebCore::ResourceRequest& originalRequest, const WebCore
         return;
     }
 
-    auto storageEntry = encodeStorageEntry(originalRequest, response, WTF::move(responseData));
+    Entry cacheEntry(makeCacheKey(originalRequest), response, WTF::move(responseData), collectVaryingRequestHeaders(originalRequest, response));
+
+    auto storageEntry = cacheEntry.encode();
 
     m_storage->store(storageEntry, [completionHandler](bool success, const Data& bodyData) {
         MappedBody mappedBody;
@@ -373,16 +318,18 @@ void Cache::store(const WebCore::ResourceRequest& originalRequest, const WebCore
     });
 }
 
-void Cache::update(const WebCore::ResourceRequest& originalRequest, const Entry& entry, const WebCore::ResourceResponse& validatingResponse)
+void Cache::update(const WebCore::ResourceRequest& originalRequest, const Entry& existingEntry, const WebCore::ResourceResponse& validatingResponse)
 {
     LOG(NetworkCache, "(NetworkProcess) updating %s", originalRequest.url().string().latin1().data());
 
-    WebCore::ResourceResponse response = entry.response;
+    WebCore::ResourceResponse response = existingEntry.response();
     WebCore::updateResponseHeadersAfterRevalidation(response, validatingResponse);
 
-    auto updateEntry = encodeStorageEntry(originalRequest, response, entry.buffer);
+    Entry updateEntry(existingEntry.key(), response, existingEntry.buffer(), collectVaryingRequestHeaders(originalRequest, response));
+
+    auto updateStorageEntry = updateEntry.encode();
 
-    m_storage->update(updateEntry, entry.storageEntry, [](bool success, const Data&) {
+    m_storage->update(updateStorageEntry, existingEntry.sourceStorageEntry(), [](bool success, const Data&) {
         LOG(NetworkCache, "(NetworkProcess) updated, success=%d", success);
     });
 }
@@ -398,20 +345,17 @@ void Cache::traverse(std::function<void (const Entry*)>&& traverseHandler)
 {
     ASSERT(isEnabled());
 
-    m_storage->traverse([traverseHandler](const Storage::Entry* entry) {
-        if (!entry) {
+    m_storage->traverse([traverseHandler](const Storage::Entry* storageEntry) {
+        if (!storageEntry) {
             traverseHandler(nullptr);
             return;
         }
 
-        Entry cacheEntry;
-        cacheEntry.storageEntry = *entry;
-
-        Decoder decoder(cacheEntry.storageEntry.header.data(), cacheEntry.storageEntry.header.size());
-        if (!decoder.decode(cacheEntry.response))
+        auto cacheEntry = Entry::decode(*storageEntry);
+        if (!cacheEntry)
             return;
 
-        traverseHandler(&cacheEntry);
+        traverseHandler(cacheEntry.get());
     });
 }
 
@@ -420,41 +364,6 @@ String Cache::dumpFilePath() const
     return WebCore::pathByAppendingComponent(m_storage->baseDirectoryPath(), "dump.json");
 }
 
-static bool entryAsJSON(StringBuilder& json, const Storage::Entry& entry)
-{
-    Decoder decoder(entry.header.data(), entry.header.size());
-    WebCore::ResourceResponse cachedResponse;
-    if (!decoder.decode(cachedResponse))
-        return false;
-    json.append("{\n");
-    json.append("\"hash\": ");
-    JSC::appendQuotedJSONStringToBuilder(json, entry.key.hashAsString());
-    json.append(",\n");
-    json.append("\"partition\": ");
-    JSC::appendQuotedJSONStringToBuilder(json, entry.key.partition());
-    json.append(",\n");
-    json.append("\"timestamp\": ");
-    json.appendNumber(entry.timeStamp.count());
-    json.append(",\n");
-    json.append("\"URL\": ");
-    JSC::appendQuotedJSONStringToBuilder(json, cachedResponse.url().string());
-    json.append(",\n");
-    json.append("\"headers\": {\n");
-    bool firstHeader = true;
-    for (auto& header : cachedResponse.httpHeaderFields()) {
-        if (!firstHeader)
-            json.append(",\n");
-        firstHeader = false;
-        json.append("    ");
-        JSC::appendQuotedJSONStringToBuilder(json, header.key);
-        json.append(": ");
-        JSC::appendQuotedJSONStringToBuilder(json, header.value);
-    }
-    json.append("\n}\n");
-    json.append("}");
-    return true;
-}
-
 void Cache::dumpContentsToFile()
 {
     if (!m_storage)
@@ -470,9 +379,11 @@ void Cache::dumpContentsToFile()
             WebCore::closeFile(handle);
             return;
         }
-        StringBuilder json;
-        if (!entryAsJSON(json, *entry))
+        auto cacheEntry = Entry::decode(*entry);
+        if (!cacheEntry)
             return;
+        StringBuilder json;
+        cacheEntry->asJSON(json);
         json.append(",\n");
         auto writeData = json.toString().utf8();
         WebCore::writeToFile(dumpFileHandle, writeData.data(), writeData.length());
index 35b9de3..335d61f 100644 (file)
@@ -28,6 +28,7 @@
 
 #if ENABLE(NETWORK_CACHE)
 
+#include "NetworkCacheEntry.h"
 #include "NetworkCacheStorage.h"
 #include "ShareableResource.h"
 #include <WebCore/ResourceResponse.h>
@@ -54,16 +55,6 @@ struct MappedBody {
 #endif
 };
 
-struct Entry {
-    Storage::Entry storageEntry;
-    WebCore::ResourceResponse response;
-    RefPtr<WebCore::SharedBuffer> buffer;
-#if ENABLE(SHAREABLE_RESOURCE)
-    ShareableResource::Handle shareableResourceHandle;
-#endif
-    bool needsRevalidation;
-};
-
 enum class RetrieveDecision {
     Yes,
     NoDueToHTTPMethod,
@@ -80,11 +71,12 @@ enum class StoreDecision {
     NoDueToHTTPStatusCode
 };
 
-enum class CachedEntryReuseFailure {
-    None,
-    VaryingHeaderMismatch,
-    MissingValidatorFields,
-    Other,
+enum class UseDecision {
+    Use,
+    Validate,
+    NoDueToVaryingHeaderMismatch,
+    NoDueToMissingValidatorFields,
+    NoDueToDecodeFailure,
 };
 
 class Cache {
diff --git a/Source/WebKit2/NetworkProcess/cache/NetworkCacheEntry.cpp b/Source/WebKit2/NetworkProcess/cache/NetworkCacheEntry.cpp
new file mode 100644 (file)
index 0000000..d019d8c
--- /dev/null
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "NetworkCache.h"
+
+#include "Logging.h"
+#include "NetworkCacheCoders.h"
+#include "NetworkCacheDecoder.h"
+#include "NetworkCacheEncoder.h"
+#include <JavaScriptCore/JSONObject.h>
+#include <WebCore/ResourceRequest.h>
+#include <WebCore/SharedBuffer.h>
+#include <wtf/text/StringBuilder.h>
+
+#if ENABLE(NETWORK_CACHE)
+
+namespace WebKit {
+namespace NetworkCache {
+
+Entry::Entry(const Key& key, const WebCore::ResourceResponse& response, RefPtr<WebCore::SharedBuffer>&& buffer, const Vector<std::pair<String, String>>& varyingRequestHeaders)
+    : m_key(key)
+    , m_timeStamp(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()))
+    , m_response(response)
+    , m_varyingRequestHeaders(varyingRequestHeaders)
+    , m_buffer(WTF::move(buffer))
+{
+}
+
+Entry::Entry(const Storage::Entry& storageEntry)
+    : m_key(storageEntry.key)
+    , m_timeStamp(storageEntry.timeStamp)
+    , m_sourceStorageEntry(storageEntry)
+{
+}
+
+Storage::Entry Entry::encode() const
+{
+    Encoder encoder;
+    encoder << m_response;
+
+    bool hasVaryingRequestHeaders = !m_varyingRequestHeaders.isEmpty();
+    encoder << hasVaryingRequestHeaders;
+    if (hasVaryingRequestHeaders)
+        encoder << m_varyingRequestHeaders;
+
+    encoder.encodeChecksum();
+
+    Data header(encoder.buffer(), encoder.bufferSize());
+    Data body;
+    if (m_buffer)
+        body = { reinterpret_cast<const uint8_t*>(m_buffer->data()), m_buffer->size() };
+
+    return { m_key, m_timeStamp, header, body };
+}
+
+std::unique_ptr<Entry> Entry::decode(const Storage::Entry& storageEntry)
+{
+    std::unique_ptr<Entry> entry(new Entry(storageEntry));
+
+    Decoder decoder(storageEntry.header.data(), storageEntry.header.size());
+    if (!decoder.decode(entry->m_response))
+        return nullptr;
+    entry->m_response.setSource(WebCore::ResourceResponse::Source::DiskCache);
+
+    bool hasVaryingRequestHeaders;
+    if (!decoder.decode(hasVaryingRequestHeaders))
+        return nullptr;
+
+    if (hasVaryingRequestHeaders) {
+        if (!decoder.decode(entry->m_varyingRequestHeaders))
+            return nullptr;
+    }
+
+    if (!decoder.verifyChecksum()) {
+        LOG(NetworkCache, "(NetworkProcess) checksum verification failure\n");
+        return nullptr;
+    }
+
+    return entry;
+}
+
+void Entry::initializeBufferFromStorageEntry() const
+{
+    auto* data = m_sourceStorageEntry.body.data();
+    size_t size = m_sourceStorageEntry.body.size();
+#if ENABLE(SHAREABLE_RESOURCE)
+    RefPtr<SharedMemory> sharedMemory = m_sourceStorageEntry.body.isMap() ? SharedMemory::createFromVMBuffer(const_cast<uint8_t*>(data), size) : nullptr;
+    RefPtr<ShareableResource> shareableResource = sharedMemory ? ShareableResource::create(sharedMemory.release(), 0, m_sourceStorageEntry.body.size()) : nullptr;
+
+    if (shareableResource && shareableResource->createHandle(m_shareableResourceHandle))
+        m_buffer = m_shareableResourceHandle.tryWrapInSharedBuffer();
+#endif
+    if (!m_buffer)
+        m_buffer = WebCore::SharedBuffer::create(data, size);
+}
+
+WebCore::SharedBuffer* Entry::buffer() const
+{
+    if (!m_buffer)
+        initializeBufferFromStorageEntry();
+
+    return m_buffer.get();
+}
+
+ShareableResource::Handle& Entry::shareableResourceHandle() const
+{
+    if (!m_buffer)
+        initializeBufferFromStorageEntry();
+
+    return m_shareableResourceHandle;
+}
+
+bool Entry::needsValidation() const
+{
+    return m_response.source() == WebCore::ResourceResponse::Source::DiskCacheAfterValidation;
+}
+
+void Entry::setNeedsValidation()
+{
+    ASSERT(m_response.source() == WebCore::ResourceResponse::Source::DiskCache);
+    m_response.setSource(WebCore::ResourceResponse::Source::DiskCacheAfterValidation);
+}
+
+void Entry::asJSON(StringBuilder& json) const
+{
+    json.appendLiteral("{\n");
+    json.appendLiteral("\"hash\": ");
+    JSC::appendQuotedJSONStringToBuilder(json, m_key.hashAsString());
+    json.appendLiteral(",\n");
+    json.appendLiteral("\"partition\": ");
+    JSC::appendQuotedJSONStringToBuilder(json, m_key.partition());
+    json.appendLiteral(",\n");
+    json.appendLiteral("\"timestamp\": ");
+    json.appendNumber(m_timeStamp.count());
+    json.appendLiteral(",\n");
+    json.appendLiteral("\"URL\": ");
+    JSC::appendQuotedJSONStringToBuilder(json, m_response.url().string());
+    json.appendLiteral(",\n");
+    json.appendLiteral("\"headers\": {\n");
+    bool firstHeader = true;
+    for (auto& header : m_response.httpHeaderFields()) {
+        if (!firstHeader)
+            json.appendLiteral(",\n");
+        firstHeader = false;
+        json.appendLiteral("    ");
+        JSC::appendQuotedJSONStringToBuilder(json, header.key);
+        json.appendLiteral(": ");
+        JSC::appendQuotedJSONStringToBuilder(json, header.value);
+    }
+    json.appendLiteral("\n}\n");
+    json.appendLiteral("}");
+}
+
+}
+}
+
+#endif
diff --git a/Source/WebKit2/NetworkProcess/cache/NetworkCacheEntry.h b/Source/WebKit2/NetworkProcess/cache/NetworkCacheEntry.h
new file mode 100644 (file)
index 0000000..0816ecd
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NetworkCacheEntry_h
+#define NetworkCacheEntry_h
+
+#if ENABLE(NETWORK_CACHE)
+
+#include "NetworkCacheStorage.h"
+#include "ShareableResource.h"
+#include <WebCore/ResourceResponse.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+class ResourceRequest;
+class SharedBuffer;
+}
+
+namespace WebKit {
+namespace NetworkCache {
+
+class Entry {
+    WTF_MAKE_NONCOPYABLE(Entry); WTF_MAKE_FAST_ALLOCATED;
+public:
+    Entry(const Key&, const WebCore::ResourceResponse&, RefPtr<WebCore::SharedBuffer>&&, const Vector<std::pair<String, String>>& varyingRequestHeaders);
+
+    Storage::Entry encode() const;
+    static std::unique_ptr<Entry> decode(const Storage::Entry&);
+
+    const Key& key() const { return m_key; }
+    std::chrono::milliseconds timeStamp() const { return m_timeStamp; }
+    const WebCore::ResourceResponse& response() const { return m_response; }
+    const Vector<std::pair<String, String>>& varyingRequestHeaders() const { return m_varyingRequestHeaders; }
+
+    WebCore::SharedBuffer* buffer() const;
+#if ENABLE(SHAREABLE_RESOURCE)
+    ShareableResource::Handle& shareableResourceHandle() const;
+#endif
+
+    bool needsValidation() const;
+    void setNeedsValidation();
+
+    const Storage::Entry& sourceStorageEntry() const { return m_sourceStorageEntry; }
+
+    void asJSON(StringBuilder&) const;
+
+private:
+    Entry(const Storage::Entry&);
+    void initializeBufferFromStorageEntry() const;
+
+    Key m_key;
+    std::chrono::milliseconds m_timeStamp;
+    WebCore::ResourceResponse m_response;
+    Vector<std::pair<String, String>> m_varyingRequestHeaders;
+
+    mutable RefPtr<WebCore::SharedBuffer> m_buffer;
+#if ENABLE(SHAREABLE_RESOURCE)
+    mutable ShareableResource::Handle m_shareableResourceHandle;
+#endif
+
+    Storage::Entry m_sourceStorageEntry { };
+};
+
+}
+}
+
+#endif
+#endif
index c491ef8..0b6a7fb 100644 (file)
@@ -51,7 +51,7 @@ public:
     void recordNotCachingResponse(const Key&, StoreDecision);
     void recordNotUsingCacheForRequest(uint64_t webPageID, const Key&, const WebCore::ResourceRequest&, RetrieveDecision);
     void recordRetrievalFailure(uint64_t webPageID, const Key&, const WebCore::ResourceRequest&);
-    void recordRetrievedCachedEntry(uint64_t webPageID, const Key&, const WebCore::ResourceRequest&, CachedEntryReuseFailure);
+    void recordRetrievedCachedEntry(uint64_t webPageID, const Key&, const WebCore::ResourceRequest&, UseDecision);
 
 private:
     explicit Statistics(const String& databasePath);
index b2d4e11..782d04a 100644 (file)
@@ -262,32 +262,33 @@ void Statistics::recordRetrievalFailure(uint64_t webPageID, const Key& key, cons
     });
 }
 
-static String cachedEntryReuseFailureToDiagnosticKey(CachedEntryReuseFailure failure)
+static String cachedEntryReuseFailureToDiagnosticKey(UseDecision decision)
 {
-    switch (failure) {
-    case CachedEntryReuseFailure::VaryingHeaderMismatch:
+    switch (decision) {
+    case UseDecision::NoDueToVaryingHeaderMismatch:
         return WebCore::DiagnosticLoggingKeys::varyingHeaderMismatchKey();
-    case CachedEntryReuseFailure::MissingValidatorFields:
+    case UseDecision::NoDueToMissingValidatorFields:
         return WebCore::DiagnosticLoggingKeys::missingValidatorFieldsKey();
-    case CachedEntryReuseFailure::Other:
+    case UseDecision::NoDueToDecodeFailure:
         return WebCore::DiagnosticLoggingKeys::otherKey();
-    case CachedEntryReuseFailure::None:
+    case UseDecision::Use:
+    case UseDecision::Validate:
         ASSERT_NOT_REACHED();
         break;
     }
     return emptyString();
 }
 
-void Statistics::recordRetrievedCachedEntry(uint64_t webPageID, const Key& key, const WebCore::ResourceRequest& request, CachedEntryReuseFailure failure)
+void Statistics::recordRetrievedCachedEntry(uint64_t webPageID, const Key& key, const WebCore::ResourceRequest& request, UseDecision decision)
 {
     WebCore::URL requestURL = request.url();
-    if (failure == CachedEntryReuseFailure::None) {
+    if (decision == UseDecision::Use || decision == UseDecision::Validate) {
         LOG(NetworkCache, "(NetworkProcess) webPageID %llu: %s is in the cache and is used", webPageID, requestURL.string().ascii().data());
         NetworkProcess::singleton().logDiagnosticMessageWithResult(webPageID, WebCore::DiagnosticLoggingKeys::networkCacheKey(), WebCore::DiagnosticLoggingKeys::retrievalKey(), WebCore::DiagnosticLoggingResultPass, WebCore::ShouldSample::Yes);
         return;
     }
 
-    String diagnosticKey = cachedEntryReuseFailureToDiagnosticKey(failure);
+    String diagnosticKey = cachedEntryReuseFailureToDiagnosticKey(decision);
     LOG(NetworkCache, "(NetworkProcess) webPageID %llu: %s is in the cache but wasn't used, reason: %s", webPageID, requestURL.string().ascii().data(), diagnosticKey.utf8().data());
     NetworkProcess::singleton().logDiagnosticMessageWithValue(webPageID, WebCore::DiagnosticLoggingKeys::networkCacheKey(), WebCore::DiagnosticLoggingKeys::unusableCachedEntryKey(), diagnosticKey, WebCore::ShouldSample::Yes);
 }
index 396ae23..7b16037 100644 (file)
                E1E552C516AE065F004ED653 /* SandboxInitializationParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = E1E552C316AE065E004ED653 /* SandboxInitializationParameters.h */; };
                E1EE53E311F8CFC000CCBEE4 /* InjectedBundlePageEditorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE53DC11F8CF9F00CCBEE4 /* InjectedBundlePageEditorClient.h */; };
                E1EE53E711F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE53E611F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp */; };
+               E413F59D1AC1ADC400345360 /* NetworkCacheEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = E413F59B1AC1ADB600345360 /* NetworkCacheEntry.h */; };
+               E413F59F1AC1AF9D00345360 /* NetworkCacheEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E413F59E1AC1AF9D00345360 /* NetworkCacheEntry.cpp */; };
                E42E060F1AA7523400B11699 /* NetworkCacheIOChannelCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = E42E060D1AA750E500B11699 /* NetworkCacheIOChannelCocoa.mm */; };
                E42E06101AA7523B00B11699 /* NetworkCacheIOChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = E42E060B1AA7440D00B11699 /* NetworkCacheIOChannel.h */; };
                E42E06121AA75ABD00B11699 /* NetworkCacheData.h in Headers */ = {isa = PBXBuildFile; fileRef = E42E06111AA75ABD00B11699 /* NetworkCacheData.h */; };
                E1EE53E611F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageEditorClient.cpp; sourceTree = "<group>"; };
                E1FEF39A190F76F300731658 /* com.apple.WebKit.Databases.sb.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = com.apple.WebKit.Databases.sb.in; sourceTree = "<group>"; };
                E1FEF39C190F791C00731658 /* DatabaseProcessIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DatabaseProcessIOS.mm; sourceTree = "<group>"; };
+               E413F59B1AC1ADB600345360 /* NetworkCacheEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkCacheEntry.h; sourceTree = "<group>"; };
+               E413F59E1AC1AF9D00345360 /* NetworkCacheEntry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkCacheEntry.cpp; sourceTree = "<group>"; };
                E42E060B1AA7440D00B11699 /* NetworkCacheIOChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkCacheIOChannel.h; sourceTree = "<group>"; };
                E42E060D1AA750E500B11699 /* NetworkCacheIOChannelCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkCacheIOChannelCocoa.mm; sourceTree = "<group>"; };
                E42E06111AA75ABD00B11699 /* NetworkCacheData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkCacheData.h; sourceTree = "<group>"; };
                                E489D2871A0A2DB80078C06A /* NetworkCacheDecoder.h */,
                                E489D2881A0A2DB80078C06A /* NetworkCacheEncoder.cpp */,
                                E489D2891A0A2DB80078C06A /* NetworkCacheEncoder.h */,
+                               E413F59E1AC1AF9D00345360 /* NetworkCacheEntry.cpp */,
+                               E413F59B1AC1ADB600345360 /* NetworkCacheEntry.h */,
                                834B250E1A831A8D00CFB150 /* NetworkCacheFileSystemPosix.h */,
                                E42E060B1AA7440D00B11699 /* NetworkCacheIOChannel.h */,
                                E42E060D1AA750E500B11699 /* NetworkCacheIOChannelCocoa.mm */,
                                1A4A9F3312B844E2008FE984 /* PluginQuirks.h in Headers */,
                                7CD622781739D863005BD7FF /* PluginSandboxProfile.h in Headers */,
                                1A6FB7AF11E64B6800DB1371 /* PluginView.h in Headers */,
+                               E413F59D1AC1ADC400345360 /* NetworkCacheEntry.h in Headers */,
                                E1CC1B9012D7EADF00625838 /* PrintInfo.h in Headers */,
                                86F9536518FF58F5001DB2EF /* ProcessAssertion.h in Headers */,
                                BC1A7C581136E19C00FB7167 /* ProcessLauncher.h in Headers */,
                                1A2D957012848564001EB962 /* ChildProcess.cpp in Sources */,
                                BC82837B16B36A4F00A278FE /* ChildProcessEntryPoint.mm in Sources */,
                                A7E93CED1925331100A1DC48 /* ChildProcessIOS.mm in Sources */,
+                               E413F59F1AC1AF9D00345360 /* NetworkCacheEntry.cpp in Sources */,
                                9F54F88F16488E87007DF81A /* ChildProcessMac.mm in Sources */,
                                E1513C66166EABB200149FCB /* ChildProcessProxy.cpp in Sources */,
                                1A2A4B0E1586A2240090C9E9 /* ColorSpaceData.mm in Sources */,