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

Unified Diff: tests/GpuLayerCacheTest.cpp

Issue 640323002: Fix bug in GrCachedLayer reuse (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Improve comment Created 6 years, 2 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/GrLayerHoister.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/GpuLayerCacheTest.cpp
diff --git a/tests/GpuLayerCacheTest.cpp b/tests/GpuLayerCacheTest.cpp
index 9e070564214a38a21527cff4ad9d411cfe9216df..f7b2d6ef3e44eb22df6a68e80b4b8703451c2b40 100644
--- a/tests/GpuLayerCacheTest.cpp
+++ b/tests/GpuLayerCacheTest.cpp
@@ -21,6 +21,9 @@ public:
static void Purge(GrLayerCache* cache, uint32_t pictureID) {
cache->purge(pictureID);
}
+ static int Uses(GrCachedLayer* layer) {
+ return layer->uses();
+ }
};
// Add several layers to the cache
@@ -70,6 +73,10 @@ static void lock_layer(skiatest::Reporter* reporter,
REPORTER_ASSERT(reporter, layer->texture());
REPORTER_ASSERT(reporter, layer->locked());
+
+ cache->addUse(layer);
+
+ REPORTER_ASSERT(reporter, 1 == TestingAccess::Uses(layer));
}
// This test case exercises the public API of the GrLayerCache class.
@@ -120,20 +127,22 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
for (int i = 0; i < kInitialNumLayers; ++i) {
GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, SkMatrix::I());
REPORTER_ASSERT(reporter, layer);
- cache.unlock(layer);
+ cache.removeUse(layer);
}
for (int i = 0; i < kInitialNumLayers; ++i) {
GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, SkMatrix::I());
REPORTER_ASSERT(reporter, layer);
+ // All the layers should be unlocked
REPORTER_ASSERT(reporter, !layer->locked());
+
// The first 4 layers should still be in the atlas.
if (i < 4) {
REPORTER_ASSERT(reporter, layer->texture());
REPORTER_ASSERT(reporter, layer->isAtlased());
} else {
- // The final layer should be unlocked.
+ // The final layer should not be atlased.
REPORTER_ASSERT(reporter, NULL == layer->texture());
REPORTER_ASSERT(reporter, !layer->isAtlased());
}
@@ -148,7 +157,7 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
REPORTER_ASSERT(reporter, layer);
lock_layer(reporter, &cache, layer);
- cache.unlock(layer);
+ cache.removeUse(layer);
}
for (int i = 0; i < kInitialNumLayers+1; ++i) {
« no previous file with comments | « src/gpu/GrLayerHoister.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698