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

Unified Diff: src/gpu/GrGpuResource.cpp

Issue 608883003: GrResourceCache2 manages scratch texture. (Closed) Base URL: https://skia.googlesource.com/skia.git@surfimpl
Patch Set: remove todo 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | src/gpu/GrGpuResourceRef.cpp » ('j') | 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 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());
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | src/gpu/GrGpuResourceRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698