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

Unified Diff: tests/CachedDecodingPixelRefTest.cpp

Issue 114673002: be sure to unlock the discardablememory before deleting it (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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 | « src/lazy/SkDiscardablePixelRef.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/CachedDecodingPixelRefTest.cpp
diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp
index f97e89361fab1b19d734fcdda64c9b959ba16295..04eddd907075193a1323a7768f9b0c0bf039a524 100644
--- a/tests/CachedDecodingPixelRefTest.cpp
+++ b/tests/CachedDecodingPixelRefTest.cpp
@@ -268,12 +268,25 @@ void CheckPixelRef(TestImageGenerator::TestType type,
}
}
} // namespace
+
+// new/lock/delete is an odd pattern for a pixelref, but it needs to not assert
+static void test_newlockdelete(skiatest::Reporter* reporter) {
+ SkBitmap bm;
+ SkImageGenerator* ig = new TestImageGenerator(
+ TestImageGenerator::kSucceedGetPixels_TestType,
+ reporter);
+ SkInstallDiscardablePixelRef(ig, &bm, NULL);
+ bm.pixelRef()->lockPixels();
+}
+
/**
* This tests the basic functionality of SkDiscardablePixelRef with a
* basic SkImageGenerator implementation and several
* SkDiscardableMemory::Factory choices.
*/
DEF_TEST(DiscardableAndCachingPixelRef, reporter) {
+ test_newlockdelete(reporter);
+
CheckPixelRef(TestImageGenerator::kFailGetInfo_TestType,
reporter, kSkCaching_PixelRefType, NULL);
CheckPixelRef(TestImageGenerator::kFailGetPixels_TestType,
« no previous file with comments | « src/lazy/SkDiscardablePixelRef.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698