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