| Index: tests/ResourceCacheTest.cpp
|
| diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
|
| index f9f94d1b274322eb35acd4806850855d4f44a7fc..00f4e850005b5e633447d0e303f0a724145673fa 100644
|
| --- a/tests/ResourceCacheTest.cpp
|
| +++ b/tests/ResourceCacheTest.cpp
|
| @@ -7,9 +7,11 @@
|
|
|
| #if SK_SUPPORT_GPU
|
|
|
| -#include "SkCanvas.h"
|
| +#include "GrContext.h"
|
| #include "GrContextFactory.h"
|
| +#include "GrGpu.h"
|
| #include "GrResourceCache.h"
|
| +#include "SkCanvas.h"
|
| #include "SkSurface.h"
|
| #include "Test.h"
|
|
|
| @@ -115,7 +117,7 @@ static void test_purge_invalidated(skiatest::Reporter* reporter, GrContext* cont
|
| GrResourceKey::ResourceType t = GrResourceKey::GenerateResourceType();
|
| GrResourceKey key(GrCacheID(domain, keyData), t, 0);
|
|
|
| - GrResourceCache cache(5, 30000);
|
| + GrResourceCache cache(context->getGpu()->caps(), 5, 30000);
|
|
|
| // Add two resources with the same key that delete each other from the cache when destroyed.
|
| TestResource* a = new TestResource(context->getGpu());
|
| @@ -153,7 +155,7 @@ static void test_cache_delete_on_destruction(skiatest::Reporter* reporter,
|
|
|
| {
|
| {
|
| - GrResourceCache cache(3, 30000);
|
| + GrResourceCache cache(context->getGpu()->caps(), 3, 30000);
|
| TestResource* a = new TestResource(context->getGpu());
|
| TestResource* b = new TestResource(context->getGpu());
|
| cache.addResource(key, a);
|
| @@ -169,7 +171,7 @@ static void test_cache_delete_on_destruction(skiatest::Reporter* reporter,
|
| REPORTER_ASSERT(reporter, 0 == TestResource::alive());
|
| }
|
| {
|
| - GrResourceCache cache(3, 30000);
|
| + GrResourceCache cache(context->getGpu()->caps(), 3, 30000);
|
| TestResource* a = new TestResource(context->getGpu());
|
| TestResource* b = new TestResource(context->getGpu());
|
| cache.addResource(key, a);
|
| @@ -204,7 +206,7 @@ static void test_resource_size_changed(skiatest::Reporter* reporter,
|
|
|
| // Test changing resources sizes (both increase & decrease).
|
| {
|
| - GrResourceCache cache(2, 300);
|
| + GrResourceCache cache(context->getGpu()->caps(), 2, 300);
|
|
|
| TestResource* a = new TestResource(context->getGpu());
|
| a->setSize(100); // Test didChangeGpuMemorySize() when not in the cache.
|
| @@ -228,7 +230,7 @@ static void test_resource_size_changed(skiatest::Reporter* reporter,
|
|
|
| // Test increasing a resources size beyond the cache budget.
|
| {
|
| - GrResourceCache cache(2, 300);
|
| + GrResourceCache cache(context->getGpu()->caps(), 2, 300);
|
|
|
| TestResource* a = new TestResource(context->getGpu(), 100);
|
| cache.addResource(key1, a);
|
| @@ -247,37 +249,6 @@ static void test_resource_size_changed(skiatest::Reporter* reporter,
|
| 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).
|
| - }
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
|
|