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

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

Issue 2230433002: Add MemoryCoordinatorClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak 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 68ef8fef863a9123f082c245181795fc41f5b831..2aba9aaad3e26eea531f3d556da2bd0875edee7e 100644
--- a/third_party/WebKit/Source/core/fetch/MemoryCache.cpp
+++ b/third_party/WebKit/Source/core/fetch/MemoryCache.cpp
@@ -104,6 +104,7 @@ inline MemoryCache::MemoryCache()
#endif
{
MemoryCacheDumpProvider::instance()->setMemoryCache(this);
+ MemoryCoordinator::instance().registerClient(this);
#ifdef MEMORY_CACHE_STATS
const double statsIntervalInSeconds = 15;
m_statsTimer.startRepeating(statsIntervalInSeconds, BLINK_FROM_HERE);
@@ -119,6 +120,7 @@ MemoryCache::~MemoryCache()
{
if (m_prunePending)
Platform::current()->currentThread()->removeTaskObserver(this);
+ MemoryCoordinator::instance().unregisterClient(this);
haraken 2016/08/12 02:55:00 We don't need to call this since the client is aut
bashi 2016/08/16 00:09:06 Removed. Does it mean we should have null checks
haraken 2016/08/16 02:37:04 No. Cleared entries are automatically removed from
bashi 2016/08/16 02:39:41 I see. Thanks for clarification.
}
DEFINE_TRACE(MemoryCache)
@@ -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,12 @@ bool MemoryCache::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfDetail, WebProc
return true;
}
+void MemoryCache::onMemoryPressure(WebMemoryPressureLevel level)
+{
+ if (ProcessHeap::isLowEndDevice())
esprehn 2016/08/15 15:41:07 Hmm, should we do this in the constructor then? Ca
bashi 2016/08/16 00:09:06 Done. tasak@: you might want to move back this co
+ pruneAll();
+}
+
bool MemoryCache::isInSameLRUListForTest(const Resource* x, const Resource* y)
{
MemoryCacheEntry* ex = getEntryForResource(x);

Powered by Google App Engine
This is Rietveld 408576698