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

Side by Side Diff: src/gpu/GrContext.cpp

Issue 18770007: Add a 'unique' method to SkRefCnt, document the usage, and add support. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Update comments. Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkTypefaceCache.cpp ('k') | src/gpu/GrEffect.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 2011 Google Inc. 3 * Copyright 2011 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 9
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 if (NULL == texture) { 481 if (NULL == texture) {
482 return; 482 return;
483 } 483 }
484 484
485 // This texture should already have a cache entry since it was once 485 // This texture should already have a cache entry since it was once
486 // attached 486 // attached
487 GrAssert(NULL != texture->getCacheEntry()); 487 GrAssert(NULL != texture->getCacheEntry());
488 488
489 // Conceptually, the cache entry is going to assume responsibility 489 // Conceptually, the cache entry is going to assume responsibility
490 // for the creation ref. 490 // for the creation ref.
491 GrAssert(1 == texture->getRefCnt()); 491 GrAssert(texture->unique());
492 492
493 // Since this texture came from an AutoScratchTexture it should 493 // Since this texture came from an AutoScratchTexture it should
494 // still be in the exclusive pile 494 // still be in the exclusive pile
495 fTextureCache->makeNonExclusive(texture->getCacheEntry()); 495 fTextureCache->makeNonExclusive(texture->getCacheEntry());
496 496
497 if (fGpu->caps()->reuseScratchTextures()) { 497 if (fGpu->caps()->reuseScratchTextures()) {
498 this->purgeCache(); 498 this->purgeCache();
499 } else { 499 } else {
500 // When we aren't reusing textures we know this scratch texture 500 // When we aren't reusing textures we know this scratch texture
501 // will never be reused and would be just wasting time in the cache 501 // will never be reused and would be just wasting time in the cache
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 return NULL; 1703 return NULL;
1704 } 1704 }
1705 } 1705 }
1706 1706
1707 /////////////////////////////////////////////////////////////////////////////// 1707 ///////////////////////////////////////////////////////////////////////////////
1708 #if GR_CACHE_STATS 1708 #if GR_CACHE_STATS
1709 void GrContext::printCacheStats() const { 1709 void GrContext::printCacheStats() const {
1710 fTextureCache->printStats(); 1710 fTextureCache->printStats();
1711 } 1711 }
1712 #endif 1712 #endif
OLDNEW
« no previous file with comments | « src/core/SkTypefaceCache.cpp ('k') | src/gpu/GrEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698