| OLD | NEW |
| 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 GrGpuResourceCacheAccess_DEFINED | 9 #ifndef GrGpuResourceCacheAccess_DEFINED |
| 10 #define GrGpuResourceCacheAccess_DEFINED | 10 #define GrGpuResourceCacheAccess_DEFINED |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 /** | 48 /** |
| 49 * Called by the cache to delete the resource when the backend 3D context is
no longer valid. | 49 * Called by the cache to delete the resource when the backend 3D context is
no longer valid. |
| 50 */ | 50 */ |
| 51 void abandon() { | 51 void abandon() { |
| 52 fResource->abandon(); | 52 fResource->abandon(); |
| 53 if (fResource->isPurgeable()) { | 53 if (fResource->isPurgeable()) { |
| 54 SkDELETE(fResource); | 54 SkDELETE(fResource); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 uint32_t timestamp() const { return fResource->fTimestamp; } |
| 59 void setTimestamp(uint32_t ts) { fResource->fTimestamp = ts; } |
| 60 |
| 61 int* accessCacheIndex() const { return &fResource->fCacheArrayIndex; } |
| 62 |
| 58 CacheAccess(GrGpuResource* resource) : fResource(resource) {} | 63 CacheAccess(GrGpuResource* resource) : fResource(resource) {} |
| 59 CacheAccess(const CacheAccess& that) : fResource(that.fResource) {} | 64 CacheAccess(const CacheAccess& that) : fResource(that.fResource) {} |
| 60 CacheAccess& operator=(const CacheAccess&); // unimpl | 65 CacheAccess& operator=(const CacheAccess&); // unimpl |
| 61 | 66 |
| 62 // No taking addresses of this type. | 67 // No taking addresses of this type. |
| 63 const CacheAccess* operator&() const; | 68 const CacheAccess* operator&() const; |
| 64 CacheAccess* operator&(); | 69 CacheAccess* operator&(); |
| 65 | 70 |
| 66 GrGpuResource* fResource; | 71 GrGpuResource* fResource; |
| 67 | 72 |
| 68 friend class GrGpuResource; // to construct/copy this type. | 73 friend class GrGpuResource; // to construct/copy this type. |
| 69 friend class GrResourceCache; // to use this type | 74 friend class GrResourceCache; // to use this type |
| 70 friend void test_unbudgeted_to_scratch(skiatest::Reporter* reporter); // for
unit testing | 75 friend void test_unbudgeted_to_scratch(skiatest::Reporter* reporter); // for
unit testing |
| 71 }; | 76 }; |
| 72 | 77 |
| 73 inline GrGpuResource::CacheAccess GrGpuResource::cacheAccess() { return CacheAcc
ess(this); } | 78 inline GrGpuResource::CacheAccess GrGpuResource::cacheAccess() { return CacheAcc
ess(this); } |
| 74 | 79 |
| 75 inline const GrGpuResource::CacheAccess GrGpuResource::cacheAccess() const { | 80 inline const GrGpuResource::CacheAccess GrGpuResource::cacheAccess() const { |
| 76 return CacheAccess(const_cast<GrGpuResource*>(this)); | 81 return CacheAccess(const_cast<GrGpuResource*>(this)); |
| 77 } | 82 } |
| 78 | 83 |
| 79 #endif | 84 #endif |
| OLD | NEW |