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

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: Remove incorrect comment 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..f4087d66f0c4fea08af7addff2b2899c2933fdf1 100644
--- a/src/gpu/GrLayerCache.h
+++ b/src/gpu/GrLayerCache.h
@@ -82,16 +82,15 @@ 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
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