Index: tools/bench_pictures_main.cpp |
diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp |
index 31d432daa93145a8d3b25889de6196b72e454f0e..1f3b0c02255282036ea3287a5aaa86e4ecda5b19 100644 |
--- a/tools/bench_pictures_main.cpp |
+++ b/tools/bench_pictures_main.cpp |
@@ -12,12 +12,9 @@ |
#include "PictureRenderingFlags.h" |
#include "SkBenchLogger.h" |
#include "SkCommandLineFlags.h" |
+#include "SkDiscardableMemoryPool.h" |
#include "SkGraphics.h" |
#include "SkImageDecoder.h" |
-#if LAZY_CACHE_STATS |
- #include "SkLazyPixelRef.h" |
-#endif |
-#include "SkLruImageCache.h" |
#include "SkMath.h" |
#include "SkOSFile.h" |
#include "SkPicture.h" |
@@ -143,9 +140,6 @@ static SkString filterFlagsUsage() { |
return result; |
} |
-// Defined in LazyDecodeBitmap.cpp |
-extern SkLruImageCache gLruImageCache; |
- |
#if LAZY_CACHE_STATS |
static int32_t gTotalCacheHits; |
static int32_t gTotalCacheMisses; |
@@ -163,11 +157,12 @@ static bool run_single_benchmark(const SkString& inputPath, |
return false; |
} |
+ SkDiscardableMemoryPool* pool = SkGetGlobalDiscardableMemoryPool(); |
// Since the old picture has been deleted, all pixels should be cleared. |
- SkASSERT(gLruImageCache.getImageCacheUsed() == 0); |
+ SkASSERT(pool->getRAMUsed() == 0); |
if (FLAGS_countRAM) { |
- // Set the limit to zero, so all pixels will be kept |
- gLruImageCache.setImageCacheLimit(0); |
+ pool->setRAMBudget(SK_MaxU32); |
+ // Set the limit to max, so all pixels will be kept |
} |
SkPicture::InstallPixelRefProc proc; |
@@ -197,9 +192,9 @@ static bool run_single_benchmark(const SkString& inputPath, |
#if LAZY_CACHE_STATS |
if (FLAGS_trackDeferredCaching) { |
- int32_t cacheHits = SkLazyPixelRef::GetCacheHits(); |
- int32_t cacheMisses = SkLazyPixelRef::GetCacheMisses(); |
- SkLazyPixelRef::ResetCacheStats(); |
+ int32_t cacheHits = pool->fCacheHits; |
+ int32_t cacheMisses = pool->fCacheMisses; |
+ pool->fCacheHits = pool->fCacheMisses = 0; |
SkString hitString; |
hitString.printf("Cache hit rate: %f\n", (double) cacheHits / (cacheHits + cacheMisses)); |
gLogger.logProgress(hitString); |
@@ -209,7 +204,7 @@ static bool run_single_benchmark(const SkString& inputPath, |
#endif |
if (FLAGS_countRAM) { |
SkString ramCount("RAM used for bitmaps: "); |
- size_t bytes = gLruImageCache.getImageCacheUsed(); |
+ size_t bytes = pool->getRAMUsed(); |
if (bytes > 1024) { |
size_t kb = bytes / 1024; |
if (kb > 1024) { |