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

Side by Side Diff: Source/core/loader/cache/MemoryCache.h

Issue 19393004: Allow eviction of ImageBitmaps that are created from ImageElements. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Decrease canvas size for recursive test. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org> 3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
4 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 4 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 void remove(CachedResource* resource) { evict(resource); } 112 void remove(CachedResource* resource) { evict(resource); }
113 113
114 static KURL removeFragmentIdentifierIfNeeded(const KURL& originalURL); 114 static KURL removeFragmentIdentifierIfNeeded(const KURL& originalURL);
115 115
116 // Sets the cache's memory capacities, in bytes. These will hold only approx imately, 116 // Sets the cache's memory capacities, in bytes. These will hold only approx imately,
117 // since the decoded cost of resources like scripts and stylesheets is not k nown. 117 // since the decoded cost of resources like scripts and stylesheets is not k nown.
118 // - minDeadBytes: The maximum number of bytes that dead resources should c onsume when the cache is under pressure. 118 // - minDeadBytes: The maximum number of bytes that dead resources should c onsume when the cache is under pressure.
119 // - maxDeadBytes: The maximum number of bytes that dead resources should c onsume when the cache is not under pressure. 119 // - maxDeadBytes: The maximum number of bytes that dead resources should c onsume when the cache is not under pressure.
120 // - totalBytes: The maximum number of bytes that the cache should consume overall. 120 // - totalBytes: The maximum number of bytes that the cache should consume overall.
121 void setCapacities(unsigned minDeadBytes, unsigned maxDeadBytes, unsigned to talBytes); 121 void setCapacities(unsigned minDeadBytes, unsigned maxDeadBytes, unsigned to talBytes);
122 void setDelayBeforeLiveDecodedPrune(unsigned seconds) { m_delayBeforeLiveDec odedPrune = seconds; }
122 123
123 void evictResources(); 124 void evictResources();
124 125
125 void prune(); 126 void prune();
126 127
127 // Calls to put the cached resource into and out of LRU lists. 128 // Calls to put the cached resource into and out of LRU lists.
128 void insertInLRUList(CachedResource*); 129 void insertInLRUList(CachedResource*);
129 void removeFromLRUList(CachedResource*); 130 void removeFromLRUList(CachedResource*);
130 131
131 // Called to adjust the cache totals when a resource changes size. 132 // Called to adjust the cache totals when a resource changes size.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 167
167 void evict(CachedResource*); 168 void evict(CachedResource*);
168 169
169 static void removeURLFromCacheInternal(ScriptExecutionContext*, const KURL&) ; 170 static void removeURLFromCacheInternal(ScriptExecutionContext*, const KURL&) ;
170 171
171 bool m_inPruneResources; 172 bool m_inPruneResources;
172 173
173 unsigned m_capacity; 174 unsigned m_capacity;
174 unsigned m_minDeadCapacity; 175 unsigned m_minDeadCapacity;
175 unsigned m_maxDeadCapacity; 176 unsigned m_maxDeadCapacity;
177 unsigned m_delayBeforeLiveDecodedPrune;
178 double m_deadDecodedDataDeletionInterval;
176 179
177 unsigned m_liveSize; // The number of bytes currently consumed by "live" res ources in the cache. 180 unsigned m_liveSize; // The number of bytes currently consumed by "live" res ources in the cache.
178 unsigned m_deadSize; // The number of bytes currently consumed by "dead" res ources in the cache. 181 unsigned m_deadSize; // The number of bytes currently consumed by "dead" res ources in the cache.
179 182
180 // Size-adjusted and popularity-aware LRU list collection for cache objects. This collection can hold 183 // Size-adjusted and popularity-aware LRU list collection for cache objects. This collection can hold
181 // more resources than the cached resource map, since it can also hold "stal e" multiple versions of objects that are 184 // more resources than the cached resource map, since it can also hold "stal e" multiple versions of objects that are
182 // waiting to die when the clients referencing them go away. 185 // waiting to die when the clients referencing them go away.
183 Vector<LRUList, 32> m_allResources; 186 Vector<LRUList, 32> m_allResources;
184 187
185 // List just for live resources with decoded data. Access to this list is b ased off of painting the resource. 188 // Lists just for live resources with decoded data. Access to this list is b ased off of painting the resource.
186 LRUList m_liveDecodedResources; 189 // The lists are ordered by decode priority, with higher indices having high er priorities.
190 LRUList m_liveDecodedResources[3];
Nate Chapin 2013/07/26 17:05:12 Boo magic numbers :( Maybe add a value to the enu
187 191
188 // A URL-based map of all resources that are in the cache (including the fre shest version of objects that are currently being 192 // A URL-based map of all resources that are in the cache (including the fre shest version of objects that are currently being
189 // referenced by a Web page). 193 // referenced by a Web page).
190 HashMap<String, CachedResource*> m_resources; 194 HashMap<String, CachedResource*> m_resources;
191 195
192 #ifdef MEMORY_CACHE_STATS 196 #ifdef MEMORY_CACHE_STATS
193 Timer<MemoryCache> m_statsTimer; 197 Timer<MemoryCache> m_statsTimer;
194 #endif 198 #endif
195 }; 199 };
196 200
197 // Returns the global cache. 201 // Returns the global cache.
198 MemoryCache* memoryCache(); 202 MemoryCache* memoryCache();
199 203
200 // Sets the global cache, used to swap in a test instance. 204 // Sets the global cache, used to swap in a test instance.
201 void setMemoryCacheForTesting(MemoryCache*); 205 void setMemoryCacheForTesting(MemoryCache*);
202 206
203 } 207 }
204 208
205 #endif 209 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698