Add a debug assert to track down infinite loop
Bug: 26980851
Change-Id: I326983ab367782048311b6cf06d800f72837e38e
diff --git a/libs/hwui/GradientCache.cpp b/libs/hwui/GradientCache.cpp
index e899ac7..eec9ed1 100644
--- a/libs/hwui/GradientCache.cpp
+++ b/libs/hwui/GradientCache.cpp
@@ -168,10 +168,13 @@
texture->blend = info.hasAlpha;
texture->generation = 1;
- // Asume the cache is always big enough
+ // Assume the cache is always big enough
const uint32_t size = info.width * 2 * bytesPerPixel();
while (getSize() + size > mMaxSize) {
- mCache.removeOldest();
+ LOG_ALWAYS_FATAL_IF(!mCache.removeOldest(),
+ "Ran out of things to remove from the cache? getSize() = %" PRIu32
+ ", size = %" PRIu32 ", mMaxSize = %" PRIu32 ", width = %" PRIu32,
+ getSize(), size, mMaxSize, info.width);
}
generateTexture(colors, positions, info.width, 2, texture);