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

Unified Diff: src/gpu/GrResourceCache2.h

Issue 815833004: Add a simpler key type for scratch resource keys. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: final fix Created 6 years 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/GrPathRange.h ('k') | src/gpu/GrResourceCache2.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrResourceCache2.h
diff --git a/src/gpu/GrResourceCache2.h b/src/gpu/GrResourceCache2.h
index 038e3bc242643caef23f104c67dc54b74c8100f8..5733cff66460bc476fe24560c7528141122b51c7 100644
--- a/src/gpu/GrResourceCache2.h
+++ b/src/gpu/GrResourceCache2.h
@@ -98,12 +98,11 @@ public:
/**
* Find a resource that matches a scratch key.
*/
- GrGpuResource* findAndRefScratchResource(const GrResourceKey& scratchKey, uint32_t flags = 0);
+ GrGpuResource* findAndRefScratchResource(const GrScratchKey& scratchKey, uint32_t flags = 0);
#ifdef SK_DEBUG
// This is not particularly fast and only used for validation, so debug only.
- int countScratchEntriesForKey(const GrResourceKey& scratchKey) const {
- SkASSERT(scratchKey.isScratch());
+ int countScratchEntriesForKey(const GrScratchKey& scratchKey) const {
return fScratchMap.countForKey(scratchKey);
}
#endif
@@ -112,7 +111,6 @@ public:
* Find a resource that matches a content key.
*/
GrGpuResource* findAndRefContentResource(const GrResourceKey& contentKey) {
- SkASSERT(!contentKey.isScratch());
GrGpuResource* resource = fContentHash.find(contentKey);
if (resource) {
resource->ref();
@@ -125,7 +123,6 @@ public:
* Query whether a content key exists in the cache.
*/
bool hasContentKey(const GrResourceKey& contentKey) const {
- SkASSERT(!contentKey.isScratch());
return SkToBool(fContentHash.find(contentKey));
}
@@ -187,13 +184,13 @@ private:
class AvailableForScratchUse;
struct ScratchMapTraits {
- static const GrResourceKey& GetKey(const GrGpuResource& r) {
+ static const GrScratchKey& GetKey(const GrGpuResource& r) {
return r.cacheAccess().getScratchKey();
}
- static uint32_t Hash(const GrResourceKey& key) { return key.getHash(); }
+ static uint32_t Hash(const GrScratchKey& key) { return key.hash(); }
};
- typedef SkTMultiMap<GrGpuResource, GrResourceKey, ScratchMapTraits> ScratchMap;
+ typedef SkTMultiMap<GrGpuResource, GrScratchKey, ScratchMapTraits> ScratchMap;
struct ContentHashTraits {
static const GrResourceKey& GetKey(const GrGpuResource& r) {
« no previous file with comments | « src/gpu/GrPathRange.h ('k') | src/gpu/GrResourceCache2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698