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

Unified Diff: tests/ResourceCacheTest.cpp

Issue 1270103003: Fix SkData leaks at GrResourceKey::setCustomData() call sites. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 | « src/gpu/GrTessellatingPathRenderer.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ResourceCacheTest.cpp
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 65b7b7ca2de630613aedd57873427d470ffa7562..a4acab86a19a968fa97a229602420cfcfec0301a 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -851,7 +851,8 @@ static void test_duplicate_unique_key(skiatest::Reporter* reporter) {
make_unique_key<0>(&key2, 0);
SkAutoTUnref<TestResource> d(SkNEW_ARGS(TestResource, (context->getGpu())));
int foo = 4132;
- key2.setCustomData(SkData::NewWithCopy(&foo, sizeof(foo)));
+ SkAutoTUnref<SkData> data(SkData::NewWithCopy(&foo, sizeof(foo)));
+ key2.setCustomData(data.get());
d->resourcePriv().setUniqueKey(key2);
}
@@ -1240,7 +1241,8 @@ static void test_large_resource_count(skiatest::Reporter* reporter) {
static void test_custom_data(skiatest::Reporter* reporter) {
GrUniqueKey key1, key2;
int foo = 4132;
- key1.setCustomData(SkData::NewWithCopy(&foo, sizeof(foo)));
+ SkAutoTUnref<SkData> data(SkData::NewWithCopy(&foo, sizeof(foo)));
+ key1.setCustomData(data.get());
REPORTER_ASSERT(reporter, *(int*) key1.getCustomData()->data() == 4132);
REPORTER_ASSERT(reporter, key2.getCustomData() == nullptr);
« no previous file with comments | « src/gpu/GrTessellatingPathRenderer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698