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

Unified Diff: cc/tiles/software_image_decode_cache_unittest.cc

Issue 2795803002: Clear Image Decode Cache on Navigation (Closed)
Patch Set: fix conversion Created 3 years, 8 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 | « cc/tiles/software_image_decode_cache.cc ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/software_image_decode_cache_unittest.cc
diff --git a/cc/tiles/software_image_decode_cache_unittest.cc b/cc/tiles/software_image_decode_cache_unittest.cc
index 8df5b9c8746b4f43d07df17d7a5a7c1ac8e69db9..2a8d15256308a453f50d3438e74dce0e979f1ae5 100644
--- a/cc/tiles/software_image_decode_cache_unittest.cc
+++ b/cc/tiles/software_image_decode_cache_unittest.cc
@@ -1446,5 +1446,32 @@ TEST(SoftwareImageDecodeCacheTest,
cache.UnrefImage(draw_image_49);
}
+TEST(SoftwareImageDecodeCacheTest, ClearCache) {
+ TestSoftwareImageDecodeCache cache;
+ bool is_decomposable = true;
+ SkFilterQuality quality = kHigh_SkFilterQuality;
+
+ for (int i = 0; i < 10; ++i) {
+ sk_sp<SkImage> image = CreateImage(100, 100);
+ DrawImage draw_image(
+ image, SkIRect::MakeWH(image->width(), image->height()), quality,
+ CreateMatrix(SkSize::Make(1.0f, 1.0f), is_decomposable));
+ scoped_refptr<TileTask> task;
+ bool need_unref = cache.GetTaskForImageAndRef(
+ draw_image, ImageDecodeCache::TracingInfo(), &task);
+ EXPECT_TRUE(need_unref);
+ EXPECT_TRUE(task);
+ TestTileTaskRunner::ProcessTask(task.get());
+ cache.UnrefImage(draw_image);
+ }
+
+ EXPECT_EQ(10u, cache.GetNumCacheEntriesForTesting());
+
+ // Tell our cache to clear resources.
+ cache.ClearCache();
+
+ EXPECT_EQ(0u, cache.GetNumCacheEntriesForTesting());
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/tiles/software_image_decode_cache.cc ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698