When navigating, discard decoded image data that is only live due to page cache.
[WebKit-https.git] / Source / WebCore / loader / cache / CachedImage.cpp
index 4f54525..059f35e 100644 (file)
@@ -527,4 +527,16 @@ CachedResource::RevalidationDecision CachedImage::makeRevalidationDecision(Cache
     return CachedResource::makeRevalidationDecision(cachePolicy);
 }
 
+bool CachedImage::areAllClientsInPageCache() const
+{
+    for (auto& entry : m_clients) {
+        auto& client = *entry.key;
+        if (client.resourceClientType() != CachedImageClient::expectedType())
+            continue;
+        if (!static_cast<CachedImageClient&>(client).inPageCache())
+            return false;
+    }
+    return true;
+}
+
 } // namespace WebCore