Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Unified Diff: third_party/WebKit/Source/core/fetch/MemoryCache.cpp

Issue 2202473002: DO NOT COMMIT: Experimental removal of encoded image data Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (rebase) Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/fetch/MemoryCache.cpp
diff --git a/third_party/WebKit/Source/core/fetch/MemoryCache.cpp b/third_party/WebKit/Source/core/fetch/MemoryCache.cpp
index a0de01441465ee86da4cb6e7bafad6c0ef50e6d1..65a9b21b32677c5a92fbba4a70b0c519703810d8 100644
--- a/third_party/WebKit/Source/core/fetch/MemoryCache.cpp
+++ b/third_party/WebKit/Source/core/fetch/MemoryCache.cpp
@@ -288,8 +288,12 @@ void MemoryCache::pruneDeadResources(PruneStrategy strategy)
size_t capacity = deadCapacity();
if (strategy == MaximalPrune)
capacity = 0;
- if (!m_deadSize || (capacity && m_deadSize <= capacity))
- return;
+
+ // Now pruneDeadResources needs to check all resources when the strategy is Maximal
+ if (strategy != MaximalPrune) {
+ if (!m_deadSize || (capacity && m_deadSize <= capacity))
+ return;
+ }
size_t targetSize = static_cast<size_t>(capacity * cTargetPrunePercentage); // Cut by a percentage to avoid immediately pruning again.
@@ -315,6 +319,12 @@ void MemoryCache::pruneDeadResources(PruneStrategy strategy)
continue;
}
+ if (strategy == MaximalPrune) {
+ if (!resource->isPreloaded() && resource->isLoaded() && resource->isReloadable()) {
+ resource->myPrune();
+ }
+ }
+
if (!resource->isAlive() && !resource->isPreloaded() && resource->isLoaded()) {
// Destroy our decoded data. This will remove us from
// m_liveDecodedResources, and possibly move us to a different
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResourceObserver.h ('k') | third_party/WebKit/Source/core/fetch/Resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698