diff options
author | bsalomon <bsalomon@google.com> | 2014-09-03 14:05:49 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-03 14:05:49 -0700 |
commit | 00b76bd750e668a6989dd497313e715d1b476fdc (patch) | |
tree | 62342a335023875d1482447bea9e29e8a0ba22fb /src | |
parent | ab799fe66c69e70b05c88791350c59c015e214ff (diff) |
Add reference base class to GrGpuResourcewith pending IO references.
BUG=skia:2889
R=robertphillips@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/533343002
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/GrGpuResource.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp index bce7d2cae8..d29ab6d486 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()); } |