Rename GrGpuObject to GrGpuResource
R=robertphillips@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/418143004
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index d3edd21..c171446 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -257,7 +257,7 @@
const GrCacheID& cacheID,
const GrTextureParams* params) {
GrResourceKey resourceKey = GrTextureImpl::ComputeKey(fGpu, params, desc, cacheID);
- GrGpuObject* resource = fResourceCache->find(resourceKey);
+ GrGpuResource* resource = fResourceCache->find(resourceKey);
SkSafeRef(resource);
return static_cast<GrTexture*>(resource);
}
@@ -283,7 +283,7 @@
GrResourceKey resourceKey = GrStencilBuffer::ComputeKey(width,
height,
sampleCnt);
- GrGpuObject* resource = fResourceCache->find(resourceKey);
+ GrGpuResource* resource = fResourceCache->find(resourceKey);
return static_cast<GrStencilBuffer*>(resource);
}
@@ -471,7 +471,7 @@
desc.fHeight = SkTMax(MIN_SIZE, GrNextPow2(desc.fHeight));
}
- GrGpuObject* resource = NULL;
+ GrGpuResource* resource = NULL;
int origWidth = desc.fWidth;
int origHeight = desc.fHeight;
@@ -1903,13 +1903,13 @@
return path;
}
-void GrContext::addResourceToCache(const GrResourceKey& resourceKey, GrGpuObject* resource) {
+void GrContext::addResourceToCache(const GrResourceKey& resourceKey, GrGpuResource* resource) {
fResourceCache->purgeAsNeeded(1, resource->gpuMemorySize());
fResourceCache->addResource(resourceKey, resource);
}
-GrGpuObject* GrContext::findAndRefCachedResource(const GrResourceKey& resourceKey) {
- GrGpuObject* resource = fResourceCache->find(resourceKey);
+GrGpuResource* GrContext::findAndRefCachedResource(const GrResourceKey& resourceKey) {
+ GrGpuResource* resource = fResourceCache->find(resourceKey);
SkSafeRef(resource);
return resource;
}
diff --git a/src/gpu/GrGeometryBuffer.h b/src/gpu/GrGeometryBuffer.h
index 67e91cc..3d57f1d 100644
--- a/src/gpu/GrGeometryBuffer.h
+++ b/src/gpu/GrGeometryBuffer.h
@@ -10,14 +10,14 @@
#ifndef GrGeometryBuffer_DEFINED
#define GrGeometryBuffer_DEFINED
-#include "GrGpuObject.h"
+#include "GrGpuResource.h"
class GrGpu;
/**
* Parent class for vertex and index buffers
*/
-class GrGeometryBuffer : public GrGpuObject {
+class GrGeometryBuffer : public GrGpuResource {
public:
SK_DECLARE_INST_COUNT(GrGeometryBuffer);
@@ -98,7 +98,7 @@
return this->onUpdateData(src, srcSizeInBytes);
}
- // GrGpuObject overrides
+ // GrGpuResource overrides
virtual size_t gpuMemorySize() const { return fGpuMemorySize; }
protected:
@@ -119,7 +119,7 @@
bool fDynamic;
bool fCPUBacked;
- typedef GrGpuObject INHERITED;
+ typedef GrGpuResource INHERITED;
};
#endif
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 840f8ee..0b49e74 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -85,14 +85,14 @@
fIndexPool = NULL;
}
-void GrGpu::insertObject(GrGpuObject* object) {
+void GrGpu::insertObject(GrGpuResource* object) {
SkASSERT(NULL != object);
SkASSERT(this == object->getGpu());
fObjectList.addToHead(object);
}
-void GrGpu::removeObject(GrGpuObject* object) {
+void GrGpu::removeObject(GrGpuResource* object) {
SkASSERT(NULL != object);
SkASSERT(this == object->getGpu());
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 822deb1..b752f7c 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -249,28 +249,28 @@
size_t rowBytes);
/**
- * Called to tell GrGpu that all GrGpuObjects have been lost and should
+ * Called to tell GrGpu that all GrGpuResources have been lost and should
* be abandoned. Overrides must call INHERITED::abandonResources().
*/
virtual void abandonResources();
/**
- * Called to tell GrGpu to release all GrGpuObjects. Overrides must call
+ * Called to tell GrGpu to release all GrGpuResources. Overrides must call
* INHERITED::releaseResources().
*/
void releaseResources();
/**
- * Add object to list of objects. Should only be called by GrGpuObject.
+ * Add object to list of objects. Should only be called by GrGpuResource.
* @param resource the resource to add.
*/
- void insertObject(GrGpuObject* object);
+ void insertObject(GrGpuResource* object);
/**
- * Remove object from list of objects. Should only be called by GrGpuObject.
+ * Remove object from list of objects. Should only be called by GrGpuResource.
* @param resource the resource to remove.
*/
- void removeObject(GrGpuObject* object);
+ void removeObject(GrGpuResource* object);
// GrDrawTarget overrides
virtual void clear(const SkIRect* rect,
@@ -526,7 +526,7 @@
enum {
kPreallocGeomPoolStateStackCnt = 4,
};
- typedef SkTInternalLList<GrGpuObject> ObjectList;
+ typedef SkTInternalLList<GrGpuResource> ObjectList;
SkSTArray<kPreallocGeomPoolStateStackCnt, GeometryPoolState, true> fGeomPoolStateStack;
ResetTimestamp fResetTimestamp;
uint32_t fResetBits;
diff --git a/src/gpu/GrGpuObject.cpp b/src/gpu/GrGpuResource.cpp
similarity index 78%
rename from src/gpu/GrGpuObject.cpp
rename to src/gpu/GrGpuResource.cpp
index 4a72a50..8c2dc45 100644
--- a/src/gpu/GrGpuObject.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -7,10 +7,10 @@
*/
-#include "GrGpuObject.h"
+#include "GrGpuResource.h"
#include "GrGpu.h"
-GrGpuObject::GrGpuObject(GrGpu* gpu, bool isWrapped)
+GrGpuResource::GrGpuResource(GrGpu* gpu, bool isWrapped)
: fRefCnt(1)
, fCacheEntry(NULL)
, fUniqueID(CreateUniqueID()) {
@@ -23,13 +23,13 @@
fGpu->insertObject(this);
}
-GrGpuObject::~GrGpuObject() {
+GrGpuResource::~GrGpuResource() {
SkASSERT(0 == fRefCnt);
// subclass should have released this.
SkASSERT(this->wasDestroyed());
}
-void GrGpuObject::release() {
+void GrGpuResource::release() {
if (NULL != fGpu) {
this->onRelease();
fGpu->removeObject(this);
@@ -37,7 +37,7 @@
}
}
-void GrGpuObject::abandon() {
+void GrGpuResource::abandon() {
if (NULL != fGpu) {
this->onAbandon();
fGpu->removeObject(this);
@@ -45,7 +45,7 @@
}
}
-const GrContext* GrGpuObject::getContext() const {
+const GrContext* GrGpuResource::getContext() const {
if (NULL != fGpu) {
return fGpu->getContext();
} else {
@@ -53,7 +53,7 @@
}
}
-GrContext* GrGpuObject::getContext() {
+GrContext* GrGpuResource::getContext() {
if (NULL != fGpu) {
return fGpu->getContext();
} else {
@@ -61,7 +61,7 @@
}
}
-uint32_t GrGpuObject::CreateUniqueID() {
+uint32_t GrGpuResource::CreateUniqueID() {
static int32_t gUniqueID = SK_InvalidUniqueID;
uint32_t id;
do {
diff --git a/src/gpu/GrPath.h b/src/gpu/GrPath.h
index 2c0040c..a571935 100644
--- a/src/gpu/GrPath.h
+++ b/src/gpu/GrPath.h
@@ -8,13 +8,13 @@
#ifndef GrPath_DEFINED
#define GrPath_DEFINED
-#include "GrGpuObject.h"
+#include "GrGpuResource.h"
#include "GrResourceCache.h"
#include "SkPath.h"
#include "SkRect.h"
#include "SkStrokeRec.h"
-class GrPath : public GrGpuObject {
+class GrPath : public GrGpuResource {
public:
SK_DECLARE_INST_COUNT(GrPath);
@@ -45,7 +45,7 @@
SkRect fBounds;
private:
- typedef GrGpuObject INHERITED;
+ typedef GrGpuResource INHERITED;
};
#endif
diff --git a/src/gpu/GrPathRange.h b/src/gpu/GrPathRange.h
index 02342c4..c53b987 100644
--- a/src/gpu/GrPathRange.h
+++ b/src/gpu/GrPathRange.h
@@ -8,7 +8,7 @@
#ifndef GrPathRange_DEFINED
#define GrPathRange_DEFINED
-#include "GrGpuObject.h"
+#include "GrGpuResource.h"
#include "GrResourceCache.h"
#include "SkStrokeRec.h"
@@ -20,7 +20,7 @@
* initialized lazily. Unititialized paths are silently ignored by drawing
* functions.
*/
-class GrPathRange : public GrGpuObject {
+class GrPathRange : public GrGpuResource {
public:
SK_DECLARE_INST_COUNT(GrPathRange);
@@ -54,7 +54,7 @@
SkStrokeRec fStroke;
private:
- typedef GrGpuObject INHERITED;
+ typedef GrGpuResource INHERITED;
};
#endif
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index 13568e4..e3a17f0 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -9,13 +9,13 @@
#include "GrResourceCache.h"
-#include "GrGpuObject.h"
+#include "GrGpuResource.h"
DECLARE_SKMESSAGEBUS_MESSAGE(GrResourceInvalidatedMessage);
///////////////////////////////////////////////////////////////////////////////
-void GrGpuObject::didChangeGpuMemorySize() const {
+void GrGpuResource::didChangeGpuMemorySize() const {
if (this->isInCache()) {
fCacheEntry->didChangeResourceSize();
}
@@ -38,7 +38,7 @@
GrResourceCacheEntry::GrResourceCacheEntry(GrResourceCache* resourceCache,
const GrResourceKey& key,
- GrGpuObject* resource)
+ GrGpuResource* resource)
: fResourceCache(resourceCache),
fKey(key),
fResource(resource),
@@ -197,7 +197,7 @@
}
};
-GrGpuObject* GrResourceCache::find(const GrResourceKey& key, uint32_t ownershipFlags) {
+GrGpuResource* GrResourceCache::find(const GrResourceKey& key, uint32_t ownershipFlags) {
GrAutoResourceCacheValidate atcv(this);
GrResourceCacheEntry* entry = NULL;
@@ -226,7 +226,7 @@
}
void GrResourceCache::addResource(const GrResourceKey& key,
- GrGpuObject* resource,
+ GrGpuResource* resource,
uint32_t ownershipFlags) {
SkASSERT(NULL == resource->getCacheEntry());
// we don't expect to create new resources during a purge. In theory
diff --git a/src/gpu/GrResourceCache.h b/src/gpu/GrResourceCache.h
index 63a7a67..235b11a 100644
--- a/src/gpu/GrResourceCache.h
+++ b/src/gpu/GrResourceCache.h
@@ -18,7 +18,7 @@
#include "SkMessageBus.h"
#include "SkTInternalLList.h"
-class GrGpuObject;
+class GrGpuResource;
class GrResourceCache;
class GrResourceCacheEntry;
@@ -29,11 +29,11 @@
return gDomain;
}
- /** Uniquely identifies the GrGpuObject 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 GrGpuObject subclass. */
+ /** Flags set by the GrGpuResource subclass. */
typedef uint8_t ResourceFlags;
/** Generate a unique ResourceType */
@@ -118,7 +118,7 @@
class GrResourceCacheEntry {
public:
- GrGpuObject* 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(); }
@@ -131,7 +131,7 @@
/**
* Update the cached size for this entry and inform the resource cache that
- * it has changed. Usually invoked from GrGpuObject::didChangeGpuMemorySize,
+ * it has changed. Usually invoked from GrGpuResource::didChangeGpuMemorySize,
* not directly from here.
*/
void didChangeResourceSize();
@@ -139,12 +139,12 @@
private:
GrResourceCacheEntry(GrResourceCache* resourceCache,
const GrResourceKey& key,
- GrGpuObject* resource);
+ GrGpuResource* resource);
~GrResourceCacheEntry();
GrResourceCache* fResourceCache;
GrResourceKey fKey;
- GrGpuObject* fResource;
+ GrGpuResource* fResource;
size_t fCachedSize;
bool fIsExclusive;
@@ -157,7 +157,7 @@
///////////////////////////////////////////////////////////////////////////////
/**
- * Cache of GrGpuObject objects.
+ * Cache of GrGpuResource objects.
*
* These have a corresponding GrResourceKey, built from 128bits identifying the
* resource. Multiple resources can map to same GrResourceKey.
@@ -170,7 +170,7 @@
* 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 {
@@ -246,8 +246,8 @@
* For a resource to be completely exclusive to a caller both kNoOtherOwners
* and kHide must be specified.
*/
- GrGpuObject* 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
@@ -261,7 +261,7 @@
* is called.
*/
void addResource(const GrResourceKey& key,
- GrGpuObject* resource,
+ GrGpuResource* resource,
uint32_t ownershipFlags = 0);
/**
diff --git a/src/gpu/GrStencilAndCoverTextContext.cpp b/src/gpu/GrStencilAndCoverTextContext.cpp
index 0867f2e..0a09a2f 100644
--- a/src/gpu/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/GrStencilAndCoverTextContext.cpp
@@ -18,7 +18,7 @@
#include "SkPath.h"
#include "SkTextMapStateProc.h"
-class GrStencilAndCoverTextContext::GlyphPathRange : public GrGpuObject {
+class GrStencilAndCoverTextContext::GlyphPathRange : public GrGpuResource {
static const int kMaxGlyphCount = 1 << 16; // Glyph IDs are uint16_t's
static const int kGlyphGroupSize = 16; // Glyphs get tracked in groups of 16
@@ -75,7 +75,7 @@
this->didChangeGpuMemorySize();
}
- // GrGpuObject overrides
+ // GrGpuResource overrides
virtual size_t gpuMemorySize() const SK_OVERRIDE { return fPathRange->gpuMemorySize(); }
private:
@@ -111,7 +111,7 @@
uint8_t fLoadedGlyphs[(kMaxGroupCount + 7) >> 3]; // One bit per glyph group
SkAutoTUnref<GrPathRange> fPathRange;
- typedef GrGpuObject INHERITED;
+ typedef GrGpuResource INHERITED;
};
diff --git a/src/gpu/GrStencilBuffer.h b/src/gpu/GrStencilBuffer.h
index 696ba83..86fef50 100644
--- a/src/gpu/GrStencilBuffer.h
+++ b/src/gpu/GrStencilBuffer.h
@@ -11,12 +11,12 @@
#define GrStencilBuffer_DEFINED
#include "GrClipData.h"
-#include "GrGpuObject.h"
+#include "GrGpuResource.h"
class GrRenderTarget;
class GrResourceKey;
-class GrStencilBuffer : public GrGpuObject {
+class GrStencilBuffer : public GrGpuResource {
public:
SK_DECLARE_INST_COUNT(GrStencilBuffer);
@@ -54,7 +54,7 @@
protected:
GrStencilBuffer(GrGpu* gpu, bool isWrapped, int width, int height, int bits, int sampleCnt)
- : GrGpuObject(gpu, isWrapped)
+ : GrGpuResource(gpu, isWrapped)
, fWidth(width)
, fHeight(height)
, fBits(bits)
@@ -74,7 +74,7 @@
SkIRect fLastClipStackRect;
SkIPoint fLastClipSpaceOffset;
- typedef GrGpuObject INHERITED;
+ typedef GrGpuResource INHERITED;
};
#endif
diff --git a/src/gpu/gl/GrGLVertexArray.h b/src/gpu/gl/GrGLVertexArray.h
index 0e5bffe..f4eb3d5 100644
--- a/src/gpu/gl/GrGLVertexArray.h
+++ b/src/gpu/gl/GrGLVertexArray.h
@@ -8,7 +8,7 @@
#ifndef GrGLVertexArray_DEFINED
#define GrGLVertexArray_DEFINED
-#include "GrGpuObject.h"
+#include "GrGpuResource.h"
#include "GrTypesPriv.h"
#include "gl/GrGLDefines.h"
#include "gl/GrGLFunctions.h"
@@ -130,7 +130,7 @@
* This class represents an OpenGL vertex array object. It manages the lifetime of the vertex array
* and is used to track the state of the vertex array to avoid redundant GL calls.
*/
-class GrGLVertexArray : public GrGpuObject {
+class GrGLVertexArray : public GrGpuResource {
public:
GrGLVertexArray(GrGpuGL* gpu, GrGLint id, int attribCount);
@@ -170,7 +170,7 @@
GrGLuint fIndexBufferID;
bool fIndexBufferIDIsValid;
- typedef GrGpuObject INHERITED;
+ typedef GrGpuResource INHERITED;
};
#endif