#include "GrConfig.h"
#include "GrTypes.h"
-#include "GrTMultiMap.h"
+#include "SkTMultiMap.h"
#include "GrBinHashKey.h"
#include "SkMessageBus.h"
#include "SkTInternalLList.h"
-class GrCacheable;
+class GrGpuResource;
class GrResourceCache;
class GrResourceCacheEntry;
return gDomain;
}
- /** Uniquely identifies the GrCacheable subclass in the key to avoid collisions
+ /** Uniquely identifies the GrGpuResource subclass in the key to avoid collisions
across resource types. */
typedef uint8_t ResourceType;
- /** Flags set by the GrCacheable subclass. */
+ /** Flags set by the GrGpuResource subclass. */
typedef uint8_t ResourceFlags;
/** Generate a unique ResourceType */
class GrResourceCacheEntry {
public:
- GrCacheable* resource() const { return fResource; }
+ GrGpuResource* resource() const { return fResource; }
const GrResourceKey& key() const { return fKey; }
static const GrResourceKey& GetKey(const GrResourceCacheEntry& e) { return e.key(); }
/**
* Update the cached size for this entry and inform the resource cache that
- * it has changed. Usually invoked from GrCacheable::didChangeGpuMemorySize,
+ * it has changed. Usually invoked from GrGpuResource::didChangeGpuMemorySize,
* not directly from here.
*/
void didChangeResourceSize();
private:
GrResourceCacheEntry(GrResourceCache* resourceCache,
const GrResourceKey& key,
- GrCacheable* resource);
+ GrGpuResource* resource);
~GrResourceCacheEntry();
GrResourceCache* fResourceCache;
GrResourceKey fKey;
- GrCacheable* fResource;
+ GrGpuResource* fResource;
size_t fCachedSize;
bool fIsExclusive;
///////////////////////////////////////////////////////////////////////////////
/**
- * Cache of GrCacheable objects.
+ * Cache of GrGpuResource objects.
*
* These have a corresponding GrResourceKey, built from 128bits identifying the
* resource. Multiple resources can map to same GrResourceKey.
* For fast searches, we maintain a hash map based on the GrResourceKey.
*
* It is a goal to make the GrResourceCache the central repository and bookkeeper
- * of all resources. It should replace the linked list of GrGpuObjects that
+ * of all resources. It should replace the linked list of GrGpuResources that
* GrGpu uses to call abandon/release.
*/
class GrResourceCache {
* For a resource to be completely exclusive to a caller both kNoOtherOwners
* and kHide must be specified.
*/
- GrCacheable* find(const GrResourceKey& key,
- uint32_t ownershipFlags = 0);
+ GrGpuResource* find(const GrResourceKey& key,
+ uint32_t ownershipFlags = 0);
/**
* Add the new resource to the cache (by creating a new cache entry based
* is called.
*/
void addResource(const GrResourceKey& key,
- GrCacheable* resource,
+ GrGpuResource* resource,
uint32_t ownershipFlags = 0);
/**
void removeInvalidResource(GrResourceCacheEntry* entry);
- GrTMultiMap<GrResourceCacheEntry, GrResourceKey> fCache;
+ SkTMultiMap<GrResourceCacheEntry, GrResourceKey> fCache;
// We're an internal doubly linked list
typedef SkTInternalLList<GrResourceCacheEntry> EntryList;