| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 bool isPurgeable() const { return !this->internalHasRef() && !this->internal
HasPendingIO(); } | 87 bool isPurgeable() const { return !this->internalHasRef() && !this->internal
HasPendingIO(); } |
| 88 | 88 |
| 89 bool internalHasPendingRead() const { return SkToBool(fPendingReads); } | 89 bool internalHasPendingRead() const { return SkToBool(fPendingReads); } |
| 90 bool internalHasPendingWrite() const { return SkToBool(fPendingWrites); } | 90 bool internalHasPendingWrite() const { return SkToBool(fPendingWrites); } |
| 91 bool internalHasPendingIO() const { return SkToBool(fPendingWrites | fPendin
gReads); } | 91 bool internalHasPendingIO() const { return SkToBool(fPendingWrites | fPendin
gReads); } |
| 92 | 92 |
| 93 bool internalHasRef() const { return SkToBool(fRefCnt); } | 93 bool internalHasRef() const { return SkToBool(fRefCnt); } |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 friend class GrIORefProxy; // needs to forward on wrapped IO calls |
| 97 |
| 96 void addPendingRead() const { | 98 void addPendingRead() const { |
| 97 this->validate(); | 99 this->validate(); |
| 98 ++fPendingReads; | 100 ++fPendingReads; |
| 99 } | 101 } |
| 100 | 102 |
| 101 void completedRead() const { | 103 void completedRead() const { |
| 102 this->validate(); | 104 this->validate(); |
| 103 --fPendingReads; | 105 --fPendingReads; |
| 104 this->didRemoveRefOrPendingIO(kPendingRead_CntType); | 106 this->didRemoveRefOrPendingIO(kPendingRead_CntType); |
| 105 } | 107 } |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 328 |
| 327 SkBudgeted fBudgeted; | 329 SkBudgeted fBudgeted; |
| 328 bool fRefsWrappedObjects; | 330 bool fRefsWrappedObjects; |
| 329 const UniqueID fUniqueID; | 331 const UniqueID fUniqueID; |
| 330 | 332 |
| 331 typedef GrIORef<GrGpuResource> INHERITED; | 333 typedef GrIORef<GrGpuResource> INHERITED; |
| 332 friend class GrIORef<GrGpuResource>; // to access notifyAllCntsAreZero and n
otifyRefCntIsZero. | 334 friend class GrIORef<GrGpuResource>; // to access notifyAllCntsAreZero and n
otifyRefCntIsZero. |
| 333 }; | 335 }; |
| 334 | 336 |
| 335 #endif | 337 #endif |
| OLD | NEW |