aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/core/SkMallocPixelRef.h1
-rw-r--r--include/gpu/SkGrPixelRef.h2
-rw-r--r--src/core/SkScaledImageCache.cpp1
-rw-r--r--src/lazy/SkCachingPixelRef.h1
-rw-r--r--src/lazy/SkDiscardablePixelRef.h1
-rw-r--r--tests/CachedDecodingPixelRefTest.cpp9
6 files changed, 15 insertions, 0 deletions
diff --git a/include/core/SkMallocPixelRef.h b/include/core/SkMallocPixelRef.h
index aaa045f948..6642af57bb 100644
--- a/include/core/SkMallocPixelRef.h
+++ b/include/core/SkMallocPixelRef.h
@@ -16,6 +16,7 @@
*/
class SK_API SkMallocPixelRef : public SkPixelRef {
public:
+ SK_DECLARE_INST_COUNT(SkMallocPixelRef)
/**
* Return a new SkMallocPixelRef with the provided pixel storage, rowBytes,
* and optional colortable. The caller is responsible for managing the
diff --git a/include/gpu/SkGrPixelRef.h b/include/gpu/SkGrPixelRef.h
index 63e975673f..1e495611fc 100644
--- a/include/gpu/SkGrPixelRef.h
+++ b/include/gpu/SkGrPixelRef.h
@@ -20,6 +20,7 @@
*/
class SK_API SkROLockPixelsPixelRef : public SkPixelRef {
public:
+ SK_DECLARE_INST_COUNT(SkROLockPixelsPixelRef)
SkROLockPixelsPixelRef(const SkImageInfo&);
virtual ~SkROLockPixelsPixelRef();
@@ -38,6 +39,7 @@ private:
*/
class SK_API SkGrPixelRef : public SkROLockPixelsPixelRef {
public:
+ SK_DECLARE_INST_COUNT(SkGrPixelRef)
/**
* Constructs a pixel ref around a GrSurface. If the caller has locked the GrSurface in the
* cache and would like the pixel ref to unlock it in its destructor then transferCacheLock
diff --git a/src/core/SkScaledImageCache.cpp b/src/core/SkScaledImageCache.cpp
index d87597315f..2bc692a51b 100644
--- a/src/core/SkScaledImageCache.cpp
+++ b/src/core/SkScaledImageCache.cpp
@@ -192,6 +192,7 @@ void SkScaledImageCache::init() {
class SkOneShotDiscardablePixelRef : public SkPixelRef {
public:
+ SK_DECLARE_INST_COUNT(SkOneShotDiscardablePixelRef)
// Ownership of the discardablememory is transfered to the pixelref
SkOneShotDiscardablePixelRef(const SkImageInfo&, SkDiscardableMemory*, size_t rowBytes);
~SkOneShotDiscardablePixelRef();
diff --git a/src/lazy/SkCachingPixelRef.h b/src/lazy/SkCachingPixelRef.h
index 905ee9bf0d..b73a2ca443 100644
--- a/src/lazy/SkCachingPixelRef.h
+++ b/src/lazy/SkCachingPixelRef.h
@@ -25,6 +25,7 @@ class SkColorTable;
*/
class SkCachingPixelRef : public SkPixelRef {
public:
+ SK_DECLARE_INST_COUNT(SkCachingPixelRef)
/**
* Takes ownership of SkImageGenerator. If this method fails for
* whatever reason, it will return false and immediatetely delete
diff --git a/src/lazy/SkDiscardablePixelRef.h b/src/lazy/SkDiscardablePixelRef.h
index 4a013fda03..cbc2a89ac4 100644
--- a/src/lazy/SkDiscardablePixelRef.h
+++ b/src/lazy/SkDiscardablePixelRef.h
@@ -24,6 +24,7 @@
*/
class SkDiscardablePixelRef : public SkPixelRef {
public:
+ SK_DECLARE_INST_COUNT(SkDiscardablePixelRef)
SK_DECLARE_UNFLATTENABLE_OBJECT()
protected:
diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp
index 9ac5f81392..d725ff5fc9 100644
--- a/tests/CachedDecodingPixelRefTest.cpp
+++ b/tests/CachedDecodingPixelRefTest.cpp
@@ -142,6 +142,12 @@ static void test_three_encodings(skiatest::Reporter* reporter,
}
}
+static void purge_global_scaled_image_cache() {
+ size_t byteLimit = SkScaledImageCache::GetByteLimit();
+ SkScaledImageCache::SetByteLimit(0);
+ SkScaledImageCache::SetByteLimit(byteLimit);
+}
+
////////////////////////////////////////////////////////////////////////////////
static bool install_skCachingPixelRef(SkData* encoded, SkBitmap* dst) {
return SkCachingPixelRef::Install(
@@ -163,6 +169,7 @@ static bool install_skDiscardablePixelRef(SkData* encoded, SkBitmap* dst) {
*/
DEF_TEST(DecodingImageGenerator, reporter) {
test_three_encodings(reporter, install_skCachingPixelRef);
+ purge_global_scaled_image_cache();
test_three_encodings(reporter, install_skDiscardablePixelRef);
}
@@ -295,6 +302,8 @@ DEF_TEST(DiscardableAndCachingPixelRef, reporter) {
check_pixelref(TestImageGenerator::kSucceedGetPixels_TestType,
reporter, kSkCaching_PixelRefType, NULL);
+ purge_global_scaled_image_cache();
+
check_pixelref(TestImageGenerator::kFailGetInfo_TestType,
reporter, kSkDiscardable_PixelRefType, NULL);
check_pixelref(TestImageGenerator::kFailGetPixels_TestType,