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

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

Issue 19393004: Allow eviction of ImageBitmaps that are created from ImageElements. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix for assertion failure. Created 7 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
« no previous file with comments | « Source/core/loader/cache/Resource.h ('k') | Source/core/page/ImageBitmap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/cache/Resource.cpp
diff --git a/Source/core/loader/cache/Resource.cpp b/Source/core/loader/cache/Resource.cpp
index 25dd28e08c7ab5c737705e2c7536eb4297e12a73..caaccdf891e44ef879e8522f26b543531c22bd57 100644
--- a/Source/core/loader/cache/Resource.cpp
+++ b/Source/core/loader/cache/Resource.cpp
@@ -106,6 +106,7 @@ Resource::Resource(const ResourceRequest& request, Type type)
, m_handleCount(0)
, m_preloadCount(0)
, m_preloadResult(PreloadNotReferenced)
+ , m_cacheLiveResourcePriority(CacheLiveResourcePriorityLow)
, m_inLiveDecodedResourcesList(false)
, m_requestedFromNetworkingLayer(false)
, m_inCache(false)
@@ -343,6 +344,16 @@ CachedMetadata* Resource::cachedMetadata(unsigned dataTypeID) const
return m_cachedMetadata.get();
}
+void Resource::setCacheLiveResourcePriority(CacheLiveResourcePriority priority)
+{
+ if (inCache() && m_inLiveDecodedResourcesList && m_cacheLiveResourcePriority != priority) {
+ memoryCache()->removeFromLiveDecodedResourcesList(this);
+ m_cacheLiveResourcePriority = priority;
+ memoryCache()->insertInLiveDecodedResourcesList(this);
+ memoryCache()->prune();
+ }
+}
+
void Resource::clearLoader()
{
m_loader = 0;
@@ -522,7 +533,6 @@ void Resource::setEncodedSize(unsigned size)
void Resource::didAccessDecodedData(double timeStamp)
{
m_lastDecodedAccessTime = timeStamp;
-
if (inCache()) {
if (m_inLiveDecodedResourcesList) {
memoryCache()->removeFromLiveDecodedResourcesList(this);
@@ -826,3 +836,4 @@ void Resource::ResourceCallback::timerFired(Timer<ResourceCallback>*)
}
}
+
« no previous file with comments | « Source/core/loader/cache/Resource.h ('k') | Source/core/page/ImageBitmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698