OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 | 9 |
10 #ifndef GrResource_DEFINED | 10 #ifndef GrResource_DEFINED |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 // Derived classes should always call their parent class' onRelease | 86 // Derived classes should always call their parent class' onRelease |
87 // and onAbandon methods in their overrides. | 87 // and onAbandon methods in their overrides. |
88 virtual void onRelease() {}; | 88 virtual void onRelease() {}; |
89 virtual void onAbandon() {}; | 89 virtual void onAbandon() {}; |
90 | 90 |
91 bool isInCache() const { return NULL != fCacheEntry; } | 91 bool isInCache() const { return NULL != fCacheEntry; } |
92 bool isWrapped() const { return kWrapped_Flag & fFlags; } | 92 bool isWrapped() const { return kWrapped_Flag & fFlags; } |
93 | 93 |
94 private: | 94 private: |
95 #if GR_DEBUG | 95 #ifdef SK_DEBUG |
96 friend class GrGpu; // for assert in GrGpu to access getGpu | 96 friend class GrGpu; // for assert in GrGpu to access getGpu |
97 #endif | 97 #endif |
98 | 98 |
99 // We're in an internal doubly linked list | 99 // We're in an internal doubly linked list |
100 SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrResource); | 100 SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrResource); |
101 | 101 |
102 GrGpu* fGpu; // not reffed. The GrGpu can be dele
ted while there | 102 GrGpu* fGpu; // not reffed. The GrGpu can be dele
ted while there |
103 // are still live GrResources. It wi
ll call | 103 // are still live GrResources. It wi
ll call |
104 // release() on all such resources i
n its | 104 // release() on all such resources i
n its |
105 // destructor. | 105 // destructor. |
106 GrResourceEntry* fCacheEntry; // NULL if not in cache | 106 GrResourceEntry* fCacheEntry; // NULL if not in cache |
107 mutable int fDeferredRefCount; // How many references in deferred d
rawing buffers. | 107 mutable int fDeferredRefCount; // How many references in deferred d
rawing buffers. |
108 | 108 |
109 enum Flags { | 109 enum Flags { |
110 kWrapped_Flag = 0x1, | 110 kWrapped_Flag = 0x1, |
111 }; | 111 }; |
112 uint32_t fFlags; | 112 uint32_t fFlags; |
113 | 113 |
114 typedef GrRefCnt INHERITED; | 114 typedef GrRefCnt INHERITED; |
115 }; | 115 }; |
116 | 116 |
117 #endif | 117 #endif |
OLD | NEW |