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

Unified Diff: src/gpu/GrResourceCache.h

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/GrGpuResourcePriv.h ('k') | src/gpu/GrResourceCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrResourceCache.h
diff --git a/src/gpu/GrResourceCache.h b/src/gpu/GrResourceCache.h
index a908140aaf19b8723113f4e7e7a9cbe1852d48fe..3e5df38d7729fabd3edb920be4ef22555366ea13 100644
--- a/src/gpu/GrResourceCache.h
+++ b/src/gpu/GrResourceCache.h
@@ -32,9 +32,9 @@ class SkString;
* between two temporary surfaces). The scratch key is set at resource creation time and
* should never change. Resources need not have a scratch key.
* 2) A unique key. This key's meaning is specific to the domain that created the key. Only one
- * resource may have a given unique key. The unique key can be set after resource creation
- * creation. Currently it may only be set once and cannot be cleared. This restriction will
- * be removed.
+ * resource may have a given unique key. The unique key can be set, cleared, or changed
+ * anytime after resource creation.
+ *
* A unique key always takes precedence over a scratch key when a resource has both types of keys.
* If a resource has neither key type then it will be deleted as soon as the last reference to it
* is dropped.
@@ -179,9 +179,9 @@ private:
void removeResource(GrGpuResource*);
void notifyPurgeable(GrGpuResource*);
void didChangeGpuMemorySize(const GrGpuResource*, size_t oldSize);
- bool didSetUniqueKey(GrGpuResource*);
+ void changeUniqueKey(GrGpuResource*, const GrUniqueKey&);
+ void removeUniqueKey(GrGpuResource*);
void willRemoveScratchKey(const GrGpuResource*);
- void willRemoveUniqueKey(const GrGpuResource*);
void didChangeBudgetStatus(GrGpuResource*);
void refAndMakeResourceMRU(GrGpuResource*);
/// @}
@@ -297,20 +297,16 @@ private:
}
/**
- * Called by GrGpuResources when their unique keys change.
- *
- * This currently returns a bool and fails when an existing resource has a key that collides
- * with the new key. In the future it will null out the unique key for the existing resource.
- * The failure is a temporary measure which will be fixed soon.
+ * Called by GrGpuResources to change their unique keys.
*/
- bool didSetUniqueKey(GrGpuResource* resource) { return fCache->didSetUniqueKey(resource); }
+ void changeUniqueKey(GrGpuResource* resource, const GrUniqueKey& newKey) {
+ fCache->changeUniqueKey(resource, newKey);
+ }
/**
- * Called by a GrGpuResource when it removes its unique key.
+ * Called by a GrGpuResource to remove its unique key.
*/
- void willRemoveUniqueKey(GrGpuResource* resource) {
- return fCache->willRemoveUniqueKey(resource);
- }
+ void removeUniqueKey(GrGpuResource* resource) { fCache->removeUniqueKey(resource); }
/**
* Called by a GrGpuResource when it removes its scratch key.
« no previous file with comments | « src/gpu/GrGpuResourcePriv.h ('k') | src/gpu/GrResourceCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698