OLD | NEW |
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 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 static void test_abandoned(skiatest::Reporter* reporter) { | 1273 static void test_abandoned(skiatest::Reporter* reporter) { |
1274 Mock mock(10, 300); | 1274 Mock mock(10, 300); |
1275 GrContext* context = mock.context(); | 1275 GrContext* context = mock.context(); |
1276 SkAutoTUnref<GrGpuResource> resource(new TestResource(context->getGpu())); | 1276 SkAutoTUnref<GrGpuResource> resource(new TestResource(context->getGpu())); |
1277 context->abandonContext(); | 1277 context->abandonContext(); |
1278 | 1278 |
1279 REPORTER_ASSERT(reporter, resource->wasDestroyed()); | 1279 REPORTER_ASSERT(reporter, resource->wasDestroyed()); |
1280 | 1280 |
1281 // Call all the public methods on resource in the abandoned state. They shou
ldn't crash. | 1281 // Call all the public methods on resource in the abandoned state. They shou
ldn't crash. |
1282 | 1282 |
1283 int foo = 4132; | |
1284 sk_sp<SkData> data(SkData::MakeWithCopy(&foo, sizeof(foo))); | |
1285 resource->getUniqueID(); | 1283 resource->getUniqueID(); |
1286 resource->getUniqueKey(); | 1284 resource->getUniqueKey(); |
1287 resource->wasDestroyed(); | 1285 resource->wasDestroyed(); |
1288 resource->gpuMemorySize(); | 1286 resource->gpuMemorySize(); |
1289 resource->getContext(); | 1287 resource->getContext(); |
1290 | 1288 |
1291 resource->abandon(); | 1289 resource->abandon(); |
1292 resource->resourcePriv().getScratchKey(); | 1290 resource->resourcePriv().getScratchKey(); |
1293 resource->resourcePriv().isBudgeted(); | 1291 resource->resourcePriv().isBudgeted(); |
1294 resource->resourcePriv().makeBudgeted(); | 1292 resource->resourcePriv().makeBudgeted(); |
(...skipping 19 matching lines...) Expand all Loading... |
1314 test_cache_chained_purge(reporter); | 1312 test_cache_chained_purge(reporter); |
1315 test_resource_size_changed(reporter); | 1313 test_resource_size_changed(reporter); |
1316 test_timestamp_wrap(reporter); | 1314 test_timestamp_wrap(reporter); |
1317 test_flush(reporter); | 1315 test_flush(reporter); |
1318 test_large_resource_count(reporter); | 1316 test_large_resource_count(reporter); |
1319 test_custom_data(reporter); | 1317 test_custom_data(reporter); |
1320 test_abandoned(reporter); | 1318 test_abandoned(reporter); |
1321 } | 1319 } |
1322 | 1320 |
1323 #endif | 1321 #endif |
OLD | NEW |