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

Unified Diff: bench/GrResourceCacheBench.cpp

Issue 858123002: Add specialized content key class for resources. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove default template arg Created 5 years, 11 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 | « no previous file | gyp/gpu.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/GrResourceCacheBench.cpp
diff --git a/bench/GrResourceCacheBench.cpp b/bench/GrResourceCacheBench.cpp
index 2a593c5e383fcc8418b3df39ab43f6ceb41a0034..7469217c3f469263c0cb7bcc512f91204801c519 100644
--- a/bench/GrResourceCacheBench.cpp
+++ b/bench/GrResourceCacheBench.cpp
@@ -28,15 +28,12 @@ public:
this->registerWithCache();
}
- static GrResourceKey ComputeKey(int i) {
- GrCacheID::Key key;
- memset(&key, 0, sizeof(key));
- key.fData32[0] = i;
- static int gDomain = GrCacheID::GenerateDomain();
- return GrResourceKey(GrCacheID(gDomain, key), 0);
+ static void ComputeKey(int i, GrContentKey* key) {
+ static GrContentKey::Domain kDomain = GrContentKey::GenerateDomain();
+ GrContentKey::Builder builder(key, kDomain, 1);
+ builder[0] = i;
}
-
private:
size_t onGpuMemorySize() const SK_OVERRIDE { return 100; }
@@ -45,7 +42,8 @@ private:
static void populate_cache(GrGpu* gpu, int resourceCount) {
for (int i = 0; i < resourceCount; ++i) {
- GrResourceKey key = BenchResource::ComputeKey(i);
+ GrContentKey key;
+ BenchResource::ComputeKey(i, &key);
GrGpuResource* resource = SkNEW_ARGS(BenchResource, (gpu));
resource->cacheAccess().setContentKey(key);
resource->unref();
@@ -127,7 +125,8 @@ protected:
SkASSERT(CACHE_SIZE_COUNT == cache2->getResourceCount());
for (int i = 0; i < loops; ++i) {
for (int k = 0; k < CACHE_SIZE_COUNT; ++k) {
- GrResourceKey key = BenchResource::ComputeKey(k);
+ GrContentKey key;
+ BenchResource::ComputeKey(k, &key);
SkAutoTUnref<GrGpuResource> resource(cache2->findAndRefContentResource(key));
SkASSERT(resource);
}
« no previous file with comments | « no previous file | gyp/gpu.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698