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

Unified Diff: src/gpu/GrGpuResource.cpp

Issue 938943002: Allow GrGpuResources' unique keys to be changed. (Closed) Base URL: https://skia.googlesource.com/skia.git@rename
Patch Set: Address comments Created 5 years, 10 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 0c2c9a184949a236f6ac462d6c93324ac50a6104..a2fc7b3b3507a7ca2aaccf009c4b94f28a249d92 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 {
« 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