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

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

Issue 1413483004: Revert of Update Layer Hoisting to store its atlas texture in the resource cache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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 | « src/gpu/GrRectanizer_skyline.h ('k') | src/gpu/GrTest.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 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 GrResourceCache_DEFINED 9 #ifndef GrResourceCache_DEFINED
10 #define GrResourceCache_DEFINED 10 #define GrResourceCache_DEFINED
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 * provided here will be passed back to the callback. Note that the cache wi ll attempt to purge 175 * provided here will be passed back to the callback. Note that the cache wi ll attempt to purge
176 * any resources newly freed by the callback. 176 * any resources newly freed by the callback.
177 */ 177 */
178 void setOverBudgetCallback(PFOverBudgetCB overBudgetCB, void* data) { 178 void setOverBudgetCallback(PFOverBudgetCB overBudgetCB, void* data) {
179 fOverBudgetCB = overBudgetCB; 179 fOverBudgetCB = overBudgetCB;
180 fOverBudgetData = data; 180 fOverBudgetData = data;
181 } 181 }
182 182
183 void notifyFlushOccurred(); 183 void notifyFlushOccurred();
184 184
185 #if GR_CACHE_STATS 185 #if GR_GPU_STATS
186 struct Stats {
187 int fTotal;
188 int fNumPurgeable;
189 int fNumNonPurgeable;
190
191 int fScratch;
192 int fExternal;
193 int fBorrowed;
194 int fAdopted;
195 size_t fUnbudgetedSize;
196
197 Stats() { this->reset(); }
198
199 void reset() {
200 fTotal = 0;
201 fNumPurgeable = 0;
202 fNumNonPurgeable = 0;
203 fScratch = 0;
204 fExternal = 0;
205 fBorrowed = 0;
206 fAdopted = 0;
207 fUnbudgetedSize = 0;
208 }
209
210 void update(GrGpuResource* resource) {
211 if (resource->cacheAccess().isScratch()) {
212 ++fScratch;
213 }
214 if (resource->cacheAccess().isExternal()) {
215 ++fExternal;
216 }
217 if (resource->cacheAccess().isBorrowed()) {
218 ++fBorrowed;
219 }
220 if (resource->cacheAccess().isAdopted()) {
221 ++fAdopted;
222 }
223 if (!resource->resourcePriv().isBudgeted()) {
224 fUnbudgetedSize += resource->gpuMemorySize();
225 }
226 }
227 };
228
229 void getStats(Stats*) const;
230
231 void dumpStats(SkString*) const; 186 void dumpStats(SkString*) const;
232 #endif 187 #endif
233 188
234 // This function is for unit testing and is only defined in test tools. 189 // This function is for unit testing and is only defined in test tools.
235 void changeTimestamp(uint32_t newTimestamp); 190 void changeTimestamp(uint32_t newTimestamp);
236 191
237 // Enumerates all cached resources and dumps their details to traceMemoryDum p. 192 // Enumerates all cached resources and dumps their details to traceMemoryDum p.
238 void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const; 193 void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const;
239 194
240 private: 195 private:
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 384
430 friend class GrGpuResource; // To access all the proxy inline methods. 385 friend class GrGpuResource; // To access all the proxy inline methods.
431 friend class GrResourceCache; // To create this type. 386 friend class GrResourceCache; // To create this type.
432 }; 387 };
433 388
434 inline GrResourceCache::ResourceAccess GrResourceCache::resourceAccess() { 389 inline GrResourceCache::ResourceAccess GrResourceCache::resourceAccess() {
435 return ResourceAccess(this); 390 return ResourceAccess(this);
436 } 391 }
437 392
438 #endif 393 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrRectanizer_skyline.h ('k') | src/gpu/GrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698