diff options
author | bsalomon <bsalomon@google.com> | 2015-02-19 08:24:16 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-19 08:24:16 -0800 |
commit | f99e961f55bb603d099c8cb57d05a2ae52a4e9ca (patch) | |
tree | 4639f4c06a127fb69f810f320a2686cfb3e0ba1d /src/gpu/GrGpuResource.cpp | |
parent | 4675819b9dbb3ad71ec851776e5de26d342f29fe (diff) |
Allow resources' unique keys to be changed.
Review URL: https://codereview.chromium.org/938943002
Diffstat (limited to 'src/gpu/GrGpuResource.cpp')
-rw-r--r-- | src/gpu/GrGpuResource.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp index 0c2c9a1849..a2fc7b3b35 100644 --- a/src/gpu/GrGpuResource.cpp +++ b/src/gpu/GrGpuResource.cpp @@ -86,31 +86,23 @@ void GrGpuResource::didChangeGpuMemorySize() const { void GrGpuResource::removeUniqueKey() { SkASSERT(fUniqueKey.isValid()); - get_resource_cache(fGpu)->resourceAccess().willRemoveUniqueKey(this); - fUniqueKey.reset(); + get_resource_cache(fGpu)->resourceAccess().removeUniqueKey(this); } -bool GrGpuResource::setUniqueKey(const GrUniqueKey& key) { - // Currently this can only be called once and can't be called when the resource is scratch. +void GrGpuResource::setUniqueKey(const GrUniqueKey& key) { SkASSERT(this->internalHasRef()); SkASSERT(key.isValid()); // Wrapped and uncached resources can never have a unique key. if (!this->resourcePriv().isBudgeted()) { - return false; + return; } - if (fUniqueKey.isValid() || this->wasDestroyed()) { - return false; + if (this->wasDestroyed()) { + return; } - fUniqueKey = key; - - if (!get_resource_cache(fGpu)->resourceAccess().didSetUniqueKey(this)) { - fUniqueKey.reset(); - return false; - } - return true; + get_resource_cache(fGpu)->resourceAccess().changeUniqueKey(this, key); } void GrGpuResource::notifyIsPurgeable() const { |