| 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 23 matching lines...) Expand all Loading... |
| 34 * | 34 * |
| 35 * The latter two ref types are private and intended only for Gr core code. | 35 * The latter two ref types are private and intended only for Gr core code. |
| 36 * | 36 * |
| 37 * When an item is purgable DERIVED:notifyIsPurgable() will be called (static po
ly morphism using | 37 * When an item is purgable DERIVED:notifyIsPurgable() will be called (static po
ly morphism using |
| 38 * CRTP). GrIORef and GrGpuResource are separate classes for organizational reas
ons and to be | 38 * CRTP). GrIORef and GrGpuResource are separate classes for organizational reas
ons and to be |
| 39 * able to give access via friendship to only the functions related to pending I
O operations. | 39 * able to give access via friendship to only the functions related to pending I
O operations. |
| 40 */ | 40 */ |
| 41 template <typename DERIVED> class GrIORef : public SkNoncopyable { | 41 template <typename DERIVED> class GrIORef : public SkNoncopyable { |
| 42 public: | 42 public: |
| 43 SK_DECLARE_INST_COUNT_ROOT(GrIORef) | 43 SK_DECLARE_INST_COUNT_ROOT(GrIORef) |
| 44 virtual ~GrIORef(); | |
| 45 | 44 |
| 46 // Some of the signatures are written to mirror SkRefCnt so that GrGpuResour
ce can work with | 45 // Some of the signatures are written to mirror SkRefCnt so that GrGpuResour
ce can work with |
| 47 // templated helper classes (e.g. SkAutoTUnref). However, we have different
categories of | 46 // templated helper classes (e.g. SkAutoTUnref). However, we have different
categories of |
| 48 // refs (e.g. pending reads). We also don't require thread safety as GrCache
able objects are | 47 // refs (e.g. pending reads). We also don't require thread safety as GrCache
able objects are |
| 49 // not intended to cross thread boundaries. | 48 // not intended to cross thread boundaries. |
| 50 void ref() const { | 49 void ref() const { |
| 51 this->validate(); | 50 this->validate(); |
| 52 ++fRefCnt; | 51 ++fRefCnt; |
| 53 } | 52 } |
| 54 | 53 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache | 256 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache |
| 258 const uint32_t fUniqueID; | 257 const uint32_t fUniqueID; |
| 259 | 258 |
| 260 GrResourceKey fScratchKey; | 259 GrResourceKey fScratchKey; |
| 261 | 260 |
| 262 typedef GrIORef<GrGpuResource> INHERITED; | 261 typedef GrIORef<GrGpuResource> INHERITED; |
| 263 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgable. | 262 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgable. |
| 264 }; | 263 }; |
| 265 | 264 |
| 266 #endif | 265 #endif |
| OLD | NEW |