| 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 #include "SkCachedData.h" | 8 #include "SkCachedData.h" |
| 9 #include "SkRefCnt.h" | |
| 10 #include "SkDiscardableMemory.h" | 9 #include "SkDiscardableMemory.h" |
| 11 | 10 |
| 12 //#define TRACK_CACHEDDATA_LIFETIME | 11 //#define TRACK_CACHEDDATA_LIFETIME |
| 13 | 12 |
| 14 #ifdef TRACK_CACHEDDATA_LIFETIME | 13 #ifdef TRACK_CACHEDDATA_LIFETIME |
| 15 static int32_t gCachedDataCounter; | 14 static int32_t gCachedDataCounter; |
| 16 | 15 |
| 17 static void inc() { | 16 static void inc() { |
| 18 int32_t oldCount = sk_atomic_inc(&gCachedDataCounter); | 17 int32_t oldCount = sk_atomic_inc(&gCachedDataCounter); |
| 19 SkDebugf("SkCachedData inc %d\n", oldCount + 1); | 18 SkDebugf("SkCachedData inc %d\n", oldCount + 1); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 case kDiscardableMemory_StorageType: | 189 case kDiscardableMemory_StorageType: |
| 191 // fData can be null or the actual value, depending if DM's lock
succeeded | 190 // fData can be null or the actual value, depending if DM's lock
succeeded |
| 192 break; | 191 break; |
| 193 } | 192 } |
| 194 } else { | 193 } else { |
| 195 SkASSERT((fInCache && 1 == fRefCnt) || (0 == fRefCnt)); | 194 SkASSERT((fInCache && 1 == fRefCnt) || (0 == fRefCnt)); |
| 196 SkASSERT(NULL == fData); | 195 SkASSERT(NULL == fData); |
| 197 } | 196 } |
| 198 } | 197 } |
| 199 #endif | 198 #endif |
| OLD | NEW |