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

Unified Diff: include/gpu/GrGpuResource.h

Issue 703303003: Add GrGpuResource::CacheAccess (Closed) Base URL: https://skia.googlesource.com/skia.git@nohash
Patch Set: fix warning 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
« no previous file with comments | « gyp/gpu.gypi ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrGpuResource.h
diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h
index 315e491a86ff4f2063c141bf96e5116e2da76840..3d6701a7026e7f124932d7985177e868f4679300 100644
--- a/include/gpu/GrGpuResource.h
+++ b/include/gpu/GrGpuResource.h
@@ -174,24 +174,6 @@ public:
*/
virtual size_t gpuMemorySize() const = 0;
- // TODO(bsalomon): Move this stuff to GrGpuResourcePriv.
- bool setContentKey(const GrResourceKey& contentKey);
- void setCacheEntry(GrResourceCacheEntry* cacheEntry);
- GrResourceCacheEntry* getCacheEntry() const { return fCacheEntry; }
- bool isScratch() const;
- /**
- * If this resource can be used as a scratch resource this returns a valid
- * scratch key. Otherwise it returns a key for which isNullScratch is true.
- * The resource may currently be used as content resource rather than scratch.
- * Check isScratch().
- */
- const GrResourceKey& getScratchKey() const { return fScratchKey; }
- /**
- * If this resource is currently cached by its contents then this will return
- * the content key. Otherwise, NULL is returned.
- */
- const GrResourceKey* getContentKey() const;
-
/**
* Gets an id that is unique for this GrGpuResource object. It is static in that it does
* not change when the content of the GrGpuResource object changes. This will never return
@@ -199,6 +181,13 @@ public:
*/
uint32_t getUniqueID() const { return fUniqueID; }
+ /**
+ * Internal-only helper class used for cache manipulations of the reosurce.
+ */
+ class CacheAccess;
+ inline CacheAccess cacheAccess();
+ inline const CacheAccess cacheAccess() const;
+
protected:
// This must be called by every GrGpuObject. It should be called once the object is fully
// initialized (i.e. not in a base class constructor).
@@ -207,8 +196,6 @@ protected:
GrGpuResource(GrGpu*, bool isWrapped);
virtual ~GrGpuResource();
- bool isInCache() const { return SkToBool(fCacheEntry); }
-
GrGpu* getGpu() const { return fGpu; }
// Derived classes should always call their parent class' onRelease
@@ -233,6 +220,9 @@ protected:
void setScratchKey(const GrResourceKey& scratchKey);
private:
+ // See comments in CacheAccess.
+ bool setContentKey(const GrResourceKey& contentKey);
+
void notifyIsPurgable() const;
#ifdef SK_DEBUG
« no previous file with comments | « gyp/gpu.gypi ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698