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

Side by Side Diff: bench/GrResourceCacheBench.cpp

Issue 1379923005: Remove const from `const int loops`. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: n too Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « bench/GrMemoryPoolBench.cpp ('k') | bench/GradientBench.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "Benchmark.h" 9 #include "Benchmark.h"
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 63
64 bool isSuitableFor(Backend backend) override { 64 bool isSuitableFor(Backend backend) override {
65 return backend == kNonRendering_Backend; 65 return backend == kNonRendering_Backend;
66 } 66 }
67 protected: 67 protected:
68 const char* onGetName() override { 68 const char* onGetName() override {
69 return fFullName.c_str(); 69 return fFullName.c_str();
70 } 70 }
71 71
72 void onDraw(const int loops, SkCanvas* canvas) override { 72 void onDraw(int loops, SkCanvas* canvas) override {
73 SkAutoTUnref<GrContext> context(GrContext::CreateMockContext()); 73 SkAutoTUnref<GrContext> context(GrContext::CreateMockContext());
74 if (nullptr == context) { 74 if (nullptr == context) {
75 return; 75 return;
76 } 76 }
77 // Set the cache budget to be very large so no purging occurs. 77 // Set the cache budget to be very large so no purging occurs.
78 context->setResourceCacheLimits(CACHE_SIZE_COUNT, 1 << 30); 78 context->setResourceCacheLimits(CACHE_SIZE_COUNT, 1 << 30);
79 79
80 GrResourceCache* cache = context->getResourceCache(); 80 GrResourceCache* cache = context->getResourceCache();
81 81
82 // Make sure the cache is empty. 82 // Make sure the cache is empty.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 // Make sure the cache is empty. 128 // Make sure the cache is empty.
129 cache->purgeAllUnlocked(); 129 cache->purgeAllUnlocked();
130 SkASSERT(0 == cache->getResourceCount() && 0 == cache->getResourceBytes( )); 130 SkASSERT(0 == cache->getResourceCount() && 0 == cache->getResourceBytes( ));
131 131
132 GrGpu* gpu = fContext->getGpu(); 132 GrGpu* gpu = fContext->getGpu();
133 133
134 populate_cache(gpu, CACHE_SIZE_COUNT, fKeyData32Count); 134 populate_cache(gpu, CACHE_SIZE_COUNT, fKeyData32Count);
135 } 135 }
136 136
137 void onDraw(const int loops, SkCanvas* canvas) override { 137 void onDraw(int loops, SkCanvas* canvas) override {
138 if (!fContext) { 138 if (!fContext) {
139 return; 139 return;
140 } 140 }
141 GrResourceCache* cache = fContext->getResourceCache(); 141 GrResourceCache* cache = fContext->getResourceCache();
142 SkASSERT(CACHE_SIZE_COUNT == cache->getResourceCount()); 142 SkASSERT(CACHE_SIZE_COUNT == cache->getResourceCount());
143 for (int i = 0; i < loops; ++i) { 143 for (int i = 0; i < loops; ++i) {
144 for (int k = 0; k < CACHE_SIZE_COUNT; ++k) { 144 for (int k = 0; k < CACHE_SIZE_COUNT; ++k) {
145 GrUniqueKey key; 145 GrUniqueKey key;
146 BenchResource::ComputeKey(k, fKeyData32Count, &key); 146 BenchResource::ComputeKey(k, fKeyData32Count, &key);
147 SkAutoTUnref<GrGpuResource> resource(cache->findAndRefUniqueReso urce(key)); 147 SkAutoTUnref<GrGpuResource> resource(cache->findAndRefUniqueReso urce(key));
(...skipping 30 matching lines...) Expand all
178 DEF_BENCH( return new GrResourceCacheBenchFind(4); ) 178 DEF_BENCH( return new GrResourceCacheBenchFind(4); )
179 DEF_BENCH( return new GrResourceCacheBenchFind(5); ) 179 DEF_BENCH( return new GrResourceCacheBenchFind(5); )
180 DEF_BENCH( return new GrResourceCacheBenchFind(10); ) 180 DEF_BENCH( return new GrResourceCacheBenchFind(10); )
181 DEF_BENCH( return new GrResourceCacheBenchFind(25); ) 181 DEF_BENCH( return new GrResourceCacheBenchFind(25); )
182 DEF_BENCH( return new GrResourceCacheBenchFind(54); ) 182 DEF_BENCH( return new GrResourceCacheBenchFind(54); )
183 DEF_BENCH( return new GrResourceCacheBenchFind(55); ) 183 DEF_BENCH( return new GrResourceCacheBenchFind(55); )
184 DEF_BENCH( return new GrResourceCacheBenchFind(56); ) 184 DEF_BENCH( return new GrResourceCacheBenchFind(56); )
185 #endif 185 #endif
186 186
187 #endif 187 #endif
OLDNEW
« no previous file with comments | « bench/GrMemoryPoolBench.cpp ('k') | bench/GradientBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698