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

Unified Diff: src/gpu/GrResourceCache2.cpp

Issue 510053003: Make textures register with GrResourceCache2 as scratch. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add new h file to git repo Created 6 years, 4 months 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/GrTexture.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 c325efd40d5b11ab0d3fbb19f2b78553c6d107a0..a5732f786ea48b39bc8f8431c7755609e02e2c8d 100644
--- a/src/gpu/GrResourceCache2.cpp
+++ b/src/gpu/GrResourceCache2.cpp
@@ -20,11 +20,17 @@ void GrResourceCache2::insertResource(GrGpuResource* resource) {
SkASSERT(!this->isInCache(resource));
fResources.addToHead(resource);
++fCount;
+ if (!resource->getScratchKey().isNullScratch()) {
+ fScratchMap.insert(resource->getScratchKey(), resource);
+ }
}
void GrResourceCache2::removeResource(GrGpuResource* resource) {
SkASSERT(this->isInCache(resource));
- fResources.remove(resource);
+ fResources.remove(resource);
+ if (!resource->getScratchKey().isNullScratch()) {
+ fScratchMap.remove(resource->getScratchKey(), resource);
+ }
--fCount;
}
@@ -35,6 +41,7 @@ void GrResourceCache2::abandonAll() {
// abandon should have already removed this from the list.
SkASSERT(head != fResources.head());
}
+ SkASSERT(!fScratchMap.count());
SkASSERT(!fCount);
}
@@ -45,5 +52,6 @@ void GrResourceCache2::releaseAll() {
// release should have already removed this from the list.
SkASSERT(head != fResources.head());
}
+ SkASSERT(!fScratchMap.count());
SkASSERT(!fCount);
}
« no previous file with comments | « src/gpu/GrResourceCache2.h ('k') | src/gpu/GrTexture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698