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; |
}; |