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

Unified Diff: Source/core/loader/cache/CachedResource.cpp

Issue 17436003: Evict CachedResources if they are cancelled due to last client being removed. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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
« no previous file with comments | « Source/core/loader/cache/CachedImageTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/cache/CachedResource.cpp
diff --git a/Source/core/loader/cache/CachedResource.cpp b/Source/core/loader/cache/CachedResource.cpp
index e41d4dbf232112e3219cef1f041ca96e2fdef439..854ae6f142304912ae323c13d4155890933e082e 100644
--- a/Source/core/loader/cache/CachedResource.cpp
+++ b/Source/core/loader/cache/CachedResource.cpp
@@ -447,6 +447,8 @@ void CachedResource::removeClient(CachedResourceClient* client)
void CachedResource::allClientsRemoved()
{
+ if (!m_loader)
+ return;
if (m_type == MainResource || m_type == RawResource)
cancelTimerFired(&m_cancelTimer);
else if (!m_cancelTimer.isActive())
@@ -459,6 +461,8 @@ void CachedResource::cancelTimerFired(Timer<CachedResource>* timer)
if (hasClients() || !m_loader)
return;
m_loader->cancelIfNotFinishing();
+ if (m_status != Cached)
+ memoryCache()->remove(this);
}
void CachedResource::destroyDecodedDataIfNeeded()
« no previous file with comments | « Source/core/loader/cache/CachedImageTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698