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

Side by Side Diff: src/gpu/GrGpuResourceCacheAccess.h

Issue 848903004: Require budget decision when creating a RenderTarget SkSurface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address initial comments Created 5 years, 11 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 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 #ifndef GrGpuResourceCacheAccess_DEFINED 9 #ifndef GrGpuResourceCacheAccess_DEFINED
10 #define GrGpuResourceCacheAccess_DEFINED 10 #define GrGpuResourceCacheAccess_DEFINED
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 * Is the resource object wrapping an externally allocated GPU resource? 63 * Is the resource object wrapping an externally allocated GPU resource?
64 */ 64 */
65 bool isWrapped() const { return GrGpuResource::kWrapped_LifeCycle == fResour ce->fLifeCycle; } 65 bool isWrapped() const { return GrGpuResource::kWrapped_LifeCycle == fResour ce->fLifeCycle; }
66 66
67 /** 67 /**
68 * Does the resource count against the resource budget? 68 * Does the resource count against the resource budget?
69 */ 69 */
70 bool isBudgeted() const { return GrGpuResource::kCached_LifeCycle == fResour ce->fLifeCycle; } 70 bool isBudgeted() const { return GrGpuResource::kCached_LifeCycle == fResour ce->fLifeCycle; }
71 71
72 /** 72 /**
73 * If the resource is uncached make it cached. Has no effect on resources th at are wrapped or
74 * already cached.
75 */
76 void makeBudgeted() { fResource->makeBudgeted(); }
77
78 /**
73 * Called by the cache to delete the resource under normal circumstances. 79 * Called by the cache to delete the resource under normal circumstances.
74 */ 80 */
75 void release() { 81 void release() {
76 fResource->release(); 82 fResource->release();
77 if (fResource->isPurgable()) { 83 if (fResource->isPurgable()) {
78 SkDELETE(fResource); 84 SkDELETE(fResource);
79 } 85 }
80 } 86 }
81 87
82 /** 88 /**
(...skipping 20 matching lines...) Expand all
103 friend class GrGpuResource; // to construct/copy this type. 109 friend class GrGpuResource; // to construct/copy this type.
104 }; 110 };
105 111
106 inline GrGpuResource::CacheAccess GrGpuResource::cacheAccess() { return CacheAcc ess(this); } 112 inline GrGpuResource::CacheAccess GrGpuResource::cacheAccess() { return CacheAcc ess(this); }
107 113
108 inline const GrGpuResource::CacheAccess GrGpuResource::cacheAccess() const { 114 inline const GrGpuResource::CacheAccess GrGpuResource::cacheAccess() const {
109 return CacheAccess(const_cast<GrGpuResource*>(this)); 115 return CacheAccess(const_cast<GrGpuResource*>(this));
110 } 116 }
111 117
112 #endif 118 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrGpuResource.cpp ('k') | src/gpu/GrResourceCache2.cpp » ('j') | tests/SurfaceTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698