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

Unified Diff: tools/bench_pictures_main.cpp

Issue 103033002: Big Cleanup: SkBitmapFactory, SkLazyPixelRef, SkImageCache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase one last time Created 7 years 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 | « tools/PictureRenderingFlags.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « tools/PictureRenderingFlags.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698