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

Side by Side Diff: tests/ResourceCacheTest.cpp

Issue 722763002: set key data in duplicate scratch key unit test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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 | no next file » | 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 #if SK_SUPPORT_GPU 8 #if SK_SUPPORT_GPU
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 if (NULL == context) { 124 if (NULL == context) {
125 return; 125 return;
126 } 126 }
127 context->setResourceCacheLimits(5, 30000); 127 context->setResourceCacheLimits(5, 30000);
128 GrResourceCache* cache = context->getResourceCache(); 128 GrResourceCache* cache = context->getResourceCache();
129 SkDEBUGCODE(GrResourceCache2* cache2 = context->getResourceCache2();) 129 SkDEBUGCODE(GrResourceCache2* cache2 = context->getResourceCache2();)
130 cache->purgeAllUnlocked(); 130 cache->purgeAllUnlocked();
131 SkASSERT(0 == cache->getCachedResourceCount() && 0 == cache->getCachedResour ceBytes()); 131 SkASSERT(0 == cache->getCachedResourceCount() && 0 == cache->getCachedResour ceBytes());
132 132
133 GrCacheID::Key keyData; 133 GrCacheID::Key keyData;
134 memset(&keyData, 0, sizeof(keyData));
134 GrCacheID::Domain domain = GrResourceKey::ScratchDomain(); 135 GrCacheID::Domain domain = GrResourceKey::ScratchDomain();
135 GrResourceKey::ResourceType t = GrResourceKey::GenerateResourceType(); 136 GrResourceKey::ResourceType t = GrResourceKey::GenerateResourceType();
136 GrResourceKey scratchKey(GrCacheID(domain, keyData), t, 0); 137 GrResourceKey scratchKey(GrCacheID(domain, keyData), t, 0);
137 138
138 // Create two resources that have the same scratch key. 139 // Create two resources that have the same scratch key.
139 TestResource* a = new TestResource(context->getGpu(), scratchKey); 140 TestResource* a = new TestResource(context->getGpu(), scratchKey);
140 TestResource* b = new TestResource(context->getGpu(), scratchKey); 141 TestResource* b = new TestResource(context->getGpu(), scratchKey);
141 a->setSize(11); 142 a->setSize(11);
142 b->setSize(12); 143 b->setSize(12);
143 // Scratch resources are registered with GrResourceCache2 just by existing. There are 2. 144 // Scratch resources are registered with GrResourceCache2 just by existing. There are 2.
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 457
457 // The below tests create their own mock contexts. 458 // The below tests create their own mock contexts.
458 test_duplicate_content_key(reporter); 459 test_duplicate_content_key(reporter);
459 test_duplicate_scratch_key(reporter); 460 test_duplicate_scratch_key(reporter);
460 test_purge_invalidated(reporter); 461 test_purge_invalidated(reporter);
461 test_cache_delete_on_destruction(reporter); 462 test_cache_delete_on_destruction(reporter);
462 test_resource_size_changed(reporter); 463 test_resource_size_changed(reporter);
463 } 464 }
464 465
465 #endif 466 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698