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

Side by Side Diff: tests/ResourceCacheTest.cpp

Issue 1359333004: Fix leak in ResourceCache test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 // Include here to ensure SK_SUPPORT_GPU is set correctly before it is examined. 8 // Include here to ensure SK_SUPPORT_GPU is set correctly before it is examined.
9 #include "SkTypes.h" 9 #include "SkTypes.h"
10 10
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 REPORTER_ASSERT(reporter, key2.getCustomData() == nullptr); 1246 REPORTER_ASSERT(reporter, key2.getCustomData() == nullptr);
1247 1247
1248 // Test that copying a key also takes a ref on its custom data. 1248 // Test that copying a key also takes a ref on its custom data.
1249 GrUniqueKey key3 = key1; 1249 GrUniqueKey key3 = key1;
1250 REPORTER_ASSERT(reporter, *(int*) key3.getCustomData()->data() == 4132); 1250 REPORTER_ASSERT(reporter, *(int*) key3.getCustomData()->data() == 4132);
1251 } 1251 }
1252 1252
1253 static void test_abandoned(skiatest::Reporter* reporter) { 1253 static void test_abandoned(skiatest::Reporter* reporter) {
1254 Mock mock(10, 300); 1254 Mock mock(10, 300);
1255 GrContext* context = mock.context(); 1255 GrContext* context = mock.context();
1256 TestResource* resource = new TestResource(context->getGpu()); 1256 SkAutoTUnref<GrGpuResource> resource(new TestResource(context->getGpu()));
1257 context->abandonContext(); 1257 context->abandonContext();
1258 1258
1259 REPORTER_ASSERT(reporter, resource->wasDestroyed()); 1259 REPORTER_ASSERT(reporter, resource->wasDestroyed());
1260 1260
1261 // Call all the public methods on resource in the abandoned state. They shou ldn't crash. 1261 // Call all the public methods on resource in the abandoned state. They shou ldn't crash.
1262 1262
1263 int foo = 4132; 1263 int foo = 4132;
1264 SkAutoTUnref<SkData> data(SkData::NewWithCopy(&foo, sizeof(foo))); 1264 SkAutoTUnref<SkData> data(SkData::NewWithCopy(&foo, sizeof(foo)));
1265 resource->setCustomData(data.get()); 1265 resource->setCustomData(data.get());
1266 resource->getCustomData(); 1266 resource->getCustomData();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 test_cache_chained_purge(reporter); 1319 test_cache_chained_purge(reporter);
1320 test_resource_size_changed(reporter); 1320 test_resource_size_changed(reporter);
1321 test_timestamp_wrap(reporter); 1321 test_timestamp_wrap(reporter);
1322 test_flush(reporter); 1322 test_flush(reporter);
1323 test_large_resource_count(reporter); 1323 test_large_resource_count(reporter);
1324 test_custom_data(reporter); 1324 test_custom_data(reporter);
1325 test_abandoned(reporter); 1325 test_abandoned(reporter);
1326 } 1326 }
1327 1327
1328 #endif 1328 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698