| Index: src/gpu/GrGpuResource.cpp
|
| diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp
|
| index bba934e6059e5851721545dc916e49d10024c735..a074d7c29e0bbffd09dac65b75b6957cbf9e66e9 100644
|
| --- a/src/gpu/GrGpuResource.cpp
|
| +++ b/src/gpu/GrGpuResource.cpp
|
| @@ -11,7 +11,7 @@
|
| #include "GrResourceCache2.h"
|
| #include "GrGpu.h"
|
|
|
| -GrIORef::~GrIORef() {
|
| +template<typename D> GrIORef<D>::~GrIORef() {
|
| SkASSERT(0 == fRefCnt);
|
| SkASSERT(0 == fPendingReads);
|
| SkASSERT(0 == fPendingWrites);
|
| @@ -28,6 +28,13 @@ static inline GrResourceCache2* get_resource_cache2(GrGpu* gpu) {
|
| return gpu->getContext()->getResourceCache2();
|
| }
|
|
|
| +static inline GrResourceCache* get_resource_cache(GrGpu* gpu) {
|
| + SkASSERT(gpu);
|
| + SkASSERT(gpu->getContext());
|
| + SkASSERT(gpu->getContext()->getResourceCache());
|
| + return gpu->getContext()->getResourceCache();
|
| +}
|
| +
|
| GrGpuResource::GrGpuResource(GrGpu* gpu, bool isWrapped)
|
| : fGpu(gpu)
|
| , fCacheEntry(NULL)
|
| @@ -81,6 +88,12 @@ GrContext* GrGpuResource::getContext() {
|
| }
|
| }
|
|
|
| +void GrGpuResource::notifyIsPurgable() const {
|
| + if (fCacheEntry && !this->wasDestroyed()) {
|
| + get_resource_cache(fGpu)->notifyPurgable(this);
|
| + }
|
| +}
|
| +
|
| void GrGpuResource::setScratchKey(const GrResourceKey& scratchKey) {
|
| SkASSERT(fScratchKey.isNullScratch());
|
| SkASSERT(scratchKey.isScratch());
|
|
|