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

Unified Diff: src/gpu/GrResourceCache.cpp

Issue 1286203002: Defer flushes if kPreferNoIO is specified (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use explicit size in test Created 5 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/GrResourceCache.h ('k') | src/gpu/GrResourceProvider.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrResourceCache.cpp
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index 88128ac5000fdfb651b21d0ca2f39751f6738be1..7efe62365bf432f112e12e5a01d9b97fa4f7ec98 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -246,6 +246,7 @@ private:
};
GrGpuResource* GrResourceCache::findAndRefScratchResource(const GrScratchKey& scratchKey,
+ size_t resourceSize,
uint32_t flags) {
SkASSERT(scratchKey.isValid());
@@ -259,8 +260,11 @@ GrGpuResource* GrResourceCache::findAndRefScratchResource(const GrScratchKey& sc
} else if (flags & kRequireNoPendingIO_ScratchFlag) {
return NULL;
}
- // TODO: fail here when kPrefer is specified, we didn't find a resource without pending io,
- // but there is still space in our budget for the resource.
+ if (this->wouldFit(resourceSize)) {
+ // kPrefer is specified, we didn't find a resource without pending io,
+ // but there is still space in our budget for the resource.
+ return NULL;
+ }
}
resource = fScratchMap.find(scratchKey, AvailableForScratchUse(false));
if (resource) {
« no previous file with comments | « src/gpu/GrResourceCache.h ('k') | src/gpu/GrResourceProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698