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

Side by Side Diff: include/gpu/GrContext.h

Issue 392333008: Make GrCacheable implement its own ref counting. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove extra blank line Created 6 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
« no previous file with comments | « include/gpu/GrCacheable.h ('k') | include/gpu/GrGpuObject.h » ('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 2010 Google Inc. 2 * Copyright 2010 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 #ifndef GrContext_DEFINED 8 #ifndef GrContext_DEFINED
9 #define GrContext_DEFINED 9 #define GrContext_DEFINED
10 10
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 if (NULL == fTexture) { 1112 if (NULL == fTexture) {
1113 return NULL; 1113 return NULL;
1114 } 1114 }
1115 GrTexture* texture = fTexture; 1115 GrTexture* texture = fTexture;
1116 fTexture = NULL; 1116 fTexture = NULL;
1117 1117
1118 // This GrAutoScratchTexture has a ref from lockAndRefScratchTexture, wh ich we give up now. 1118 // This GrAutoScratchTexture has a ref from lockAndRefScratchTexture, wh ich we give up now.
1119 // The cache also has a ref which we are lending to the caller of detach (). When the caller 1119 // The cache also has a ref which we are lending to the caller of detach (). When the caller
1120 // lets go of the ref and the ref count goes to 0 internal_dispose will see this flag is 1120 // lets go of the ref and the ref count goes to 0 internal_dispose will see this flag is
1121 // set and re-ref the texture, thereby restoring the cache's ref. 1121 // set and re-ref the texture, thereby restoring the cache's ref.
1122 SkASSERT(texture->getRefCnt() > 1); 1122 SkASSERT(!texture->unique());
1123 texture->impl()->setFlag((GrTextureFlags) GrTextureImpl::kReturnToCache_ FlagBit); 1123 texture->impl()->setFlag((GrTextureFlags) GrTextureImpl::kReturnToCache_ FlagBit);
1124 texture->unref(); 1124 texture->unref();
1125 SkASSERT(NULL != texture->getCacheEntry()); 1125 SkASSERT(NULL != texture->getCacheEntry());
1126 1126
1127 return texture; 1127 return texture;
1128 } 1128 }
1129 1129
1130 GrTexture* set(GrContext* context, 1130 GrTexture* set(GrContext* context,
1131 const GrTextureDesc& desc, 1131 const GrTextureDesc& desc,
1132 GrContext::ScratchTexMatch match = GrContext::kApprox_Scratch TexMatch) { 1132 GrContext::ScratchTexMatch match = GrContext::kApprox_Scratch TexMatch) {
(...skipping 12 matching lines...) Expand all
1145 } 1145 }
1146 1146
1147 GrTexture* texture() { return fTexture; } 1147 GrTexture* texture() { return fTexture; }
1148 1148
1149 private: 1149 private:
1150 GrContext* fContext; 1150 GrContext* fContext;
1151 GrTexture* fTexture; 1151 GrTexture* fTexture;
1152 }; 1152 };
1153 1153
1154 #endif 1154 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrCacheable.h ('k') | include/gpu/GrGpuObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698