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

Unified Diff: src/gpu/GrGpuResource.cpp

Issue 533343002: Add reference base class to GrGpuResource with pending IO references. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add comment Created 6 years, 3 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 | « include/gpu/GrGpuResource.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrGpuResource.cpp
diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp
index bce7d2cae8b9c85661d1c9be14c9c63dd9ad5c53..d29ab6d486059b03bb00b92ebdf03ea3eabc0774 100644
--- a/src/gpu/GrGpuResource.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -11,6 +11,16 @@
#include "GrResourceCache2.h"
#include "GrGpu.h"
+GrGpuRef::~GrGpuRef() {
+ SkASSERT(0 == fRefCnt);
+ SkASSERT(0 == fPendingReads);
+ SkASSERT(0 == fPendingWrites);
+ // Set to invalid values.
+ SkDEBUGCODE(fRefCnt = fPendingReads = fPendingWrites = -10;)
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
static inline GrResourceCache2* get_resource_cache2(GrGpu* gpu) {
SkASSERT(NULL != gpu);
SkASSERT(NULL != gpu->getContext());
@@ -20,7 +30,6 @@ static inline GrResourceCache2* get_resource_cache2(GrGpu* gpu) {
GrGpuResource::GrGpuResource(GrGpu* gpu, bool isWrapped)
: fGpu(gpu)
- , fRefCnt(1)
, fCacheEntry(NULL)
, fUniqueID(CreateUniqueID())
, fScratchKey(GrResourceKey::NullScratchKey()) {
@@ -36,7 +45,6 @@ void GrGpuResource::registerWithCache() {
}
GrGpuResource::~GrGpuResource() {
- SkASSERT(0 == fRefCnt);
// subclass should have released this.
SkASSERT(this->wasDestroyed());
}
« no previous file with comments | « include/gpu/GrGpuResource.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698