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

Unified Diff: tests/ImageCacheTest.cpp

Issue 511283002: rename ScaledImageCache to ResourceCache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/CachedDecodingPixelRefTest.cpp ('k') | tests/ScaledImageCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageCacheTest.cpp
diff --git a/tests/ImageCacheTest.cpp b/tests/ImageCacheTest.cpp
index 28cda94000ebe9a9ba64a07f01f79e88c20c0eac..bda10a040a9137f0598008c110718cf500ae82cb 100644
--- a/tests/ImageCacheTest.cpp
+++ b/tests/ImageCacheTest.cpp
@@ -6,12 +6,12 @@
*/
#include "SkDiscardableMemory.h"
-#include "SkScaledImageCache.h"
+#include "SkResourceCache.h"
#include "Test.h"
namespace {
static void* gGlobalAddress;
-struct TestingKey : public SkScaledImageCache::Key {
+struct TestingKey : public SkResourceCache::Key {
void* fPtr;
intptr_t fValue;
@@ -19,7 +19,7 @@ struct TestingKey : public SkScaledImageCache::Key {
this->init(sizeof(fPtr) + sizeof(fValue));
}
};
-struct TestingRec : public SkScaledImageCache::Rec {
+struct TestingRec : public SkResourceCache::Rec {
TestingRec(const TestingKey& key, uint32_t value) : fKey(key), fValue(value) {}
TestingKey fKey;
@@ -33,9 +33,9 @@ struct TestingRec : public SkScaledImageCache::Rec {
static const int COUNT = 10;
static const int DIM = 256;
-static void test_cache(skiatest::Reporter* reporter, SkScaledImageCache& cache,
+static void test_cache(skiatest::Reporter* reporter, SkResourceCache& cache,
bool testPurge) {
- SkScaledImageCache::ID id;
+ SkResourceCache::ID id;
for (int i = 0; i < COUNT; ++i) {
TestingKey key(i);
@@ -58,7 +58,7 @@ static void test_cache(skiatest::Reporter* reporter, SkScaledImageCache& cache,
// stress test, should trigger purges
for (size_t i = 0; i < COUNT * 100; ++i) {
TestingKey key(i);
- SkScaledImageCache::ID id = cache.addAndLock(SkNEW_ARGS(TestingRec, (key, i)));
+ SkResourceCache::ID id = cache.addAndLock(SkNEW_ARGS(TestingRec, (key, i)));
REPORTER_ASSERT(reporter, NULL != id);
cache.unlock(id);
}
@@ -87,30 +87,30 @@ DEF_TEST(ImageCache, reporter) {
static const size_t defLimit = DIM * DIM * 4 * COUNT + 1024; // 1K slop
{
- SkScaledImageCache cache(defLimit);
+ SkResourceCache cache(defLimit);
test_cache(reporter, cache, true);
}
{
SkAutoTUnref<SkDiscardableMemoryPool> pool(
SkDiscardableMemoryPool::Create(defLimit, NULL));
gPool = pool.get();
- SkScaledImageCache cache(pool_factory);
+ SkResourceCache cache(pool_factory);
test_cache(reporter, cache, true);
}
{
- SkScaledImageCache cache(SkDiscardableMemory::Create);
+ SkResourceCache cache(SkDiscardableMemory::Create);
test_cache(reporter, cache, false);
}
}
DEF_TEST(ImageCache_doubleAdd, r) {
// Adding the same key twice should be safe.
- SkScaledImageCache cache(4096);
+ SkResourceCache cache(4096);
TestingKey key(1);
- SkScaledImageCache::ID id1 = cache.addAndLock(SkNEW_ARGS(TestingRec, (key, 2)));
- SkScaledImageCache::ID id2 = cache.addAndLock(SkNEW_ARGS(TestingRec, (key, 3)));
+ SkResourceCache::ID id1 = cache.addAndLock(SkNEW_ARGS(TestingRec, (key, 2)));
+ SkResourceCache::ID id2 = cache.addAndLock(SkNEW_ARGS(TestingRec, (key, 3)));
// We don't really care if id1 == id2 as long as unlocking both works.
cache.unlock(id1);
cache.unlock(id2);
« no previous file with comments | « tests/CachedDecodingPixelRefTest.cpp ('k') | tests/ScaledImageCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698