aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/ImageCacheBench.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2014-09-15 06:44:47 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-15 06:44:47 -0700
commitdee6a8e67db39fcbde2b3bb09be1d088ebb9db8a (patch)
tree36e276101666865d5e06023b01f63affbf414afe /bench/ImageCacheBench.cpp
parent5087b2c06762d0ea8b471f63953a587ecafaae0f (diff)
Change SkResourceCache to take a Visitor inside its find().
This simplifies the API/contract, in that there are not any exposed lock/unlock scopes. patch from issue 572573002 BUG=skia: R=mtklein@google.com, danakj@chromium.org Author: reed@google.com Review URL: https://codereview.chromium.org/567393002
Diffstat (limited to 'bench/ImageCacheBench.cpp')
-rw-r--r--bench/ImageCacheBench.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/bench/ImageCacheBench.cpp b/bench/ImageCacheBench.cpp
index ca2b9342d5..0f8fdf2708 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);
}
}