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

Side by Side Diff: tests/ResourceCacheTest.cpp

Issue 874693002: Fix the speeling of "purgeable" in Gr code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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 | « src/lazy/SkDiscardablePixelRef.cpp ('k') | 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 #if SK_SUPPORT_GPU 8 #if SK_SUPPORT_GPU
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 262
263 // Make sure sizes are as we expect 263 // Make sure sizes are as we expect
264 REPORTER_ASSERT(reporter, 4 == cache2->getResourceCount()); 264 REPORTER_ASSERT(reporter, 4 == cache2->getResourceCount());
265 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + content->gpuMemorySize( ) + 265 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + content->gpuMemorySize( ) +
266 wrapped->gpuMemorySize() + unbudgeted->gpuMemorySi ze() == 266 wrapped->gpuMemorySize() + unbudgeted->gpuMemorySi ze() ==
267 cache2->getResourceBytes()); 267 cache2->getResourceBytes());
268 REPORTER_ASSERT(reporter, 2 == cache2->getBudgetedResourceCount()); 268 REPORTER_ASSERT(reporter, 2 == cache2->getBudgetedResourceCount());
269 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + content->gpuMemorySize( ) == 269 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + content->gpuMemorySize( ) ==
270 cache2->getBudgetedResourceBytes()); 270 cache2->getBudgetedResourceBytes());
271 271
272 // Our refs mean that the resources are non purgable. 272 // Our refs mean that the resources are non purgeable.
273 cache2->purgeAllUnlocked(); 273 cache2->purgeAllUnlocked();
274 REPORTER_ASSERT(reporter, 4 == cache2->getResourceCount()); 274 REPORTER_ASSERT(reporter, 4 == cache2->getResourceCount());
275 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + content->gpuMemorySize( ) + 275 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + content->gpuMemorySize( ) +
276 wrapped->gpuMemorySize() + unbudgeted->gpuMemorySi ze() == 276 wrapped->gpuMemorySize() + unbudgeted->gpuMemorySi ze() ==
277 cache2->getResourceBytes()); 277 cache2->getResourceBytes());
278 REPORTER_ASSERT(reporter, 2 == cache2->getBudgetedResourceCount()); 278 REPORTER_ASSERT(reporter, 2 == cache2->getBudgetedResourceCount());
279 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + content->gpuMemorySize( ) == 279 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + content->gpuMemorySize( ) ==
280 cache2->getBudgetedResourceBytes()); 280 cache2->getBudgetedResourceBytes());
281 281
282 // Unreffing the wrapped resource should free it right away. 282 // Unreffing the wrapped resource should free it right away.
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 GrScratchKey scratchKey; 465 GrScratchKey scratchKey;
466 TestResource::ComputeScratchKey(TestResource::kProperty2_SimulatedProperty, &scratchKey); 466 TestResource::ComputeScratchKey(TestResource::kProperty2_SimulatedProperty, &scratchKey);
467 467
468 // Scratch resources are registered with GrResourceCache2 just by existing. There are 2. 468 // Scratch resources are registered with GrResourceCache2 just by existing. There are 2.
469 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); 469 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
470 SkDEBUGCODE(REPORTER_ASSERT(reporter, 2 == cache2->countScratchEntriesForKey (scratchKey));) 470 SkDEBUGCODE(REPORTER_ASSERT(reporter, 2 == cache2->countScratchEntriesForKey (scratchKey));)
471 REPORTER_ASSERT(reporter, 2 == cache2->getResourceCount()); 471 REPORTER_ASSERT(reporter, 2 == cache2->getResourceCount());
472 REPORTER_ASSERT(reporter, a->gpuMemorySize() + b->gpuMemorySize() == 472 REPORTER_ASSERT(reporter, a->gpuMemorySize() + b->gpuMemorySize() ==
473 cache2->getResourceBytes()); 473 cache2->getResourceBytes());
474 474
475 // Our refs mean that the resources are non purgable. 475 // Our refs mean that the resources are non purgeable.
476 cache2->purgeAllUnlocked(); 476 cache2->purgeAllUnlocked();
477 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); 477 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
478 REPORTER_ASSERT(reporter, 2 == cache2->getResourceCount()); 478 REPORTER_ASSERT(reporter, 2 == cache2->getResourceCount());
479 479
480 // Unref but don't purge 480 // Unref but don't purge
481 a->unref(); 481 a->unref();
482 b->unref(); 482 b->unref();
483 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); 483 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
484 SkDEBUGCODE(REPORTER_ASSERT(reporter, 2 == cache2->countScratchEntriesForKey (scratchKey));) 484 SkDEBUGCODE(REPORTER_ASSERT(reporter, 2 == cache2->countScratchEntriesForKey (scratchKey));)
485 485
486 // Purge again. This time resources should be purgable. 486 // Purge again. This time resources should be purgeable.
487 cache2->purgeAllUnlocked(); 487 cache2->purgeAllUnlocked();
488 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive()); 488 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive());
489 REPORTER_ASSERT(reporter, 0 == cache2->getResourceCount()); 489 REPORTER_ASSERT(reporter, 0 == cache2->getResourceCount());
490 SkDEBUGCODE(REPORTER_ASSERT(reporter, 0 == cache2->countScratchEntriesForKey (scratchKey));) 490 SkDEBUGCODE(REPORTER_ASSERT(reporter, 0 == cache2->countScratchEntriesForKey (scratchKey));)
491 } 491 }
492 492
493 static void test_remove_scratch_key(skiatest::Reporter* reporter) { 493 static void test_remove_scratch_key(skiatest::Reporter* reporter) {
494 Mock mock(5, 30000); 494 Mock mock(5, 30000);
495 GrContext* context = mock.context(); 495 GrContext* context = mock.context();
496 GrResourceCache2* cache2 = mock.cache(); 496 GrResourceCache2* cache2 = mock.cache();
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 test_duplicate_scratch_key(reporter); 904 test_duplicate_scratch_key(reporter);
905 test_remove_scratch_key(reporter); 905 test_remove_scratch_key(reporter);
906 test_scratch_key_consistency(reporter); 906 test_scratch_key_consistency(reporter);
907 test_purge_invalidated(reporter); 907 test_purge_invalidated(reporter);
908 test_cache_chained_purge(reporter); 908 test_cache_chained_purge(reporter);
909 test_resource_size_changed(reporter); 909 test_resource_size_changed(reporter);
910 test_large_resource_count(reporter); 910 test_large_resource_count(reporter);
911 } 911 }
912 912
913 #endif 913 #endif
OLDNEW
« 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