OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkLruImageCache.h" | 8 #include "SkLruImageCache.h" |
9 | 9 |
| 10 SK_DEFINE_INST_COUNT(SkImageCache) |
| 11 SK_DEFINE_INST_COUNT(SkLruImageCache) |
| 12 |
10 static intptr_t NextGenerationID() { | 13 static intptr_t NextGenerationID() { |
11 static intptr_t gNextID; | 14 static intptr_t gNextID; |
12 do { | 15 do { |
13 gNextID++; | 16 gNextID++; |
14 } while (SkImageCache::UNINITIALIZED_ID == gNextID); | 17 } while (SkImageCache::UNINITIALIZED_ID == gNextID); |
15 return gNextID; | 18 return gNextID; |
16 } | 19 } |
17 | 20 |
18 class CachedPixels : public SkNoncopyable { | 21 class CachedPixels : public SkNoncopyable { |
19 | 22 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 CachedPixels* pixels = iter.init(fLRU, Iter::kTail_IterStart); | 197 CachedPixels* pixels = iter.init(fLRU, Iter::kTail_IterStart); |
195 while (pixels != NULL && fRamUsed > limit) { | 198 while (pixels != NULL && fRamUsed > limit) { |
196 CachedPixels* prev = iter.prev(); | 199 CachedPixels* prev = iter.prev(); |
197 if (!pixels->isLocked()) { | 200 if (!pixels->isLocked()) { |
198 this->removePixels(pixels); | 201 this->removePixels(pixels); |
199 } | 202 } |
200 pixels = prev; | 203 pixels = prev; |
201 } | 204 } |
202 } | 205 } |
203 } | 206 } |
OLD | NEW |