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

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

Issue 1862043002: Refactor to separate backend object lifecycle and GpuResource budget decision (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix unrelated GrBuffer::onGpuMemorySize() lack of override keyword compile error Created 4 years, 8 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 | « src/gpu/GrPathRange.cpp ('k') | src/gpu/GrResourceCache.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 2014 Google Inc. 2 * Copyright 2014 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 GrResourceCache_DEFINED 8 #ifndef GrResourceCache_DEFINED
9 #define GrResourceCache_DEFINED 9 #define GrResourceCache_DEFINED
10 10
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 void notifyFlushOccurred(); 182 void notifyFlushOccurred();
183 183
184 #if GR_CACHE_STATS 184 #if GR_CACHE_STATS
185 struct Stats { 185 struct Stats {
186 int fTotal; 186 int fTotal;
187 int fNumPurgeable; 187 int fNumPurgeable;
188 int fNumNonPurgeable; 188 int fNumNonPurgeable;
189 189
190 int fScratch; 190 int fScratch;
191 int fExternal; 191 int fWrapped;
192 int fBorrowed;
193 int fAdopted;
194 size_t fUnbudgetedSize; 192 size_t fUnbudgetedSize;
195 193
196 Stats() { this->reset(); } 194 Stats() { this->reset(); }
197 195
198 void reset() { 196 void reset() {
199 fTotal = 0; 197 fTotal = 0;
200 fNumPurgeable = 0; 198 fNumPurgeable = 0;
201 fNumNonPurgeable = 0; 199 fNumNonPurgeable = 0;
202 fScratch = 0; 200 fScratch = 0;
203 fExternal = 0; 201 fWrapped = 0;
204 fBorrowed = 0;
205 fAdopted = 0;
206 fUnbudgetedSize = 0; 202 fUnbudgetedSize = 0;
207 } 203 }
208 204
209 void update(GrGpuResource* resource) { 205 void update(GrGpuResource* resource) {
210 if (resource->cacheAccess().isScratch()) { 206 if (resource->cacheAccess().isScratch()) {
211 ++fScratch; 207 ++fScratch;
212 } 208 }
213 if (resource->resourcePriv().isExternal()) { 209 if (resource->resourcePriv().refsWrappedObjects()) {
214 ++fExternal; 210 ++fWrapped;
215 }
216 if (resource->cacheAccess().isBorrowed()) {
217 ++fBorrowed;
218 }
219 if (resource->cacheAccess().isAdopted()) {
220 ++fAdopted;
221 } 211 }
222 if (SkBudgeted::kNo == resource->resourcePriv().isBudgeted()) { 212 if (SkBudgeted::kNo == resource->resourcePriv().isBudgeted()) {
223 fUnbudgetedSize += resource->gpuMemorySize(); 213 fUnbudgetedSize += resource->gpuMemorySize();
224 } 214 }
225 } 215 }
226 }; 216 };
227 217
228 void getStats(Stats*) const; 218 void getStats(Stats*) const;
229 219
230 void dumpStats(SkString*) const; 220 void dumpStats(SkString*) const;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 420
431 friend class GrGpuResource; // To access all the proxy inline methods. 421 friend class GrGpuResource; // To access all the proxy inline methods.
432 friend class GrResourceCache; // To create this type. 422 friend class GrResourceCache; // To create this type.
433 }; 423 };
434 424
435 inline GrResourceCache::ResourceAccess GrResourceCache::resourceAccess() { 425 inline GrResourceCache::ResourceAccess GrResourceCache::resourceAccess() {
436 return ResourceAccess(this); 426 return ResourceAccess(this);
437 } 427 }
438 428
439 #endif 429 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrPathRange.cpp ('k') | src/gpu/GrResourceCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698