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

Unified Diff: tests/ResourceCacheTest.cpp

Issue 2298003003: Don't purge resources for trivial GrContext flushes (Closed)
Patch Set: Fix speeling Created 4 years, 4 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 | « src/gpu/GrDrawingManager.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ResourceCacheTest.cpp
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 2af2d69e8ece7cb0a8cff3471a3a4d56353d2609..14705cbb03bd7394ff69bc7afafad8b30e4991e0 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -1195,6 +1195,22 @@ static void test_flush(skiatest::Reporter* reporter) {
}
REPORTER_ASSERT(reporter, 0 == cache->getResourceCount());
+
+ // Verify that calling flush() on a GrContext with nothing to do will not trigger resource
+ // eviction.
+ context->flush();
+ for (int i = 0; i < 10; ++i) {
+ TestResource* r = new TestResource(context->getGpu());
+ GrUniqueKey k;
+ make_unique_key<1>(&k, i);
+ r->resourcePriv().setUniqueKey(k);
+ r->unref();
+ }
+ REPORTER_ASSERT(reporter, 10 == cache->getResourceCount());
+ for (int i = 0; i < 10 * kFlushCount; ++i) {
+ context->flush();
+ }
+ REPORTER_ASSERT(reporter, 10 == cache->getResourceCount());
}
static void test_large_resource_count(skiatest::Reporter* reporter) {
« no previous file with comments | « src/gpu/GrDrawingManager.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698