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

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

Issue 2361093002: Change implementation of flush-count based GrGpuResource purging (Closed)
Patch Set: fix var spelling Created 4 years, 3 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/GrGpuResource.h ('k') | src/gpu/GrGpuResourceCacheAccess.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 2011 Google Inc. 2 * Copyright 2011 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 #include "GrGpuResource.h" 8 #include "GrGpuResource.h"
9 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "GrResourceCache.h" 10 #include "GrResourceCache.h"
11 #include "GrGpu.h" 11 #include "GrGpu.h"
12 #include "GrGpuResourcePriv.h" 12 #include "GrGpuResourcePriv.h"
13 #include "SkTraceMemoryDump.h" 13 #include "SkTraceMemoryDump.h"
14 14
15 static inline GrResourceCache* get_resource_cache(GrGpu* gpu) { 15 static inline GrResourceCache* get_resource_cache(GrGpu* gpu) {
16 SkASSERT(gpu); 16 SkASSERT(gpu);
17 SkASSERT(gpu->getContext()); 17 SkASSERT(gpu->getContext());
18 SkASSERT(gpu->getContext()->getResourceCache()); 18 SkASSERT(gpu->getContext()->getResourceCache());
19 return gpu->getContext()->getResourceCache(); 19 return gpu->getContext()->getResourceCache();
20 } 20 }
21 21
22 GrGpuResource::GrGpuResource(GrGpu* gpu) 22 GrGpuResource::GrGpuResource(GrGpu* gpu)
23 : fGpu(gpu) 23 : fExternalFlushCntWhenBecamePurgeable(0)
24 , fGpu(gpu)
24 , fGpuMemorySize(kInvalidGpuMemorySize) 25 , fGpuMemorySize(kInvalidGpuMemorySize)
25 , fBudgeted(SkBudgeted::kNo) 26 , fBudgeted(SkBudgeted::kNo)
26 , fRefsWrappedObjects(false) 27 , fRefsWrappedObjects(false)
27 , fUniqueID(CreateUniqueID()) { 28 , fUniqueID(CreateUniqueID()) {
28 SkDEBUGCODE(fCacheArrayIndex = -1); 29 SkDEBUGCODE(fCacheArrayIndex = -1);
29 } 30 }
30 31
31 void GrGpuResource::registerWithCache(SkBudgeted budgeted) { 32 void GrGpuResource::registerWithCache(SkBudgeted budgeted) {
32 SkASSERT(fBudgeted == SkBudgeted::kNo); 33 SkASSERT(fBudgeted == SkBudgeted::kNo);
33 fBudgeted = budgeted; 34 fBudgeted = budgeted;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 195 }
195 196
196 uint32_t GrGpuResource::CreateUniqueID() { 197 uint32_t GrGpuResource::CreateUniqueID() {
197 static int32_t gUniqueID = SK_InvalidUniqueID; 198 static int32_t gUniqueID = SK_InvalidUniqueID;
198 uint32_t id; 199 uint32_t id;
199 do { 200 do {
200 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); 201 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1);
201 } while (id == SK_InvalidUniqueID); 202 } while (id == SK_InvalidUniqueID);
202 return id; 203 return id;
203 } 204 }
OLDNEW
« no previous file with comments | « include/gpu/GrGpuResource.h ('k') | src/gpu/GrGpuResourceCacheAccess.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698