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

Side by Side Diff: tests/ResourceCacheTest.cpp

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 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 | « tests/ReadWriteAlphaTest.cpp ('k') | tests/SRGBReadWritePixelsTest.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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 // Include here to ensure SK_SUPPORT_GPU is set correctly before it is examined. 8 // Include here to ensure SK_SUPPORT_GPU is set correctly before it is examined.
9 #include "SkTypes.h" 9 #include "SkTypes.h"
10 10
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 223
224 gpu->deleteTestingOnlyBackendTexture(texHandles[0], !borrowedIsAlive); 224 gpu->deleteTestingOnlyBackendTexture(texHandles[0], !borrowedIsAlive);
225 gpu->deleteTestingOnlyBackendTexture(texHandles[1], !adoptedIsAlive); 225 gpu->deleteTestingOnlyBackendTexture(texHandles[1], !adoptedIsAlive);
226 226
227 context->resetContext(); 227 context->resetContext();
228 } 228 }
229 229
230 class TestResource : public GrGpuResource { 230 class TestResource : public GrGpuResource {
231 enum ScratchConstructor { kScratchConstructor }; 231 enum ScratchConstructor { kScratchConstructor };
232 public: 232 public:
233 GrRenderTarget* arrgh() override { return NULL; }
234
233 static const size_t kDefaultSize = 100; 235 static const size_t kDefaultSize = 100;
234 236
235 /** Property that distinctly categorizes the resource. 237 /** Property that distinctly categorizes the resource.
236 * For example, textures have width, height, ... */ 238 * For example, textures have width, height, ... */
237 enum SimulatedProperty { kA_SimulatedProperty, kB_SimulatedProperty }; 239 enum SimulatedProperty { kA_SimulatedProperty, kB_SimulatedProperty };
238 240
239 TestResource(GrGpu* gpu, size_t size, GrGpuResource::LifeCycle lifeCycle) 241 TestResource(GrGpu* gpu, size_t size, GrGpuResource::LifeCycle lifeCycle)
240 : INHERITED(gpu, lifeCycle) 242 : INHERITED(gpu, lifeCycle, GrGpuResource::kOther)
241 , fToDelete(nullptr) 243 , fToDelete(nullptr)
242 , fSize(size) 244 , fSize(size)
243 , fProperty(kA_SimulatedProperty) { 245 , fProperty(kA_SimulatedProperty) {
244 ++fNumAlive; 246 ++fNumAlive;
245 this->registerWithCache(); 247 this->registerWithCache();
246 } 248 }
247 249
248 TestResource(GrGpu* gpu, GrGpuResource::LifeCycle lifeCycle) 250 TestResource(GrGpu* gpu, GrGpuResource::LifeCycle lifeCycle)
249 : INHERITED(gpu, lifeCycle) 251 : INHERITED(gpu, lifeCycle, GrGpuResource::kOther)
250 , fToDelete(nullptr) 252 , fToDelete(nullptr)
251 , fSize(kDefaultSize) 253 , fSize(kDefaultSize)
252 , fProperty(kA_SimulatedProperty) { 254 , fProperty(kA_SimulatedProperty) {
253 ++fNumAlive; 255 ++fNumAlive;
254 this->registerWithCache(); 256 this->registerWithCache();
255 } 257 }
256 258
257 TestResource(GrGpu* gpu) 259 TestResource(GrGpu* gpu)
258 : INHERITED(gpu, kCached_LifeCycle) 260 : INHERITED(gpu, kCached_LifeCycle, GrGpuResource::kOther)
259 , fToDelete(nullptr) 261 , fToDelete(nullptr)
260 , fSize(kDefaultSize) 262 , fSize(kDefaultSize)
261 , fProperty(kA_SimulatedProperty) { 263 , fProperty(kA_SimulatedProperty) {
262 ++fNumAlive; 264 ++fNumAlive;
263 this->registerWithCache(); 265 this->registerWithCache();
264 } 266 }
265 267
266 static TestResource* CreateScratch(GrGpu* gpu, SimulatedProperty property, b ool cached = true) { 268 static TestResource* CreateScratch(GrGpu* gpu, SimulatedProperty property, b ool cached = true) {
267 return new TestResource(gpu, property, cached, kScratchConstructor); 269 return new TestResource(gpu, property, cached, kScratchConstructor);
268 } 270 }
(...skipping 23 matching lines...) Expand all
292 } 294 }
293 295
294 static size_t ExpectedScratchKeySize() { 296 static size_t ExpectedScratchKeySize() {
295 return sizeof(uint32_t) * (kScratchKeyFieldCnt + GrScratchKey::kMetaData Cnt); 297 return sizeof(uint32_t) * (kScratchKeyFieldCnt + GrScratchKey::kMetaData Cnt);
296 } 298 }
297 299
298 private: 300 private:
299 static const int kScratchKeyFieldCnt = 6; 301 static const int kScratchKeyFieldCnt = 6;
300 302
301 TestResource(GrGpu* gpu, SimulatedProperty property, bool cached, ScratchCon structor) 303 TestResource(GrGpu* gpu, SimulatedProperty property, bool cached, ScratchCon structor)
302 : INHERITED(gpu, cached ? kCached_LifeCycle : kUncached_LifeCycle) 304 : INHERITED(gpu, cached ? kCached_LifeCycle : kUncached_LifeCycle, GrGpu Resource::kOther)
303 , fToDelete(nullptr) 305 , fToDelete(nullptr)
304 , fSize(kDefaultSize) 306 , fSize(kDefaultSize)
305 , fProperty(property) { 307 , fProperty(property) {
306 GrScratchKey scratchKey; 308 GrScratchKey scratchKey;
307 ComputeScratchKey(fProperty, &scratchKey); 309 ComputeScratchKey(fProperty, &scratchKey);
308 this->setScratchKey(scratchKey); 310 this->setScratchKey(scratchKey);
309 ++fNumAlive; 311 ++fNumAlive;
310 this->registerWithCache(); 312 this->registerWithCache();
311 } 313 }
312 314
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 test_cache_chained_purge(reporter); 1323 test_cache_chained_purge(reporter);
1322 test_resource_size_changed(reporter); 1324 test_resource_size_changed(reporter);
1323 test_timestamp_wrap(reporter); 1325 test_timestamp_wrap(reporter);
1324 test_flush(reporter); 1326 test_flush(reporter);
1325 test_large_resource_count(reporter); 1327 test_large_resource_count(reporter);
1326 test_custom_data(reporter); 1328 test_custom_data(reporter);
1327 test_abandoned(reporter); 1329 test_abandoned(reporter);
1328 } 1330 }
1329 1331
1330 #endif 1332 #endif
OLDNEW
« no previous file with comments | « tests/ReadWriteAlphaTest.cpp ('k') | tests/SRGBReadWritePixelsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698