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

Unified Diff: src/lazy/SkLazyPixelRef.h

Issue 12393046: Add a way to monitor cache hits and misses for deferred decoding. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 10 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 | « gyp/tools.gyp ('k') | src/lazy/SkLazyPixelRef.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lazy/SkLazyPixelRef.h
diff --git a/src/lazy/SkLazyPixelRef.h b/src/lazy/SkLazyPixelRef.h
index e5a20bd91abfcee5aeec6916137af48ce4329d2f..af85f90552cbd08285ea7e26d6f2f9a28bf7cf33 100644
--- a/src/lazy/SkLazyPixelRef.h
+++ b/src/lazy/SkLazyPixelRef.h
@@ -17,6 +17,12 @@ class SkColorTable;
class SkData;
class SkImageCache;
+#ifdef SK_DEBUG
+ #define LAZY_CACHE_STATS 1
+#elif !defined(LAZY_CACHE_STATS)
+ #define LAZY_CACHE_STATS 0
+#endif
+
/**
* PixelRef which defers decoding until SkBitmap::lockPixels() is called.
*/
@@ -38,6 +44,12 @@ public:
intptr_t getCacheId() const { return fCacheId; }
#endif
+#if LAZY_CACHE_STATS
+ static int32_t GetCacheHits() { return gCacheHits; }
+ static int32_t GetCacheMisses() { return gCacheMisses; }
+ static void ResetCacheStats() { gCacheHits = gCacheMisses = 0; }
+#endif
+
// No need to flatten this object. When flattening an SkBitmap, SkOrderedWriteBuffer will check
// the encoded data and write that instead.
// Future implementations of SkFlattenableWriteBuffer will need to special case for
@@ -57,6 +69,11 @@ private:
SkImageCache* fImageCache;
intptr_t fCacheId;
+#if LAZY_CACHE_STATS
+ static int32_t gCacheHits;
+ static int32_t gCacheMisses;
+#endif
+
typedef SkPixelRef INHERITED;
};
« no previous file with comments | « gyp/tools.gyp ('k') | src/lazy/SkLazyPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698