Move GrResourceKey static functions from .h to .cpp to fix shared lib builds

TBR=robertphillips@google.com

Review URL: https://codereview.chromium.org/718493002
This commit is contained in:
bsalomon 2014-11-10 11:59:06 -08:00 committed by Commit bot
parent 8b79d23f82
commit fe369ee34b
2 changed files with 22 additions and 14 deletions

View File

@ -14,10 +14,7 @@
class GrResourceKey {
public:
static GrCacheID::Domain ScratchDomain() {
static const GrCacheID::Domain gDomain = GrCacheID::GenerateDomain();
return gDomain;
}
static GrCacheID::Domain ScratchDomain();
/** Uniquely identifies the GrGpuResource subclass in the key to avoid collisions
across resource types. */
@ -63,12 +60,7 @@ public:
bool operator==(const GrResourceKey& other) const { return fKey == other.fKey; }
// A key indicating that the resource is not usable as a scratch resource.
static GrResourceKey& NullScratchKey() {
static const GrCacheID::Key kBogusKey = { { {0} } };
static GrCacheID kBogusID(ScratchDomain(), kBogusKey);
static GrResourceKey kNullScratchKey(kBogusID, NoneResourceType(), 0);
return kNullScratchKey;
}
static GrResourceKey& NullScratchKey();
bool isNullScratch() const {
return this->isScratch() && NoneResourceType() == this->getResourceType();
@ -85,10 +77,7 @@ private:
kPadSize = kKeySize - kPadOffset
};
static ResourceType NoneResourceType() {
static const ResourceType gNoneResourceType = GenerateResourceType();
return gNoneResourceType;
}
static ResourceType NoneResourceType();
void init(const GrCacheID::Domain domain,
const GrCacheID::Key& key,

View File

@ -10,6 +10,25 @@
#include "GrResourceCache2.h"
#include "GrGpuResource.h"
GrResourceKey& GrResourceKey::NullScratchKey() {
static const GrCacheID::Key kBogusKey = { { {0} } };
static GrCacheID kBogusID(ScratchDomain(), kBogusKey);
static GrResourceKey kNullScratchKey(kBogusID, NoneResourceType(), 0);
return kNullScratchKey;
}
GrResourceKey::ResourceType GrResourceKey::NoneResourceType() {
static const ResourceType gNoneResourceType = GenerateResourceType();
return gNoneResourceType;
}
GrCacheID::Domain GrResourceKey::ScratchDomain() {
static const GrCacheID::Domain gDomain = GrCacheID::GenerateDomain();
return gDomain;
}
//////////////////////////////////////////////////////////////////////////////
GrResourceCache2::~GrResourceCache2() {
this->releaseAll();
}