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

Unified Diff: src/gpu/GrResourceCache2.cpp

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 | « src/gpu/GrResourceCache2.h ('k') | src/gpu/GrStencilBuffer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrResourceCache2.cpp
diff --git a/src/gpu/GrResourceCache2.cpp b/src/gpu/GrResourceCache2.cpp
index 70d854ce358c760dfb9b44d4d42d425996d8be67..83143d78185898c8ed0ed83420228019de1f9d42 100644
--- a/src/gpu/GrResourceCache2.cpp
+++ b/src/gpu/GrResourceCache2.cpp
@@ -39,20 +39,20 @@ void GrResourceCache2::insertResource(GrGpuResource* resource) {
SkASSERT(!this->isInCache(resource));
fResources.addToHead(resource);
++fCount;
- if (!resource->getScratchKey().isNullScratch()) {
+ if (!resource->cacheAccess().getScratchKey().isNullScratch()) {
// TODO(bsalomon): Make this assertion possible.
// SkASSERT(!resource->isWrapped());
- fScratchMap.insert(resource->getScratchKey(), resource);
+ fScratchMap.insert(resource->cacheAccess().getScratchKey(), resource);
}
}
void GrResourceCache2::removeResource(GrGpuResource* resource) {
SkASSERT(this->isInCache(resource));
fResources.remove(resource);
- if (!resource->getScratchKey().isNullScratch()) {
- fScratchMap.remove(resource->getScratchKey(), resource);
+ if (!resource->cacheAccess().getScratchKey().isNullScratch()) {
+ fScratchMap.remove(resource->cacheAccess().getScratchKey(), resource);
}
- if (const GrResourceKey* contentKey = resource->getContentKey()) {
+ if (const GrResourceKey* contentKey = resource->cacheAccess().getContentKey()) {
fContentHash.remove(*contentKey);
}
--fCount;
@@ -86,7 +86,7 @@ public:
AvailableForScratchUse(bool rejectPendingIO) : fRejectPendingIO(rejectPendingIO) { }
bool operator()(const GrGpuResource* resource) const {
- if (!resource->reffedOnlyByCache() || !resource->isScratch()) {
+ if (!resource->reffedOnlyByCache() || !resource->cacheAccess().isScratch()) {
return false;
}
@@ -114,23 +114,12 @@ GrGpuResource* GrResourceCache2::findAndRefScratchResource(const GrResourceKey&
return SkSafeRef(fScratchMap.find(scratchKey, AvailableForScratchUse(false)));
}
-#if 0
-void GrResourceCache2::willRemoveContentKey(const GrGpuResource* resource) {
- SkASSERT(resource);
- SkASSERT(resource->getContentKey());
- SkDEBUGCODE(GrGpuResource* res = fContentHash.find(*resource->getContentKey()));
- SkASSERT(res == resource);
-
- fContentHash.remove(*resource->getContentKey());
-}
-#endif
-
bool GrResourceCache2::didSetContentKey(GrGpuResource* resource) {
SkASSERT(resource);
- SkASSERT(resource->getContentKey());
- SkASSERT(!resource->getContentKey()->isScratch());
+ SkASSERT(resource->cacheAccess().getContentKey());
+ SkASSERT(!resource->cacheAccess().getContentKey()->isScratch());
- GrGpuResource* res = fContentHash.find(*resource->getContentKey());
+ GrGpuResource* res = fContentHash.find(*resource->cacheAccess().getContentKey());
if (NULL != res) {
return false;
}
« no previous file with comments | « src/gpu/GrResourceCache2.h ('k') | src/gpu/GrStencilBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698