OLD | NEW |
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(const int loops, SkCanvas* canvas) override { |
73 SkAutoTUnref<GrContext> context(GrContext::CreateMockContext()); | 73 SkAutoTUnref<GrContext> context(GrContext::CreateMockContext()); |
74 if (NULL == 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. |
83 cache->purgeAllUnlocked(); | 83 cache->purgeAllUnlocked(); |
84 SkASSERT(0 == cache->getResourceCount() && 0 == cache->getResourceBytes(
)); | 84 SkASSERT(0 == cache->getResourceCount() && 0 == cache->getResourceBytes(
)); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |