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

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: Use CachedImage as the backing store for ImageBitmap. Implement O(1) decode cache. 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 e981ad4deae249553e3ac14940b419d9f6bb82f7..013fe807352be4cbe6303df5261c03a9d7a09c70 100644
--- a/Source/core/loader/cache/CachedResource.cpp
+++ b/Source/core/loader/cache/CachedResource.cpp
@@ -119,6 +119,7 @@ CachedResource::CachedResource(const ResourceRequest& request, Type type)
, m_handleCount(0)
, m_preloadCount(0)
, m_preloadResult(PreloadNotReferenced)
+ , m_decodePriority(DecodePriorityLow)
, m_inLiveDecodedResourcesList(false)
, m_requestedFromNetworkingLayer(false)
, m_inCache(false)
@@ -355,6 +356,19 @@ CachedMetadata* CachedResource::cachedMetadata(unsigned dataTypeID) const
return m_cachedMetadata.get();
}
+void CachedResource::setDecodePriority(DecodePriority priority)
+{
+ m_lastDecodedAccessTime = currentTime();
+ if (inCache()) {
+ if (m_inLiveDecodedResourcesList && m_decodePriority != priority) {
+ memoryCache()->removeFromLiveDecodedResourcesList(this);
+ m_decodePriority = priority;
+ memoryCache()->insertInLiveDecodedResourcesList(this);
+ }
+ memoryCache()->prune();
+ }
+}
+
void CachedResource::clearLoader()
{
m_loader = 0;
@@ -551,7 +565,6 @@ void CachedResource::setEncodedSize(unsigned size)
void CachedResource::didAccessDecodedData(double timeStamp)
{
m_lastDecodedAccessTime = timeStamp;
-
Justin Novosad 2013/07/23 16:55:12 Don't do whitespace edits unless you are changing
if (inCache()) {
if (m_inLiveDecodedResourcesList) {
memoryCache()->removeFromLiveDecodedResourcesList(this);
@@ -881,3 +894,4 @@ void CachedResource::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addRawBuffer(m_purgeableData.get(), m_purgeableData->size(), "PurgeableData", "purgeableData");
}
}
+

Powered by Google App Engine
This is Rietveld 408576698