rename ScaledImageCache to ResourceCache

BUG=skia:
R=bsalomon@google.com, mtklein@google.com

Author: reed@google.com

Review URL: https://codereview.chromium.org/511283002
diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp
index e9ee622..65623d0 100644
--- a/tests/CachedDecodingPixelRefTest.cpp
+++ b/tests/CachedDecodingPixelRefTest.cpp
@@ -13,7 +13,7 @@
 #include "SkDiscardableMemoryPool.h"
 #include "SkImageDecoder.h"
 #include "SkImageGeneratorPriv.h"
-#include "SkScaledImageCache.h"
+#include "SkResourceCache.h"
 #include "SkStream.h"
 #include "SkUtils.h"
 
@@ -257,7 +257,7 @@
     SkBitmap lazy;
     bool success;
     if (kSkCaching_PixelRefType == pixelRefType) {
-        // Ignore factory; use global SkScaledImageCache.
+        // Ignore factory; use global cache.
         success = SkCachingPixelRef::Install(gen.detach(), &lazy);
     } else {
         success = SkInstallDiscardablePixelRef(gen.detach(), &lazy, factory);
diff --git a/tests/ImageCacheTest.cpp b/tests/ImageCacheTest.cpp
index 28cda94..bda10a0 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 @@
         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 @@
 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 @@
         // 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 @@
     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);
diff --git a/tests/ScaledImageCache.cpp b/tests/ScaledImageCache.cpp
index 276a3cc..8088d09 100644
--- a/tests/ScaledImageCache.cpp
+++ b/tests/ScaledImageCache.cpp
@@ -41,32 +41,32 @@
 }
 
 // http://crbug.com/389439
-DEF_TEST(ScaledImageCache_SingleAllocationByteLimit, reporter) {
-    size_t originalByteLimit = SkGraphics::GetImageCacheTotalByteLimit();
+DEF_TEST(ResourceCache_SingleAllocationByteLimit, reporter) {
+    size_t originalByteLimit = SkGraphics::GetResourceCacheTotalByteLimit();
     size_t originalAllocationLimit =
-        SkGraphics::GetImageCacheSingleAllocationByteLimit();
+        SkGraphics::GetResourceCacheSingleAllocationByteLimit();
 
     size_t size = kBitmapSize * kScale * kBitmapSize * kScale
         * SkColorTypeBytesPerPixel(kN32_SkColorType);
 
-    SkGraphics::SetImageCacheTotalByteLimit(0);  // clear cache
-    SkGraphics::SetImageCacheTotalByteLimit(2 * size);
-    SkGraphics::SetImageCacheSingleAllocationByteLimit(0);  // No limit
+    SkGraphics::SetResourceCacheTotalByteLimit(0);  // clear cache
+    SkGraphics::SetResourceCacheTotalByteLimit(2 * size);
+    SkGraphics::SetResourceCacheSingleAllocationByteLimit(0);  // No limit
 
     REPORTER_ASSERT(reporter, test_scaled_image_cache_useage());
 
-    SkGraphics::SetImageCacheTotalByteLimit(0);  // clear cache
-    SkGraphics::SetImageCacheTotalByteLimit(2 * size);
-    SkGraphics::SetImageCacheSingleAllocationByteLimit(size * 2);  // big enough
+    SkGraphics::SetResourceCacheTotalByteLimit(0);  // clear cache
+    SkGraphics::SetResourceCacheTotalByteLimit(2 * size);
+    SkGraphics::SetResourceCacheSingleAllocationByteLimit(size * 2);  // big enough
 
     REPORTER_ASSERT(reporter, test_scaled_image_cache_useage());
 
-    SkGraphics::SetImageCacheTotalByteLimit(0);  // clear cache
-    SkGraphics::SetImageCacheTotalByteLimit(2 * size);
-    SkGraphics::SetImageCacheSingleAllocationByteLimit(size / 2);  // too small
+    SkGraphics::SetResourceCacheTotalByteLimit(0);  // clear cache
+    SkGraphics::SetResourceCacheTotalByteLimit(2 * size);
+    SkGraphics::SetResourceCacheSingleAllocationByteLimit(size / 2);  // too small
 
     REPORTER_ASSERT(reporter, !test_scaled_image_cache_useage());
 
-    SkGraphics::SetImageCacheSingleAllocationByteLimit(originalAllocationLimit);
-    SkGraphics::SetImageCacheTotalByteLimit(originalByteLimit);
+    SkGraphics::SetResourceCacheSingleAllocationByteLimit(originalAllocationLimit);
+    SkGraphics::SetResourceCacheTotalByteLimit(originalByteLimit);
 }