| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 * Is the resource object wrapping an externally allocated GPU resource that
Skia has taken | 45 * Is the resource object wrapping an externally allocated GPU resource that
Skia has taken |
| 46 * ownership of. | 46 * ownership of. |
| 47 */ | 47 */ |
| 48 bool isAdopted() const { return GrGpuResource::kAdopted_LifeCycle == fResour
ce->fLifeCycle; } | 48 bool isAdopted() const { return GrGpuResource::kAdopted_LifeCycle == fResour
ce->fLifeCycle; } |
| 49 | 49 |
| 50 /** | 50 /** |
| 51 * Called by the cache to delete the resource under normal circumstances. | 51 * Called by the cache to delete the resource under normal circumstances. |
| 52 */ | 52 */ |
| 53 void release() { | 53 void release() { |
| 54 fResource->release(); | 54 fResource->release(); |
| 55 if (fResource->isPurgeable()) { | 55 if (fResource->isPurgeable()) { |
| 56 SkDELETE(fResource); | 56 delete fResource; |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 /** | 60 /** |
| 61 * Called by the cache to delete the resource when the backend 3D context is
no longer valid. | 61 * Called by the cache to delete the resource when the backend 3D context is
no longer valid. |
| 62 */ | 62 */ |
| 63 void abandon() { | 63 void abandon() { |
| 64 fResource->abandon(); | 64 fResource->abandon(); |
| 65 if (fResource->isPurgeable()) { | 65 if (fResource->isPurgeable()) { |
| 66 SkDELETE(fResource); | 66 delete fResource; |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 /** Called by the cache to assign a new unique key. */ | 70 /** Called by the cache to assign a new unique key. */ |
| 71 void setUniqueKey(const GrUniqueKey& key) { fResource->fUniqueKey = key; } | 71 void setUniqueKey(const GrUniqueKey& key) { fResource->fUniqueKey = key; } |
| 72 | 72 |
| 73 /** Called by the cache to make the unique key invalid. */ | 73 /** Called by the cache to make the unique key invalid. */ |
| 74 void removeUniqueKey() { fResource->fUniqueKey.reset(); } | 74 void removeUniqueKey() { fResource->fUniqueKey.reset(); } |
| 75 | 75 |
| 76 uint32_t timestamp() const { return fResource->fTimestamp; } | 76 uint32_t timestamp() const { return fResource->fTimestamp; } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 93 friend void test_unbudgeted_to_scratch(skiatest::Reporter* reporter); // for
unit testing | 93 friend void test_unbudgeted_to_scratch(skiatest::Reporter* reporter); // for
unit testing |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 inline GrGpuResource::CacheAccess GrGpuResource::cacheAccess() { return CacheAcc
ess(this); } | 96 inline GrGpuResource::CacheAccess GrGpuResource::cacheAccess() { return CacheAcc
ess(this); } |
| 97 | 97 |
| 98 inline const GrGpuResource::CacheAccess GrGpuResource::cacheAccess() const { | 98 inline const GrGpuResource::CacheAccess GrGpuResource::cacheAccess() const { |
| 99 return CacheAccess(const_cast<GrGpuResource*>(this)); | 99 return CacheAccess(const_cast<GrGpuResource*>(this)); |
| 100 } | 100 } |
| 101 | 101 |
| 102 #endif | 102 #endif |
| OLD | NEW |