Lines Matching defs:cache
40 static void test_mipmapcache(skiatest::Reporter* reporter, SkResourceCache* cache) {
41 cache->purgeAll();
49 const SkMipmap* mipmap = SkMipmapCache::FindAndRef(desc, cache);
52 mipmap = SkMipmapCache::AddAndRef(as_IB(img.get()), cache);
56 const SkMipmap* mm = SkMipmapCache::FindAndRef(desc, cache);
65 // tricky, since technically after this I'm no longer an owner, but since the cache is
70 mipmap = SkMipmapCache::FindAndRef(desc, cache);
73 cache->purgeAll();
79 static void test_mipmap_notify(skiatest::Reporter* reporter, SkResourceCache* cache) {
89 SkMipmapCache::AddAndRef(as_IB(img[i].get()), cache)->unref();
94 const SkMipmap* mipmap = SkMipmapCache::FindAndRef(desc[i], cache);
95 // We're always using a local cache, so we know we won't be purged by other threads
99 img[i].reset(); // delete the image, which *should not* remove us from the cache
100 mipmap = SkMipmapCache::FindAndRef(desc[i], cache);
104 src[i].reset(); // delete the underlying pixelref, which *should* remove us from the cache
105 mipmap = SkMipmapCache::FindAndRef(desc[i], cache);
121 static void testBitmapCache_discarded_bitmap(skiatest::Reporter* reporter, SkResourceCache* cache,
123 test_mipmapcache(reporter, cache);
124 test_mipmap_notify(reporter, cache);
130 SkResourceCache cache(byteLimit);
131 testBitmapCache_discarded_bitmap(reporter, &cache, nullptr);
137 SkResourceCache cache(factory);
138 testBitmapCache_discarded_bitmap(reporter, &cache, factory);
174 // Verify that associated bitmap cache entries are purged on SkImage destruction.
181 // To exercise the first cache type, we use generated/picture-backed SkImages.
242 static void test_duplicate_add(SkResourceCache* cache, skiatest::Reporter* reporter,
259 cache->add(rec0.release(), nullptr);
264 cache->add(rec1.release(), nullptr);
273 r0->fCanBePurged = true; // so we can cleanup the cache
283 SkResourceCache cache(1024 * 1024);
284 test_duplicate_add(&cache, reporter, purgable);
287 SkResourceCache cache(SkDiscardableMemory::Create);
288 test_duplicate_add(&cache, reporter, purgable);