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

Unified Diff: bench/ImageCacheBench.cpp

Issue 569353002: Change SkResourceCache to take a Visitor inside its find(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remember to purge after the add Created 6 years, 3 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 | « no previous file | src/core/SkBitmapCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/ImageCacheBench.cpp
diff --git a/bench/ImageCacheBench.cpp b/bench/ImageCacheBench.cpp
index ca2b9342d515ba3186a0a8b4670a69d836561c1a..0f8fdf27089916b0df25d0aa49a0f60078b3fd39 100644
--- a/bench/ImageCacheBench.cpp
+++ b/bench/ImageCacheBench.cpp
@@ -27,6 +27,10 @@ struct TestRec : public SkResourceCache::Rec {
virtual const Key& getKey() const SK_OVERRIDE { return fKey; }
virtual size_t bytesUsed() const SK_OVERRIDE { return sizeof(fKey) + sizeof(fValue); }
+
+ static bool Visitor(const SkResourceCache::Rec&, void*) {
+ return true;
+ }
};
}
@@ -41,7 +45,7 @@ public:
void populateCache() {
for (int i = 0; i < CACHE_COUNT; ++i) {
- fCache.unlock(fCache.addAndLock(SkNEW_ARGS(TestRec, (TestKey(i), i))));
+ fCache.add(SkNEW_ARGS(TestRec, (TestKey(i), i)));
}
}
@@ -58,8 +62,8 @@ protected:
TestKey key(-1);
// search for a miss (-1)
for (int i = 0; i < loops; ++i) {
- SkDEBUGCODE(SkResourceCache::ID id =) fCache.findAndLock(key);
- SkASSERT(NULL == id);
+ SkDEBUGCODE(bool found =) fCache.find(key, TestRec::Visitor, NULL);
+ SkASSERT(!found);
}
}
« no previous file with comments | « no previous file | src/core/SkBitmapCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698