diff options
author | bsalomon <bsalomon@google.com> | 2015-01-23 04:24:04 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-23 04:24:05 -0800 |
commit | 24db3b1c35fb935660229da164fc5ad31977387f (patch) | |
tree | be22e794f54605ff37ef09df79b3e0869572b053 /src/gpu/GrGpuResource.cpp | |
parent | f98f2bb0e72df68320f707c8584e3c877ce98ec3 (diff) |
Add specialized content key class for resources.
Review URL: https://codereview.chromium.org/858123002
Diffstat (limited to 'src/gpu/GrGpuResource.cpp')
-rw-r--r-- | src/gpu/GrGpuResource.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp index 2f267a4197..3e9964f1a0 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; |