aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-09 14:29:32 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-09 14:29:32 +0000
commit95c2003740c4cd01fd1b02ed93b9de7227b1d0f5 (patch)
tree2d7b57d758cdd573433e236c0797d3614f92d40c /tests
parent063e6b40a367ba2cb30120e574f1b9f323be3a6e (diff)
cleanup GrContext resource cache api
R=robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/275563005 git-svn-id: http://skia.googlecode.com/svn/trunk@14669 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
-rw-r--r--tests/ResourceCacheTest.cpp12
-rw-r--r--tests/SurfaceTest.cpp14
2 files changed, 17 insertions, 9 deletions
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index f6c8b1da1a..78c11243de 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -26,16 +26,17 @@ static void test_cache(skiatest::Reporter* reporter,
src.eraseColor(SK_ColorBLACK);
size_t srcSize = src.getSize();
- size_t initialCacheSize = context->getGpuTextureCacheBytes();
+ size_t initialCacheSize;
+ context->getResourceCacheUsage(NULL, &initialCacheSize);
int oldMaxNum;
size_t oldMaxBytes;
- context->getTextureCacheLimits(&oldMaxNum, &oldMaxBytes);
+ context->getResourceCacheLimits(&oldMaxNum, &oldMaxBytes);
// Set the cache limits so we can fit 10 "src" images and the
// max number of textures doesn't matter
size_t maxCacheSize = initialCacheSize + 10*srcSize;
- context->setTextureCacheLimits(1000, maxCacheSize);
+ context->setResourceCacheLimits(1000, maxCacheSize);
SkBitmap readback;
readback.allocN32Pixels(size.width(), size.height());
@@ -47,13 +48,14 @@ static void test_cache(skiatest::Reporter* reporter,
// "modify" the src texture
src.notifyPixelsChanged();
- size_t curCacheSize = context->getGpuTextureCacheBytes();
+ size_t curCacheSize;
+ context->getResourceCacheUsage(NULL, &curCacheSize);
// we should never go over the size limit
REPORTER_ASSERT(reporter, curCacheSize <= maxCacheSize);
}
- context->setTextureCacheLimits(oldMaxNum, oldMaxBytes);
+ context->setResourceCacheLimits(oldMaxNum, oldMaxBytes);
}
class TestResource : public GrCacheable {
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index fd4980ebc4..7d5607ce43 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -304,21 +304,27 @@ static void TestSurfaceInCache(skiatest::Reporter* reporter,
SurfaceType surfaceType,
GrContext* context) {
context->freeGpuResources();
- REPORTER_ASSERT(reporter, 0 == context->getGpuTextureCacheResourceCount());
+ int resourceCount;
+
+ context->getResourceCacheUsage(&resourceCount, NULL);
+ REPORTER_ASSERT(reporter, 0 == resourceCount);
SkAutoTUnref<SkSurface> surface(createSurface(surfaceType, context));
// Note: the stencil buffer is always cached, so kGpu_SurfaceType uses
// one cached resource, and kGpuScratch_SurfaceType uses two.
int expectedCachedResources = surfaceType == kGpuScratch_SurfaceType ? 2 : 1;
- REPORTER_ASSERT(reporter, expectedCachedResources == context->getGpuTextureCacheResourceCount());
+ context->getResourceCacheUsage(&resourceCount, NULL);
+ REPORTER_ASSERT(reporter, expectedCachedResources == resourceCount);
// Verify that all the cached resources are locked in cache.
context->freeGpuResources();
- REPORTER_ASSERT(reporter, expectedCachedResources == context->getGpuTextureCacheResourceCount());
+ context->getResourceCacheUsage(&resourceCount, NULL);
+ REPORTER_ASSERT(reporter, expectedCachedResources == resourceCount);
// Verify that all the cached resources are unlocked upon surface release
surface.reset(0);
context->freeGpuResources();
- REPORTER_ASSERT(reporter, 0 == context->getGpuTextureCacheResourceCount());
+ context->getResourceCacheUsage(&resourceCount, NULL);
+ REPORTER_ASSERT(reporter, 0 == resourceCount);
}
static void Test_crbug263329(skiatest::Reporter* reporter,