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

Unified Diff: src/gpu/GrGpuResource.cpp

Issue 858123002: Add specialized content key class for resources. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove default template arg Created 5 years, 11 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/GrContext.cpp ('k') | src/gpu/GrGpuResourceCacheAccess.h » ('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 2f267a41970609990bb2fae4f5ce07a83ed01715..3e9964f1a029642642a0bd39b69d32c4c3e8867c 100644
--- a/src/gpu/GrGpuResource.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -20,7 +20,6 @@ static inline GrResourceCache2* get_resource_cache2(GrGpu* gpu) {
GrGpuResource::GrGpuResource(GrGpu* gpu, LifeCycle lifeCycle)
: fGpu(gpu)
, fGpuMemorySize(kInvalidGpuMemorySize)
- , fFlags(0)
, fLifeCycle(lifeCycle)
, fUniqueID(CreateUniqueID()) {
}
@@ -83,7 +82,7 @@ void GrGpuResource::didChangeGpuMemorySize() const {
get_resource_cache2(fGpu)->resourceAccess().didChangeGpuMemorySize(this, oldSize);
}
-bool GrGpuResource::setContentKey(const GrResourceKey& contentKey) {
+bool GrGpuResource::setContentKey(const GrContentKey& key) {
// Currently this can only be called once and can't be called when the resource is scratch.
SkASSERT(this->internalHasRef());
@@ -92,15 +91,14 @@ bool GrGpuResource::setContentKey(const GrResourceKey& contentKey) {
return false;
}
- if ((fFlags & kContentKeySet_Flag) || this->wasDestroyed()) {
+ if (fContentKey.isValid() || this->wasDestroyed()) {
return false;
}
- fContentKey = contentKey;
- fFlags |= kContentKeySet_Flag;
+ fContentKey = key;
if (!get_resource_cache2(fGpu)->resourceAccess().didSetContentKey(this)) {
- fFlags &= ~kContentKeySet_Flag;
+ fContentKey.reset();
return false;
}
return true;
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrGpuResourceCacheAccess.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698