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 | |
98 GrGpuResource(GrGpu*, bool isWrapped); | 93 GrGpuResource(GrGpu*, bool isWrapped); |
99 virtual ~GrGpuResource(); | 94 virtual ~GrGpuResource(); |
100 | 95 |
101 bool isInCache() const { return NULL != fCacheEntry; } | 96 bool isInCache() const { return NULL != fCacheEntry; } |
102 | 97 |
103 GrGpu* getGpu() const { return fGpu; } | 98 GrGpu* getGpu() const { return fGpu; } |
104 | 99 |
105 // Derived classes should always call their parent class' onRelease | 100 // Derived classes should always call their parent class' onRelease |
106 // and onAbandon methods in their overrides. | 101 // and onAbandon methods in their overrides. |
107 virtual void onRelease() {}; | 102 virtual void onRelease() {}; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 uint32_t fFlags; | 138 uint32_t fFlags; |
144 | 139 |
145 mutable int32_t fRefCnt; | 140 mutable int32_t fRefCnt; |
146 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache | 141 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache |
147 const uint32_t fUniqueID; | 142 const uint32_t fUniqueID; |
148 | 143 |
149 typedef SkNoncopyable INHERITED; | 144 typedef SkNoncopyable INHERITED; |
150 }; | 145 }; |
151 | 146 |
152 #endif | 147 #endif |
OLD | NEW |