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

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

Issue 932863004: Use an array of nonpurgeable resources in GrResourceCache (Closed) Base URL: https://skia.googlesource.com/skia.git@queue
Patch Set: skdebugf- Created 5 years, 10 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 | « no previous file | src/gpu/GrResourceCache.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 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 GrGpuResource_DEFINED 8 #ifndef GrGpuResource_DEFINED
9 #define GrGpuResource_DEFINED 9 #define GrGpuResource_DEFINED
10 10
11 #include "GrResourceKey.h" 11 #include "GrResourceKey.h"
12 #include "GrTypesPriv.h" 12 #include "GrTypesPriv.h"
13 #include "SkData.h" 13 #include "SkData.h"
14 #include "SkInstCnt.h" 14 #include "SkInstCnt.h"
15 #include "SkTInternalLList.h"
16 15
17 class GrContext; 16 class GrContext;
18 class GrGpu; 17 class GrGpu;
19 class GrResourceCache; 18 class GrResourceCache;
20 19
21 /** 20 /**
22 * Base class for GrGpuResource. Handles the various types of refs we need. Sepa rated out as a base 21 * Base class for GrGpuResource. Handles the various types of refs we need. Sepa rated out as a base
23 * class to isolate the ref-cnting behavior and provide friendship without expos ing all of 22 * class to isolate the ref-cnting behavior and provide friendship without expos ing all of
24 * GrGpuResource. 23 * GrGpuResource.
25 * 24 *
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 void removeScratchKey(); 275 void removeScratchKey();
277 void makeBudgeted(); 276 void makeBudgeted();
278 void makeUnbudgeted(); 277 void makeUnbudgeted();
279 278
280 #ifdef SK_DEBUG 279 #ifdef SK_DEBUG
281 friend class GrGpu; // for assert in GrGpu to access getGpu 280 friend class GrGpu; // for assert in GrGpu to access getGpu
282 #endif 281 #endif
283 282
284 static uint32_t CreateUniqueID(); 283 static uint32_t CreateUniqueID();
285 284
286 // We're in an internal doubly linked list owned by GrResourceCache. TODO: R eplace this with an 285 // An index into a heap when this resource is purgeable or an array when not . This is maintained
287 // array of unpurgeable resources in the cache. 286 // by the cache.
288 SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrGpuResource);
289
290 // An index into a heap when this resource is purgeable. This is maintained by the cache.
291 int fCacheArrayIndex; 287 int fCacheArrayIndex;
292 // This value reflects how recently this resource was accessed in the cache. This is maintained 288 // This value reflects how recently this resource was accessed in the cache. This is maintained
293 // by the cache. 289 // by the cache.
294 uint32_t fTimestamp; 290 uint32_t fTimestamp;
295 291
296 static const size_t kInvalidGpuMemorySize = ~static_cast<size_t>(0); 292 static const size_t kInvalidGpuMemorySize = ~static_cast<size_t>(0);
297 GrScratchKey fScratchKey; 293 GrScratchKey fScratchKey;
298 GrContentKey fContentKey; 294 GrContentKey fContentKey;
299 295
300 // This is not ref'ed but abandon() or release() will be called before the G rGpu object 296 // This is not ref'ed but abandon() or release() will be called before the G rGpu object
301 // is destroyed. Those calls set will this to NULL. 297 // is destroyed. Those calls set will this to NULL.
302 GrGpu* fGpu; 298 GrGpu* fGpu;
303 mutable size_t fGpuMemorySize; 299 mutable size_t fGpuMemorySize;
304 300
305 LifeCycle fLifeCycle; 301 LifeCycle fLifeCycle;
306 const uint32_t fUniqueID; 302 const uint32_t fUniqueID;
307 303
308 SkAutoTUnref<const SkData> fData; 304 SkAutoTUnref<const SkData> fData;
309 305
310 typedef GrIORef<GrGpuResource> INHERITED; 306 typedef GrIORef<GrGpuResource> INHERITED;
311 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgeable. 307 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgeable.
312 }; 308 };
313 309
314 #endif 310 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrResourceCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698