Add diagnostic logging to measure speculative revalidation accuracy
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Dec 2015 17:39:46 +0000 (17:39 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Dec 2015 17:39:46 +0000 (17:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151953
<rdar://problem/23092196>

Reviewed by Darin Adler.

Source/WebCore:

Add diagnostic logging to measure speculative revalidation accuracy.

* page/DiagnosticLoggingKeys.cpp:
(WebCore::DiagnosticLoggingKeys::entryRightlyNotWarmedUpKey):
(WebCore::DiagnosticLoggingKeys::entryWronglyNotWarmedUpKey):
(WebCore::DiagnosticLoggingKeys::successfulSpeculativeWarmupWithRevalidationKey):
(WebCore::DiagnosticLoggingKeys::successfulSpeculativeWarmupWithoutRevalidationKey):
(WebCore::DiagnosticLoggingKeys::unknownEntryRequestKey):
(WebCore::DiagnosticLoggingKeys::wastedSpeculativeWarmupWithRevalidationKey):
(WebCore::DiagnosticLoggingKeys::wastedSpeculativeWarmupWithoutRevalidationKey):
* page/DiagnosticLoggingKeys.h:

Source/WebKit2:

We track the following:
1. Resources we knew about AND did not get requested
   A. We did not speculate (Good)
   B. We speculated but did not go to network (Bad)
   C. We speculated and went to network (Very bad)
2. Resources we did not know about (Neutral)
3. Resources we knew about AND got requested
   A. We did not speculate (Bad)
   B. We speculated but did not go to network (Good)
   C. We speculated and went to network (Very good)

* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::Cache::retrieve):
* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
(WebKit::NetworkCache::allSpeculativeLoadingDiagnosticMessages):
(WebKit::NetworkCache::printSpeculativeLoadingDiagnosticMessageCounts):
(WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
(WebKit::NetworkCache::SpeculativeLoadManager::ExpiringEntry::ExpiringEntry):
(WebKit::NetworkCache::SpeculativeLoadManager::PreloadedEntry::PreloadedEntry):
(WebKit::NetworkCache::SpeculativeLoadManager::PreloadedEntry::wasRevalidated):
(WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::markLoadAsCompleted):
(WebKit::NetworkCache::SpeculativeLoadManager::retrieve):
(WebKit::NetworkCache::SpeculativeLoadManager::addPreloadedEntry):
(WebKit::NetworkCache::SpeculativeLoadManager::revalidateEntry):
(WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
(WebKit::NetworkCache::SpeculativeLoadManager::startSpeculativeRevalidation):
(WebKit::NetworkCache::makeSubresourcesKey): Deleted.
(WebKit::NetworkCache::constructRevalidationRequest): Deleted.
(WebKit::NetworkCache::responseNeedsRevalidation): Deleted.
(WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::saveToDiskIfReady): Deleted.
(WebKit::NetworkCache::SpeculativeLoadManager::retrieveEntryFromStorage): Deleted.
(WebKit::NetworkCache::SpeculativeLoadManager::satisfyPendingRequests): Deleted.
* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:

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

Source/WebCore/ChangeLog
Source/WebCore/page/DiagnosticLoggingKeys.cpp
Source/WebCore/page/DiagnosticLoggingKeys.h
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp
Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp
Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h

index 007821f..5795497 100644 (file)
@@ -1,3 +1,23 @@
+2015-12-08  Chris Dumez  <cdumez@apple.com>
+
+        Add diagnostic logging to measure speculative revalidation accuracy
+        https://bugs.webkit.org/show_bug.cgi?id=151953
+        <rdar://problem/23092196>
+
+        Reviewed by Darin Adler.
+
+        Add diagnostic logging to measure speculative revalidation accuracy.
+
+        * page/DiagnosticLoggingKeys.cpp:
+        (WebCore::DiagnosticLoggingKeys::entryRightlyNotWarmedUpKey):
+        (WebCore::DiagnosticLoggingKeys::entryWronglyNotWarmedUpKey):
+        (WebCore::DiagnosticLoggingKeys::successfulSpeculativeWarmupWithRevalidationKey):
+        (WebCore::DiagnosticLoggingKeys::successfulSpeculativeWarmupWithoutRevalidationKey):
+        (WebCore::DiagnosticLoggingKeys::unknownEntryRequestKey):
+        (WebCore::DiagnosticLoggingKeys::wastedSpeculativeWarmupWithRevalidationKey):
+        (WebCore::DiagnosticLoggingKeys::wastedSpeculativeWarmupWithoutRevalidationKey):
+        * page/DiagnosticLoggingKeys.h:
+
 2015-12-08  Brady Eidson  <beidson@apple.com>
 
         Modern IDB: storage/indexeddb/index-cursor.html fails.
index 97c5e85..1112c4c 100644 (file)
@@ -103,6 +103,16 @@ String DiagnosticLoggingKeys::engineFailedToLoadKey()
     return ASCIILiteral("engineFailedToLoad");
 }
 
+String DiagnosticLoggingKeys::entryRightlyNotWarmedUpKey()
+{
+    return ASCIILiteral("entryRightlyNotWarmedUp");
+}
+
+String DiagnosticLoggingKeys::entryWronglyNotWarmedUpKey()
+{
+    return ASCIILiteral("entryWronglyNotWarmedUp");
+}
+
 String DiagnosticLoggingKeys::navigationKey()
 {
     return ASCIILiteral("navigation");
@@ -418,6 +428,16 @@ String DiagnosticLoggingKeys::styleSheetKey()
     return ASCIILiteral("styleSheet");
 }
 
+String DiagnosticLoggingKeys::successfulSpeculativeWarmupWithRevalidationKey()
+{
+    return ASCIILiteral("successfulSpeculativeWarmupWithRevalidation");
+}
+
+String DiagnosticLoggingKeys::successfulSpeculativeWarmupWithoutRevalidationKey()
+{
+    return ASCIILiteral("successfulSpeculativeWarmupWithoutRevalidation");
+}
+
 String DiagnosticLoggingKeys::svgDocumentKey()
 {
     return ASCIILiteral("svgDocument");
@@ -433,6 +453,11 @@ String DiagnosticLoggingKeys::underMemoryPressureKey()
     return ASCIILiteral("underMemoryPressure");
 }
 
+String DiagnosticLoggingKeys::unknownEntryRequestKey()
+{
+    return ASCIILiteral("unknownEntryRequest");
+}
+
 String DiagnosticLoggingKeys::unlikelyToReuseKey()
 {
     return ASCIILiteral("unlikelyToReuse");
@@ -513,6 +538,16 @@ String DiagnosticLoggingKeys::videoKey()
     return ASCIILiteral("video");
 }
 
+String DiagnosticLoggingKeys::wastedSpeculativeWarmupWithRevalidationKey()
+{
+    return ASCIILiteral("wastedSpeculativeWarmupWithRevalidation");
+}
+
+String DiagnosticLoggingKeys::wastedSpeculativeWarmupWithoutRevalidationKey()
+{
+    return ASCIILiteral("wastedSpeculativeWarmupWithoutRevalidation");
+}
+
 String DiagnosticLoggingKeys::webViewKey()
 {
     return ASCIILiteral("webView");
index 7a54af5..1daa974 100644 (file)
@@ -48,6 +48,8 @@ public:
     static String diskCacheAfterValidationKey();
     static String documentLoaderStoppingKey();
     static String engineFailedToLoadKey();
+    WEBCORE_EXPORT static String entryRightlyNotWarmedUpKey();
+    WEBCORE_EXPORT static String entryWronglyNotWarmedUpKey();
     static String expiredKey();
     static String fontKey();
     static String hasPluginsKey();
@@ -115,9 +117,12 @@ public:
     static String sourceKey();
     WEBCORE_EXPORT static String streamingMedia();
     static String styleSheetKey();
+    WEBCORE_EXPORT static String successfulSpeculativeWarmupWithRevalidationKey();
+    WEBCORE_EXPORT static String successfulSpeculativeWarmupWithoutRevalidationKey();
     static String svgDocumentKey();
     WEBCORE_EXPORT static String uncacheableStatusCodeKey();
     static String underMemoryPressureKey();
+    WEBCORE_EXPORT static String unknownEntryRequestKey();
     WEBCORE_EXPORT static String unlikelyToReuseKey();
     WEBCORE_EXPORT static String unsupportedHTTPMethodKey();
     static String unsuspendableDOMObjectKey();
@@ -134,6 +139,8 @@ public:
     WEBCORE_EXPORT static String userKey();
     WEBCORE_EXPORT static String varyingHeaderMismatchKey();
     static String videoKey();
+    WEBCORE_EXPORT static String wastedSpeculativeWarmupWithRevalidationKey();
+    WEBCORE_EXPORT static String wastedSpeculativeWarmupWithoutRevalidationKey();
     WEBCORE_EXPORT static String webViewKey();
     WEBCORE_EXPORT static String zoomedKey();
 
index ffac503..1214346 100644 (file)
@@ -1,3 +1,45 @@
+2015-12-08  Chris Dumez  <cdumez@apple.com>
+
+        Add diagnostic logging to measure speculative revalidation accuracy
+        https://bugs.webkit.org/show_bug.cgi?id=151953
+        <rdar://problem/23092196>
+
+        Reviewed by Darin Adler.
+
+        We track the following:
+        1. Resources we knew about AND did not get requested
+           A. We did not speculate (Good)
+           B. We speculated but did not go to network (Bad)
+           C. We speculated and went to network (Very bad)
+        2. Resources we did not know about (Neutral)
+        3. Resources we knew about AND got requested
+           A. We did not speculate (Bad)
+           B. We speculated but did not go to network (Good)
+           C. We speculated and went to network (Very good)
+
+        * NetworkProcess/cache/NetworkCache.cpp:
+        (WebKit::NetworkCache::Cache::retrieve):
+        * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
+        (WebKit::NetworkCache::allSpeculativeLoadingDiagnosticMessages):
+        (WebKit::NetworkCache::printSpeculativeLoadingDiagnosticMessageCounts):
+        (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
+        (WebKit::NetworkCache::SpeculativeLoadManager::ExpiringEntry::ExpiringEntry):
+        (WebKit::NetworkCache::SpeculativeLoadManager::PreloadedEntry::PreloadedEntry):
+        (WebKit::NetworkCache::SpeculativeLoadManager::PreloadedEntry::wasRevalidated):
+        (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::markLoadAsCompleted):
+        (WebKit::NetworkCache::SpeculativeLoadManager::retrieve):
+        (WebKit::NetworkCache::SpeculativeLoadManager::addPreloadedEntry):
+        (WebKit::NetworkCache::SpeculativeLoadManager::revalidateEntry):
+        (WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
+        (WebKit::NetworkCache::SpeculativeLoadManager::startSpeculativeRevalidation):
+        (WebKit::NetworkCache::makeSubresourcesKey): Deleted.
+        (WebKit::NetworkCache::constructRevalidationRequest): Deleted.
+        (WebKit::NetworkCache::responseNeedsRevalidation): Deleted.
+        (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::saveToDiskIfReady): Deleted.
+        (WebKit::NetworkCache::SpeculativeLoadManager::retrieveEntryFromStorage): Deleted.
+        (WebKit::NetworkCache::SpeculativeLoadManager::satisfyPendingRequests): Deleted.
+        * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
+
 2015-12-08  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         [EFL] REGRESSION(r173394): MiniBrowser stucked in an infinite loop if NETWORK_CACHE is disabled
index 174b62a..8a4c884 100644 (file)
@@ -370,7 +370,7 @@ void Cache::retrieve(const WebCore::ResourceRequest& originalRequest, const Glob
     }
 
 #if ENABLE(NETWORK_CACHE_SPECULATIVE_REVALIDATION)
-    if (m_speculativeLoadManager && m_speculativeLoadManager->retrieve(storageKey, [originalRequest, completionHandler](std::unique_ptr<Entry> entry) {
+    if (m_speculativeLoadManager && m_speculativeLoadManager->retrieve(frameID, storageKey, [originalRequest, completionHandler](std::unique_ptr<Entry> entry) {
         if (entry && verifyVaryingRequestHeaders(entry->varyingRequestHeaders(), originalRequest))
             completionHandler(WTF::move(entry));
         else
index 4449668..fd33b47 100644 (file)
 #include "NetworkCacheEntry.h"
 #include "NetworkCacheSpeculativeLoad.h"
 #include "NetworkCacheSubresourcesEntry.h"
+#include "NetworkProcess.h"
+#include <WebCore/DiagnosticLoggingKeys.h>
 #include <WebCore/HysteresisActivity.h>
+#include <wtf/HashCountedSet.h>
 #include <wtf/NeverDestroyed.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RunLoop.h>
@@ -45,6 +48,30 @@ using namespace WebCore;
 
 static const auto preloadedEntryLifetime = 10_s;
 
+#if !LOG_DISABLED
+static HashCountedSet<String>& allSpeculativeLoadingDiagnosticMessages()
+{
+    static NeverDestroyed<HashCountedSet<String>> messages;
+    return messages;
+}
+
+static void printSpeculativeLoadingDiagnosticMessageCounts()
+{
+    LOG(NetworkCacheSpeculativePreloading, "-- Speculative loading statistics --");
+    for (auto& pair : allSpeculativeLoadingDiagnosticMessages())
+        LOG(NetworkCacheSpeculativePreloading, "%s: %u", pair.key.utf8().data(), pair.value);
+}
+#endif
+
+static void logSpeculativeLoadingDiagnosticMessage(const GlobalFrameID& frameID, const String& message)
+{
+#if !LOG_DISABLED
+    if (WebKit2LogNetworkCacheSpeculativePreloading.state == WTFLogChannelOn)
+        allSpeculativeLoadingDiagnosticMessages().add(message);
+#endif
+    NetworkProcess::singleton().logDiagnosticMessage(frameID.first, WebCore::DiagnosticLoggingKeys::networkCacheKey(), message, WebCore::ShouldSample::Yes);
+}
+
 static const AtomicString& subresourcesType()
 {
     ASSERT(RunLoop::isMain());
@@ -82,32 +109,39 @@ static bool responseNeedsRevalidation(const ResourceResponse& response, std::chr
     return age - lifetime > 0_ms;
 }
 
-class SpeculativeLoadManager::PreloadedEntry {
+class SpeculativeLoadManager::ExpiringEntry {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    PreloadedEntry(std::unique_ptr<Entry> entry, std::function<void()>&& lifetimeReachedHandler)
-        : m_entry(WTF::move(entry))
-        , m_lifetimeTimer(*this, &PreloadedEntry::lifetimeTimerFired)
-        , m_lifetimeReachedHandler(WTF::move(lifetimeReachedHandler))
+    explicit ExpiringEntry(std::function<void()>&& expirationHandler)
+        : m_lifetimeTimer(WTF::move(expirationHandler))
     {
         m_lifetimeTimer.startOneShot(preloadedEntryLifetime);
     }
 
+private:
+    Timer m_lifetimeTimer;
+};
+
+class SpeculativeLoadManager::PreloadedEntry : private ExpiringEntry {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    PreloadedEntry(std::unique_ptr<Entry> entry, WasRevalidated wasRevalidated, std::function<void()>&& lifetimeReachedHandler)
+        : ExpiringEntry(WTF::move(lifetimeReachedHandler))
+        , m_entry(WTF::move(entry))
+        , m_wasRevalidated(wasRevalidated == WasRevalidated::Yes)
+    { }
+
     std::unique_ptr<Entry> takeCacheEntry()
     {
         ASSERT(m_entry);
         return WTF::move(m_entry);
     }
 
-private:
-    void lifetimeTimerFired()
-    {
-        m_lifetimeReachedHandler();
-    }
+    bool wasRevalidated() const { return m_wasRevalidated; }
 
+private:
     std::unique_ptr<Entry> m_entry;
-    Timer m_lifetimeTimer;
-    std::function<void()> m_lifetimeReachedHandler;
+    bool m_wasRevalidated;
 };
 
 class SpeculativeLoadManager::PendingFrameLoad : public RefCounted<PendingFrameLoad> {
@@ -136,6 +170,10 @@ public:
         if (m_didFinishLoad)
             return;
 
+#if !LOG_DISABLED
+        printSpeculativeLoadingDiagnosticMessageCounts();
+#endif
+
         m_didFinishLoad = true;
         saveToDiskIfReady();
         m_loadCompletionHandler();
@@ -201,18 +239,29 @@ SpeculativeLoadManager::~SpeculativeLoadManager()
 {
 }
 
-bool SpeculativeLoadManager::retrieve(const Key& storageKey, const RetrieveCompletionHandler& completionHandler)
+bool SpeculativeLoadManager::retrieve(const GlobalFrameID& frameID, const Key& storageKey, const RetrieveCompletionHandler& completionHandler)
 {
     // Check already preloaded entries.
     if (auto preloadedEntry = m_preloadedEntries.take(storageKey)) {
         LOG(NetworkCacheSpeculativePreloading, "(NetworkProcess) Retrieval: Using preloaded entry to satisfy request for '%s':", storageKey.identifier().utf8().data());
+        if (preloadedEntry->wasRevalidated())
+            logSpeculativeLoadingDiagnosticMessage(frameID, DiagnosticLoggingKeys::successfulSpeculativeWarmupWithRevalidationKey());
+        else
+            logSpeculativeLoadingDiagnosticMessage(frameID, DiagnosticLoggingKeys::successfulSpeculativeWarmupWithoutRevalidationKey());
+
         completionHandler(preloadedEntry->takeCacheEntry());
         return true;
     }
 
     // Check pending speculative revalidations.
-    if (!m_pendingPreloads.contains(storageKey))
+    if (!m_pendingPreloads.contains(storageKey)) {
+        if (m_notPreloadedEntries.remove(storageKey))
+            logSpeculativeLoadingDiagnosticMessage(frameID, DiagnosticLoggingKeys::entryWronglyNotWarmedUpKey());
+        else
+            logSpeculativeLoadingDiagnosticMessage(frameID, DiagnosticLoggingKeys::unknownEntryRequestKey());
+
         return false;
+    }
 
     LOG(NetworkCacheSpeculativePreloading, "(NetworkProcess) Retrieval: revalidation already in progress for '%s':", storageKey.identifier().utf8().data());
 
@@ -260,13 +309,18 @@ void SpeculativeLoadManager::registerLoad(const GlobalFrameID& frameID, const Re
         pendingFrameLoad->registerSubresource(resourceKey);
 }
 
-void SpeculativeLoadManager::addPreloadedEntry(std::unique_ptr<Entry> entry)
+void SpeculativeLoadManager::addPreloadedEntry(std::unique_ptr<Entry> entry, const GlobalFrameID& frameID, WasRevalidated wasRevalidated)
 {
     ASSERT(entry);
     ASSERT(!entry->needsValidation());
     auto key = entry->key();
-    m_preloadedEntries.add(key, std::make_unique<PreloadedEntry>(WTF::move(entry), [this, key]() {
-        m_preloadedEntries.remove(key);
+    m_preloadedEntries.add(key, std::make_unique<PreloadedEntry>(WTF::move(entry), wasRevalidated, [this, key, frameID] {
+        auto preloadedEntry = m_preloadedEntries.take(key);
+        ASSERT(preloadedEntry);
+        if (preloadedEntry->wasRevalidated())
+            logSpeculativeLoadingDiagnosticMessage(frameID, DiagnosticLoggingKeys::wastedSpeculativeWarmupWithRevalidationKey());
+        else
+            logSpeculativeLoadingDiagnosticMessage(frameID, DiagnosticLoggingKeys::wastedSpeculativeWarmupWithoutRevalidationKey());
     }));
 }
 
@@ -316,16 +370,19 @@ void SpeculativeLoadManager::revalidateEntry(std::unique_ptr<Entry> entry, const
 
     auto key = entry->key();
     LOG(NetworkCacheSpeculativePreloading, "(NetworkProcess) Speculatively revalidating '%s':", key.identifier().utf8().data());
-    auto revalidator = std::make_unique<SpeculativeLoad>(frameID, constructRevalidationRequest(*entry), WTF::move(entry), [this, key](std::unique_ptr<Entry> revalidatedEntry) {
+    auto revalidator = std::make_unique<SpeculativeLoad>(frameID, constructRevalidationRequest(*entry), WTF::move(entry), [this, key, frameID](std::unique_ptr<Entry> revalidatedEntry) {
         ASSERT(!revalidatedEntry || !revalidatedEntry->needsValidation());
         auto protectRevalidator = m_pendingPreloads.take(key);
         LOG(NetworkCacheSpeculativePreloading, "(NetworkProcess) Speculative revalidation completed for '%s':", key.identifier().utf8().data());
 
-        if (satisfyPendingRequests(key, revalidatedEntry.get()))
+        if (satisfyPendingRequests(key, revalidatedEntry.get())) {
+            if (revalidatedEntry)
+                logSpeculativeLoadingDiagnosticMessage(frameID, DiagnosticLoggingKeys::successfulSpeculativeWarmupWithRevalidationKey());
             return;
+        }
 
         if (revalidatedEntry)
-            addPreloadedEntry(WTF::move(revalidatedEntry));
+            addPreloadedEntry(WTF::move(revalidatedEntry), frameID, WasRevalidated::Yes);
     });
     m_pendingPreloads.add(key, WTF::move(revalidator));
 }
@@ -336,8 +393,11 @@ void SpeculativeLoadManager::preloadEntry(const Key& key, const GlobalFrameID& f
     retrieveEntryFromStorage(key, [this, key, frameID](std::unique_ptr<Entry> entry) {
         m_pendingPreloads.remove(key);
 
-        if (satisfyPendingRequests(key, entry.get()))
+        if (satisfyPendingRequests(key, entry.get())) {
+            if (entry)
+                logSpeculativeLoadingDiagnosticMessage(frameID, DiagnosticLoggingKeys::successfulSpeculativeWarmupWithoutRevalidationKey());
             return;
+        }
 
         if (!entry)
             return;
@@ -345,17 +405,23 @@ void SpeculativeLoadManager::preloadEntry(const Key& key, const GlobalFrameID& f
         if (entry->needsValidation())
             revalidateEntry(WTF::move(entry), frameID);
         else
-            addPreloadedEntry(WTF::move(entry));
+            addPreloadedEntry(WTF::move(entry), frameID, WasRevalidated::No);
     });
 }
 
 void SpeculativeLoadManager::startSpeculativeRevalidation(const GlobalFrameID& frameID, SubresourcesEntry& entry)
 {
     for (auto& subresource : entry.subresources()) {
+        auto key = subresource.key;
         if (!subresource.value.isTransient)
-            preloadEntry(subresource.key, frameID);
-        else
+            preloadEntry(key, frameID);
+        else {
             LOG(NetworkCacheSpeculativePreloading, "(NetworkProcess) Not preloading '%s' because it is marked as transient", subresource.key.identifier().utf8().data());
+            m_notPreloadedEntries.add(key, std::make_unique<ExpiringEntry>([this, key, frameID] {
+                logSpeculativeLoadingDiagnosticMessage(frameID, DiagnosticLoggingKeys::entryRightlyNotWarmedUpKey());
+                m_notPreloadedEntries.remove(key);
+            }));
+        }
     }
 }
 
index 21ce5c0..4c1de72 100644 (file)
@@ -50,10 +50,11 @@ public:
     void registerLoad(const GlobalFrameID&, const WebCore::ResourceRequest&, const Key& resourceKey);
 
     typedef std::function<void (std::unique_ptr<Entry>)> RetrieveCompletionHandler;
-    bool retrieve(const Key& storageKey, const RetrieveCompletionHandler&);
+    bool retrieve(const GlobalFrameID&, const Key& storageKey, const RetrieveCompletionHandler&);
 
 private:
-    void addPreloadedEntry(std::unique_ptr<Entry>);
+    enum class WasRevalidated { No, Yes };
+    void addPreloadedEntry(std::unique_ptr<Entry>, const GlobalFrameID&, WasRevalidated);
     void preloadEntry(const Key&, const GlobalFrameID&);
     void retrieveEntryFromStorage(const Key&, const RetrieveCompletionHandler&);
     void revalidateEntry(std::unique_ptr<Entry>, const GlobalFrameID&);
@@ -71,6 +72,9 @@ private:
 
     class PreloadedEntry;
     HashMap<Key, std::unique_ptr<PreloadedEntry>> m_preloadedEntries;
+
+    class ExpiringEntry;
+    HashMap<Key, std::unique_ptr<ExpiringEntry>> m_notPreloadedEntries; // For logging.
 };
 
 } // namespace NetworkCache