Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 262 void setScratchKey(const GrScratchKey& scratchKey); | 262 void setScratchKey(const GrScratchKey& scratchKey); |
| 263 | 263 |
| 264 private: | 264 private: |
| 265 /** | 265 /** |
| 266 * Frees the object in the underlying 3D API. Called by CacheAccess. | 266 * Frees the object in the underlying 3D API. Called by CacheAccess. |
| 267 */ | 267 */ |
| 268 void release(); | 268 void release(); |
| 269 | 269 |
| 270 virtual size_t onGpuMemorySize() const = 0; | 270 virtual size_t onGpuMemorySize() const = 0; |
| 271 | 271 |
| 272 // See comments in CacheAccess. | 272 // See comments in CacheAccess and ResourcePriv. |
| 273 bool setContentKey(const GrContentKey& contentKey); | 273 bool setContentKey(const GrContentKey& contentKey); |
| 274 void removeContentKey(); | 274 void removeContentKey(); |
| 275 void notifyIsPurgeable() const; | 275 void notifyIsPurgeable() const; |
| 276 void removeScratchKey(); | 276 void removeScratchKey(); |
| 277 void makeBudgeted(); | 277 void makeBudgeted(); |
| 278 void makeUnbudgeted(); | 278 void makeUnbudgeted(); |
| 279 | 279 |
| 280 #ifdef SK_DEBUG | 280 #ifdef SK_DEBUG |
| 281 friend class GrGpu; // for assert in GrGpu to access getGpu | 281 friend class GrGpu; // for assert in GrGpu to access getGpu |
| 282 #endif | 282 #endif |
| 283 | 283 |
| 284 static uint32_t CreateUniqueID(); | 284 static uint32_t CreateUniqueID(); |
| 285 | 285 |
| 286 // We're in an internal doubly linked list owned by GrResourceCache | 286 // We're in an internal doubly linked list owned by GrResourceCache. TODO: R eplace this with an |
| 287 // array of unpurgeable resources in the cache. | |
| 287 SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrGpuResource); | 288 SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrGpuResource); |
| 288 | 289 |
|
robertphillips
2015/02/17 17:55:46
Maybe more detail in the comment?
fCacheArrayIndex
bsalomon
2015/02/17 19:18:43
Done.
| |
| 290 // These are used for cache bookkeeping | |
| 291 int fCacheArrayIndex; | |
| 292 uint32_t fTimestamp; | |
| 289 | 293 |
| 290 static const size_t kInvalidGpuMemorySize = ~static_cast<size_t>(0); | 294 static const size_t kInvalidGpuMemorySize = ~static_cast<size_t>(0); |
| 291 GrScratchKey fScratchKey; | 295 GrScratchKey fScratchKey; |
| 292 GrContentKey fContentKey; | 296 GrContentKey fContentKey; |
| 293 | 297 |
| 294 // This is not ref'ed but abandon() or release() will be called before the G rGpu object | 298 // This is not ref'ed but abandon() or release() will be called before the G rGpu object |
| 295 // is destroyed. Those calls set will this to NULL. | 299 // is destroyed. Those calls set will this to NULL. |
| 296 GrGpu* fGpu; | 300 GrGpu* fGpu; |
| 297 mutable size_t fGpuMemorySize; | 301 mutable size_t fGpuMemorySize; |
| 298 | 302 |
| 299 LifeCycle fLifeCycle; | 303 LifeCycle fLifeCycle; |
| 300 const uint32_t fUniqueID; | 304 const uint32_t fUniqueID; |
| 301 | 305 |
| 302 SkAutoTUnref<const SkData> fData; | 306 SkAutoTUnref<const SkData> fData; |
| 303 | 307 |
| 304 typedef GrIORef<GrGpuResource> INHERITED; | 308 typedef GrIORef<GrGpuResource> INHERITED; |
| 305 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgeable. | 309 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgeable. |
| 306 }; | 310 }; |
| 307 | 311 |
| 308 #endif | 312 #endif |
| OLD | NEW |