Index: src/gpu/GrGpuResource.cpp |
diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp |
index a227fd2c0f5ad81ece6dda893a43aa621310cd75..7c8b18d4814fa7cf89d9bb98530caa39c075c185 100644 |
--- a/src/gpu/GrGpuResource.cpp |
+++ b/src/gpu/GrGpuResource.cpp |
@@ -20,11 +20,15 @@ static inline GrResourceCache* get_resource_cache(GrGpu* gpu) { |
return gpu->getContext()->getResourceCache(); |
} |
-GrGpuResource::GrGpuResource(GrGpu* gpu, LifeCycle lifeCycle) |
+GrGpuResource::GrGpuResource(GrGpu* gpu, LifeCycle lifeCycle, Type2 type) |
: fGpu(gpu) |
, fGpuMemorySize(kInvalidGpuMemorySize) |
, fLifeCycle(lifeCycle) |
- , fUniqueID(CreateUniqueID()) { |
+ , fUniqueID(CreateUniqueID()) |
+ , fType1(type) |
+ , fFromRawPixels2(false) |
+ , fException(false) |
+ , fException2(false) { |
SkDEBUGCODE(fCacheArrayIndex = -1); |
} |
@@ -43,6 +47,9 @@ void GrGpuResource::release() { |
get_resource_cache(fGpu)->resourceAccess().removeResource(this); |
fGpu = nullptr; |
fGpuMemorySize = 0; |
+ fFromRawPixels2 = false; |
+ fException = false; |
+ fException2 = false; |
} |
void GrGpuResource::abandon() { |
@@ -54,6 +61,9 @@ void GrGpuResource::abandon() { |
get_resource_cache(fGpu)->resourceAccess().removeResource(this); |
fGpu = nullptr; |
fGpuMemorySize = 0; |
+ fFromRawPixels2 = false; |
+ fException = false; |
+ fException2 = false; |
} |
void GrGpuResource::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
@@ -111,6 +121,13 @@ void GrGpuResource::removeUniqueKey() { |
return; |
} |
SkASSERT(fUniqueKey.isValid()); |
+ |
+ if (fType1 == kSurface) { |
+ SkASSERT(this->fromRawPixels2() || this->fException2); |
+ this->setFromRawPixels(false); |
+ fException = false; |
+ fException2 = false; |
+ } |
get_resource_cache(fGpu)->resourceAccess().removeUniqueKey(this); |
} |