summaryrefslogtreecommitdiff
path: root/libs/hwui/GenerationCache.h
diff options
context:
space:
mode:
author Romain Guy <romainguy@google.com> 2010-08-24 17:20:20 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2010-08-24 17:20:20 -0700
commita84e02ce3cc392ccf23bbe89cdfbef650047ffe7 (patch)
tree6ddb05a329a031522ccd45c477d11556dfdb5ee1 /libs/hwui/GenerationCache.h
parent17b4d9ea826609f26a73077975c2399f91b5ca36 (diff)
parentfb8b763f762ae21923c58d64caa729b012f40e05 (diff)
Merge "Use only one GL context per process, share chaches."
Diffstat (limited to 'libs/hwui/GenerationCache.h')
-rw-r--r--libs/hwui/GenerationCache.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/libs/hwui/GenerationCache.h b/libs/hwui/GenerationCache.h
index 45b3ffaf074a..c358c8096cfd 100644
--- a/libs/hwui/GenerationCache.h
+++ b/libs/hwui/GenerationCache.h
@@ -104,12 +104,14 @@ void GenerationCache<K, V>::setOnEntryRemovedListener(OnEntryRemoved<K, V>* list
template<typename K, typename V>
void GenerationCache<K, V>::clear() {
if (mListener) {
- while (mCache.size() > 0) {
- removeOldest();
+ for (uint32_t i = 0; i < mCache.size(); i++) {
+ sp<Entry<K, V> > entry = mCache.valueAt(i);
+ if (mListener) {
+ (*mListener)(entry->key, entry->value);
+ }
}
- } else {
- mCache.clear();
}
+ mCache.clear();
mYoungest.clear();
mOldest.clear();
}