Chromium Code Reviews| 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); |