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

Unified Diff: tests/ResourceCacheTest.cpp

Issue 251013002: Split GrResource into GrCacheable/GrGpuObject (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 6 years, 8 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/gl/GrGpuGL.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ResourceCacheTest.cpp
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 6b324a7d8471e8b3bd0398ccd7d3f6de8f6dcf13..7262b43a0ff767ef0db36ecca6f1f23bbf5bffa0 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -56,12 +56,11 @@ static void test_cache(skiatest::Reporter* reporter,
context->setTextureCacheLimits(oldMaxNum, oldMaxBytes);
}
-class TestResource : public GrResource {
+class TestResource : public GrCacheable {
public:
SK_DECLARE_INST_COUNT(TestResource);
- explicit TestResource(GrGpu* gpu)
- : INHERITED(gpu, false)
- , fCache(NULL)
+ TestResource()
+ : fCache(NULL)
, fToDelete(NULL) {
++fAlive;
}
@@ -73,10 +72,11 @@ public:
fToDelete->setDeleteWhenDestroyed(NULL, NULL);
fCache->deleteResource(fToDelete->getCacheEntry());
}
- this->release();
}
- size_t sizeInBytes() const SK_OVERRIDE { return 100; }
+ size_t gpuMemorySize() const SK_OVERRIDE { return 100; }
+
+ bool isValidOnGpu() const SK_OVERRIDE { return true; }
static int alive() { return fAlive; }
@@ -90,7 +90,7 @@ private:
TestResource* fToDelete;
static int fAlive;
- typedef GrResource INHERITED;
+ typedef GrCacheable INHERITED;
};
int TestResource::fAlive = 0;
@@ -105,8 +105,8 @@ static void test_purge_invalidated(skiatest::Reporter* reporter, GrContext* cont
GrResourceCache cache(5, 30000);
// Add two resources with the same key that delete each other from the cache when destroyed.
- TestResource* a = new TestResource(context->getGpu());
- TestResource* b = new TestResource(context->getGpu());
+ TestResource* a = new TestResource();
+ TestResource* b = new TestResource();
cache.addResource(key, a);
cache.addResource(key, b);
// Circle back.
@@ -116,7 +116,7 @@ static void test_purge_invalidated(skiatest::Reporter* reporter, GrContext* cont
b->unref();
// Add a third independent resource also with the same key.
- GrResource* r = new TestResource(context->getGpu());
+ GrCacheable* r = new TestResource();
cache.addResource(key, r);
r->unref();
@@ -141,8 +141,8 @@ static void test_cache_delete_on_destruction(skiatest::Reporter* reporter,
{
{
GrResourceCache cache(3, 30000);
- TestResource* a = new TestResource(context->getGpu());
- TestResource* b = new TestResource(context->getGpu());
+ TestResource* a = new TestResource();
+ TestResource* b = new TestResource();
cache.addResource(key, a);
cache.addResource(key, b);
@@ -157,8 +157,8 @@ static void test_cache_delete_on_destruction(skiatest::Reporter* reporter,
}
{
GrResourceCache cache(3, 30000);
- TestResource* a = new TestResource(context->getGpu());
- TestResource* b = new TestResource(context->getGpu());
+ TestResource* a = new TestResource();
+ TestResource* b = new TestResource();
cache.addResource(key, a);
cache.addResource(key, b);
« no previous file with comments | « src/gpu/gl/GrGpuGL.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698