From 595aa05efcb504e85358b8d328ac4a9fa1c46e2e Mon Sep 17 00:00:00 2001 From: reed Date: Mon, 15 Sep 2014 10:15:18 -0700 Subject: Revert of Change SkResourceCache to take a Visitor inside its find(). (patchset #2 id:20001 of https://codereview.chromium.org/567393002/) Reason for revert: crashes on android bots, haven't diagnosed yet Original issue's description: > 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: > > Committed: https://skia.googlesource.com/skia/+/dee6a8e67db39fcbde2b3bb09be1d088ebb9db8a R=mtklein@google.com, danakj@chromium.org TBR=danakj@chromium.org, mtklein@google.com NOTREECHECKS=true NOTRY=true BUG=skia: Author: reed@google.com Review URL: https://codereview.chromium.org/569303002 --- bench/ImageCacheBench.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'bench/ImageCacheBench.cpp') diff --git a/bench/ImageCacheBench.cpp b/bench/ImageCacheBench.cpp index 0f8fdf2708..ca2b9342d5 100644 --- a/bench/ImageCacheBench.cpp +++ b/bench/ImageCacheBench.cpp @@ -27,10 +27,6 @@ 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; - } }; } @@ -45,7 +41,7 @@ public: void populateCache() { for (int i = 0; i < CACHE_COUNT; ++i) { - fCache.add(SkNEW_ARGS(TestRec, (TestKey(i), i))); + fCache.unlock(fCache.addAndLock(SkNEW_ARGS(TestRec, (TestKey(i), i)))); } } @@ -62,8 +58,8 @@ protected: TestKey key(-1); // search for a miss (-1) for (int i = 0; i < loops; ++i) { - SkDEBUGCODE(bool found =) fCache.find(key, TestRec::Visitor, NULL); - SkASSERT(!found); + SkDEBUGCODE(SkResourceCache::ID id =) fCache.findAndLock(key); + SkASSERT(NULL == id); } } -- cgit v1.2.3