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

Unified Diff: src/gpu/GrLayerCache.h

Issue 431603002: Fix ref counting of cached layer's texture (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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 | « no previous file | src/gpu/GrLayerCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrLayerCache.h
diff --git a/src/gpu/GrLayerCache.h b/src/gpu/GrLayerCache.h
index c5fa236388e1915d39a127d984d3ec47d35509dd..184660837692e5963550a8b9864c372cd7f125ee 100644
--- a/src/gpu/GrLayerCache.h
+++ b/src/gpu/GrLayerCache.h
@@ -82,16 +82,16 @@ public:
SkASSERT(SK_InvalidGenID != pictureID && layerID >= 0);
}
+ ~GrCachedLayer() {
+ SkSafeUnref(fTexture);
+ }
+
uint32_t pictureID() const { return fKey.getPictureID(); }
int layerID() const { return fKey.getLayerID(); }
// This call takes over the caller's ref
bsalomon 2014/07/30 14:10:38 Isn't this comment wrong now?
robertphillips 2014/07/30 14:19:10 Done.
void setTexture(GrTexture* texture, const GrIRect16& rect) {
- if (NULL != fTexture) {
- fTexture->unref();
- }
-
- fTexture = texture; // just take over caller's ref
+ SkRefCnt_SafeAssign(fTexture, texture);
fRect = rect;
}
GrTexture* texture() { return fTexture; }
« no previous file with comments | « no previous file | src/gpu/GrLayerCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698