Index: src/gpu/GrLayerCache.cpp |
diff --git a/src/gpu/GrLayerCache.cpp b/src/gpu/GrLayerCache.cpp |
index f60b6a8120a6792aef1f04d7fca8d3af3e897850..d4f8b70b393858cf8db77f1f116fe893a551b5dd 100644 |
--- a/src/gpu/GrLayerCache.cpp |
+++ b/src/gpu/GrLayerCache.cpp |
@@ -94,6 +94,8 @@ GrLayerCache::~GrLayerCache() { |
SkDELETE(layer); |
} |
+ SkASSERT(0 == fPictureHash.count()); |
+ |
// The atlas only lets go of its texture when the atlas is deleted. |
fAtlas.free(); |
} |
@@ -273,6 +275,11 @@ void GrLayerCache::unlock(GrCachedLayer* layer) { |
if (0 == pictInfo->plotUsage(plotID)) { |
GrAtlas::RemovePlot(&pictInfo->fPlotUsage, layer->plot()); |
+ |
+ if (pictInfo->fPlotUsage.isEmpty()) { |
+ fPictureHash.remove(pictInfo->fPictureID); |
+ SkDELETE(pictInfo); |
+ } |
} |
layer->setPlot(NULL); |
@@ -442,6 +449,8 @@ void GrLayerCache::purgeAll() { |
this->purgePlot(plot); |
} |
+ SkASSERT(0 == fPictureHash.count()); |
+ |
fContext->discardRenderTarget(fAtlas->getTexture()->asRenderTarget()); |
} |
#endif |