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

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

Issue 2251853005: Reland: Add MemoryCoordinatorClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 years, 4 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 d6957b64c424a1f5a1b4b2bb3aceb0568f612ba7..a0e32b720bb59c56287aa3aef0a4ad078a0e7c8e 100644
--- a/third_party/WebKit/Source/core/fetch/MemoryCache.cpp
+++ b/third_party/WebKit/Source/core/fetch/MemoryCache.cpp
@@ -104,6 +104,8 @@ inline MemoryCache::MemoryCache()
#endif
{
MemoryCacheDumpProvider::instance()->setMemoryCache(this);
+ if (ProcessHeap::isLowEndDevice())
+ MemoryCoordinator::instance().registerClient(this);
#ifdef MEMORY_CACHE_STATS
const double statsIntervalInSeconds = 15;
m_statsTimer.startRepeating(statsIntervalInSeconds, BLINK_FROM_HERE);
@@ -127,6 +129,7 @@ DEFINE_TRACE(MemoryCache)
visitor->trace(m_liveDecodedResources);
visitor->trace(m_resourceMaps);
MemoryCacheDumpClient::trace(visitor);
+ MemoryCoordinatorClient::trace(visitor);
}
KURL MemoryCache::removeFragmentIdentifierIfNeeded(const KURL& originalURL)
@@ -735,6 +738,11 @@ bool MemoryCache::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfDetail, WebProc
return true;
}
+void MemoryCache::onMemoryPressure(WebMemoryPressureLevel level)
+{
+ pruneAll();
+}
+
bool MemoryCache::isInSameLRUListForTest(const Resource* x, const Resource* y)
{
MemoryCacheEntry* ex = getEntryForResource(x);
« no previous file with comments | « third_party/WebKit/Source/core/fetch/MemoryCache.h ('k') | third_party/WebKit/Source/platform/MemoryCoordinator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698