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