Revert of GrResourceCache2 manages scratch texture. (patchset #14 id:260001 of https://codereview.chromium.org/608883003/)
Reason for revert:
Turning bots red:
Nanobench seems to be uniformly failing on Android
(http://108.170.220.21:10117/builders/Perf-Android-Venue8-PowerVR-x86-Release/builds/99/steps/RunNanobench/logs/stdio)
Ubuntu GTX660 32bit is failing in both Debug and Release on GM generation (it appears to be out of memory) (http://108.170.220.120:10117/builders/Test-Ubuntu12-ShuttleA-GTX660-x86-Debug/builds/2457/steps/GenerateGMs/logs/stdio)
Original issue's description:
> GrResourceCache2 manages scratch texture.
>
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/3d398c876440deaab39bbf2a9b881c337e6dc8d4
R=bsalomon@google.com
TBR=bsalomon@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/611383003
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index d62d09d..f9f94d1 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -247,6 +247,37 @@
REPORTER_ASSERT(reporter, 201 == cache.getCachedResourceBytes());
REPORTER_ASSERT(reporter, 1 == cache.getCachedResourceCount());
}
+
+ // Test changing the size of an exclusively-held resource.
+ {
+ GrResourceCache cache(2, 300);
+
+ TestResource* a = new TestResource(context->getGpu(), 100);
+ cache.addResource(key1, a);
+ cache.makeExclusive(a->getCacheEntry());
+
+ TestResource* b = new TestResource(context->getGpu(), 100);
+ cache.addResource(key2, b);
+ b->unref();
+
+ REPORTER_ASSERT(reporter, 200 == cache.getCachedResourceBytes());
+ REPORTER_ASSERT(reporter, 2 == cache.getCachedResourceCount());
+ REPORTER_ASSERT(reporter, NULL == cache.find(key1));
+
+ a->setSize(200);
+
+ REPORTER_ASSERT(reporter, 300 == cache.getCachedResourceBytes());
+ REPORTER_ASSERT(reporter, 2 == cache.getCachedResourceCount());
+ // Internal resource cache validation will test the detached size (debug mode only).
+
+ cache.makeNonExclusive(a->getCacheEntry());
+ a->unref();
+
+ REPORTER_ASSERT(reporter, 300 == cache.getCachedResourceBytes());
+ REPORTER_ASSERT(reporter, 2 == cache.getCachedResourceCount());
+ REPORTER_ASSERT(reporter, cache.find(key1));
+ // Internal resource cache validation will test the detached size (debug mode only).
+ }
}
////////////////////////////////////////////////////////////////////////////////