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

Side by Side Diff: include/gpu/GrGpuResource.h

Issue 641813002: call derived ~ from GrIORef (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrGpuResource_DEFINED 8 #ifndef GrGpuResource_DEFINED
9 #define GrGpuResource_DEFINED 9 #define GrGpuResource_DEFINED
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 void completedWrite() const { 96 void completedWrite() const {
97 this->validate(); 97 this->validate();
98 --fPendingWrites; 98 --fPendingWrites;
99 this->didUnref(); 99 this->didUnref();
100 } 100 }
101 101
102 private: 102 private:
103 void didUnref() const { 103 void didUnref() const {
104 if (0 == fPendingReads && 0 == fPendingWrites) { 104 if (0 == fPendingReads && 0 == fPendingWrites) {
105 if (0 == fRefCnt) { 105 if (0 == fRefCnt) {
106 SkDELETE(this); 106 // Must call derived destructor since this is not a virtual clas s.
107 SkDELETE(static_cast<const DERIVED*>(this));
107 } else if (1 == fRefCnt) { 108 } else if (1 == fRefCnt) {
108 // The one ref is the cache's 109 // The one ref is the cache's
109 static_cast<const DERIVED*>(this)->notifyIsPurgable(); 110 static_cast<const DERIVED*>(this)->notifyIsPurgable();
110 } 111 }
111 } 112 }
112 } 113 }
113 114
114 mutable int32_t fRefCnt; 115 mutable int32_t fRefCnt;
115 mutable int32_t fPendingReads; 116 mutable int32_t fPendingReads;
116 mutable int32_t fPendingWrites; 117 mutable int32_t fPendingWrites;
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache 260 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache
260 const uint32_t fUniqueID; 261 const uint32_t fUniqueID;
261 262
262 GrResourceKey fScratchKey; 263 GrResourceKey fScratchKey;
263 264
264 typedef GrIORef<GrGpuResource> INHERITED; 265 typedef GrIORef<GrGpuResource> INHERITED;
265 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgable. 266 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgable.
266 }; 267 };
267 268
268 #endif 269 #endif
OLDNEW
« 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