| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 GrResourceCacheEntry* getCacheEntry() { return fCacheEntry; } | 83 GrResourceCacheEntry* getCacheEntry() { return fCacheEntry; } |
| 84 | 84 |
| 85 /** | 85 /** |
| 86 * Gets an id that is unique for this GrCacheable object. It is static in th
at it does | 86 * Gets an id that is unique for this GrCacheable object. It is static in th
at it does |
| 87 * not change when the content of the GrCacheable object changes. This will
never return | 87 * not change when the content of the GrCacheable object changes. This will
never return |
| 88 * 0. | 88 * 0. |
| 89 */ | 89 */ |
| 90 uint32_t getUniqueID() const { return fUniqueID; } | 90 uint32_t getUniqueID() const { return fUniqueID; } |
| 91 | 91 |
| 92 protected: | 92 protected: |
| 93 |
| 94 // This must be called by every GrGpuObject. It should be called once the ob
ject is fully |
| 95 // initialized (i.e. not in a base class constructor). |
| 96 void registerWithCache(); |
| 97 |
| 93 GrGpuResource(GrGpu*, bool isWrapped); | 98 GrGpuResource(GrGpu*, bool isWrapped); |
| 94 virtual ~GrGpuResource(); | 99 virtual ~GrGpuResource(); |
| 95 | 100 |
| 96 bool isInCache() const { return NULL != fCacheEntry; } | 101 bool isInCache() const { return NULL != fCacheEntry; } |
| 97 | 102 |
| 98 GrGpu* getGpu() const { return fGpu; } | 103 GrGpu* getGpu() const { return fGpu; } |
| 99 | 104 |
| 100 // Derived classes should always call their parent class' onRelease | 105 // Derived classes should always call their parent class' onRelease |
| 101 // and onAbandon methods in their overrides. | 106 // and onAbandon methods in their overrides. |
| 102 virtual void onRelease() {}; | 107 virtual void onRelease() {}; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 uint32_t fFlags; | 143 uint32_t fFlags; |
| 139 | 144 |
| 140 mutable int32_t fRefCnt; | 145 mutable int32_t fRefCnt; |
| 141 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache | 146 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache |
| 142 const uint32_t fUniqueID; | 147 const uint32_t fUniqueID; |
| 143 | 148 |
| 144 typedef SkNoncopyable INHERITED; | 149 typedef SkNoncopyable INHERITED; |
| 145 }; | 150 }; |
| 146 | 151 |
| 147 #endif | 152 #endif |
| OLD | NEW |