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

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

Issue 19393004: Allow eviction of ImageBitmaps that are created from ImageElements. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix drawImage out of bounds src rect. Created 7 years, 5 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: Source/core/loader/cache/CachedResource.cpp
diff --git a/Source/core/loader/cache/CachedResource.cpp b/Source/core/loader/cache/CachedResource.cpp
index 80c261fc9ebd15b0b6f2c83efa8b7c9154954cbe..55261d97cf18d62491e20871350210bea8a086ac 100644
--- a/Source/core/loader/cache/CachedResource.cpp
+++ b/Source/core/loader/cache/CachedResource.cpp
@@ -106,6 +106,7 @@ CachedResource::CachedResource(const ResourceRequest& request, Type type)
, m_handleCount(0)
, m_preloadCount(0)
, m_preloadResult(PreloadNotReferenced)
+ , m_cachePriority(CachePriorityLow)
, m_inLiveDecodedResourcesList(false)
, m_requestedFromNetworkingLayer(false)
, m_inCache(false)
@@ -343,6 +344,19 @@ CachedMetadata* CachedResource::cachedMetadata(unsigned dataTypeID) const
return m_cachedMetadata.get();
}
+void CachedResource::setCachePriority(CachePriority priority)
+{
+ m_lastDecodedAccessTime = currentTime();
+ if (inCache()) {
+ if (m_inLiveDecodedResourcesList && m_cachePriority != priority) {
+ memoryCache()->removeFromLiveDecodedResourcesList(this);
+ m_cachePriority = priority;
+ memoryCache()->insertInLiveDecodedResourcesList(this);
+ }
+ memoryCache()->prune();
+ }
+}
+
void CachedResource::clearLoader()
{
m_loader = 0;
@@ -825,3 +839,4 @@ void CachedResource::CachedResourceCallback::timerFired(Timer<CachedResourceCall
}
}
+

Powered by Google App Engine
This is Rietveld 408576698