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

Unified Diff: src/gpu/GrResourceCache.h

Issue 705413002: Remove GrResourceKey from GrResourceCache (Closed) Base URL: https://skia.googlesource.com/skia.git@content
Patch Set: update Created 6 years, 1 month 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
Index: src/gpu/GrResourceCache.h
diff --git a/src/gpu/GrResourceCache.h b/src/gpu/GrResourceCache.h
index 874f16ac63d9932d7fbdf9e72bf0a2b1801b87b9..80e4b3f1e40d0e499f7d67def7a8b7c2ce1f7c8c 100644
--- a/src/gpu/GrResourceCache.h
+++ b/src/gpu/GrResourceCache.h
@@ -30,10 +30,10 @@ struct GrResourceInvalidatedMessage {
class GrResourceCacheEntry {
public:
GrGpuResource* resource() const { return fResource; }
- const GrResourceKey& key() const { return fKey; }
- static const GrResourceKey& GetKey(const GrResourceCacheEntry& e) { return e.key(); }
- static uint32_t Hash(const GrResourceKey& key) { return key.getHash(); }
+ static uint32_t Hash(const GrGpuResource* resource) {
+ return static_cast<uint32_t>(reinterpret_cast<intptr_t>(resource));
+ }
#ifdef SK_DEBUG
void validate() const;
#else
@@ -48,16 +48,12 @@ public:
void didChangeResourceSize();
private:
- GrResourceCacheEntry(GrResourceCache* resourceCache,
- const GrResourceKey& key,
- GrGpuResource* resource);
+ GrResourceCacheEntry(GrResourceCache*, GrGpuResource*);
~GrResourceCacheEntry();
GrResourceCache* fResourceCache;
- GrResourceKey fKey;
GrGpuResource* fResource;
size_t fCachedSize;
- bool fIsExclusive;
// Linked list for the LRU ordering.
SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrResourceCacheEntry);
@@ -205,9 +201,6 @@ private:
static size_t countBytes(const SkTInternalLList<GrResourceCacheEntry>& list);
#endif
- typedef SkTMultiMap<GrResourceCacheEntry, GrResourceKey> CacheMap;
- CacheMap fCache;
-
// We're an internal doubly linked list
typedef SkTInternalLList<GrResourceCacheEntry> EntryList;
EntryList fList;
@@ -232,10 +225,6 @@ private:
void* fOverbudgetData;
SkAutoTUnref<const GrDrawTargetCaps> fCaps;
-
- // Listen for messages that a resource has been invalidated and purge cached junk proactively.
- typedef SkMessageBus<GrResourceInvalidatedMessage>::Inbox Inbox;
- Inbox fInvalidationInbox;
};
///////////////////////////////////////////////////////////////////////////////

Powered by Google App Engine
This is Rietveld 408576698