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

Unified Diff: src/gpu/GrLayerCache.cpp

Issue 703643002: Fix layer cache memory leak (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698