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

Side by Side Diff: bench/GrResourceCacheBench.cpp

Issue 257393004: Convert GrCrash->SkFAIL GrDebugCrash->SkDEBUGFAIL (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: whitespace change Created 6 years, 7 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 | « no previous file | include/core/SkTypes.h » ('j') | include/core/SkTypes.h » ('J')
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 #if SK_SUPPORT_GPU 9 #if SK_SUPPORT_GPU
10 10
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 110
111 static void check_cache_contents_or_die(GrResourceCache* cache, int k) { 111 static void check_cache_contents_or_die(GrResourceCache* cache, int k) {
112 // Benchmark find calls that succeed. 112 // Benchmark find calls that succeed.
113 { 113 {
114 GrTextureDesc desc; 114 GrTextureDesc desc;
115 get_texture_desc(k, &desc); 115 get_texture_desc(k, &desc);
116 GrResourceKey key = TextureResource::ComputeKey(desc); 116 GrResourceKey key = TextureResource::ComputeKey(desc);
117 GrResource* item = cache->find(key); 117 GrResource* item = cache->find(key);
118 if (NULL == item) { 118 if (NULL == item) {
119 GrCrash("cache add does not work as expected"); 119 SkFAIL("cache add does not work as expected");
120 return; 120 return;
121 } 121 }
122 if (static_cast<TextureResource*>(item)->fID != k) { 122 if (static_cast<TextureResource*>(item)->fID != k) {
123 GrCrash("cache add does not work as expected"); 123 SkFAIL("cache add does not work as expected");
124 return; 124 return;
125 } 125 }
126 } 126 }
127 { 127 {
128 int w, h, s; 128 int w, h, s;
129 get_stencil(k, &w, &h, &s); 129 get_stencil(k, &w, &h, &s);
130 GrResourceKey key = StencilResource::ComputeKey(w, h, s); 130 GrResourceKey key = StencilResource::ComputeKey(w, h, s);
131 GrResource* item = cache->find(key); 131 GrResource* item = cache->find(key);
132 if (NULL == item) { 132 if (NULL == item) {
133 GrCrash("cache add does not work as expected"); 133 SkFAIL("cache add does not work as expected");
134 return; 134 return;
135 } 135 }
136 if (static_cast<TextureResource*>(item)->fID != k) { 136 if (static_cast<TextureResource*>(item)->fID != k) {
137 GrCrash("cache add does not work as expected"); 137 SkFAIL("cache add does not work as expected");
138 return; 138 return;
139 } 139 }
140 } 140 }
141 141
142 // Benchmark also find calls that always fail. 142 // Benchmark also find calls that always fail.
143 { 143 {
144 GrTextureDesc desc; 144 GrTextureDesc desc;
145 get_texture_desc(k, &desc); 145 get_texture_desc(k, &desc);
146 desc.fHeight |= 1; 146 desc.fHeight |= 1;
147 GrResourceKey key = TextureResource::ComputeKey(desc); 147 GrResourceKey key = TextureResource::ComputeKey(desc);
148 GrResource* item = cache->find(key); 148 GrResource* item = cache->find(key);
149 if (NULL != item) { 149 if (NULL != item) {
150 GrCrash("cache add does not work as expected"); 150 SkFAIL("cache add does not work as expected");
151 return; 151 return;
152 } 152 }
153 } 153 }
154 { 154 {
155 int w, h, s; 155 int w, h, s;
156 get_stencil(k, &w, &h, &s); 156 get_stencil(k, &w, &h, &s);
157 h |= 1; 157 h |= 1;
158 GrResourceKey key = StencilResource::ComputeKey(w, h, s); 158 GrResourceKey key = StencilResource::ComputeKey(w, h, s);
159 GrResource* item = cache->find(key); 159 GrResource* item = cache->find(key);
160 if (NULL != item) { 160 if (NULL != item) {
161 GrCrash("cache add does not work as expected"); 161 SkFAIL("cache add does not work as expected");
162 return; 162 return;
163 } 163 }
164 } 164 }
165 } 165 }
166 166
167 class GrResourceCacheBenchAdd : public SkBenchmark { 167 class GrResourceCacheBenchAdd : public SkBenchmark {
168 enum { 168 enum {
169 RESOURCE_COUNT = CACHE_SIZE_COUNT / 2, 169 RESOURCE_COUNT = CACHE_SIZE_COUNT / 2,
170 DUPLICATE_COUNT = CACHE_SIZE_COUNT / 4, 170 DUPLICATE_COUNT = CACHE_SIZE_COUNT / 4,
171 }; 171 };
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 } 230 }
231 231
232 private: 232 private:
233 typedef SkBenchmark INHERITED; 233 typedef SkBenchmark INHERITED;
234 }; 234 };
235 235
236 DEF_BENCH( return new GrResourceCacheBenchAdd(); ) 236 DEF_BENCH( return new GrResourceCacheBenchAdd(); )
237 DEF_BENCH( return new GrResourceCacheBenchFind(); ) 237 DEF_BENCH( return new GrResourceCacheBenchFind(); )
238 238
239 #endif 239 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkTypes.h » ('j') | include/core/SkTypes.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698