OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 | 10 |
11 #ifndef GrResourceCache_DEFINED | 11 #ifndef GrResourceCache_DEFINED |
12 #define GrResourceCache_DEFINED | 12 #define GrResourceCache_DEFINED |
13 | 13 |
14 #include "GrConfig.h" | 14 #include "GrConfig.h" |
15 #include "GrTypes.h" | 15 #include "GrTypes.h" |
16 #include "GrTHashCache.h" | 16 #include "GrTHashTable.h" |
17 #include "GrBinHashKey.h" | 17 #include "GrBinHashKey.h" |
18 #include "SkTInternalLList.h" | 18 #include "SkTInternalLList.h" |
19 | 19 |
20 class GrResource; | 20 class GrResource; |
21 class GrResourceEntry; | 21 class GrResourceEntry; |
22 | 22 |
23 class GrResourceKey { | 23 class GrResourceKey { |
24 public: | 24 public: |
25 enum { | 25 enum { |
26 kHashBits = 7, | 26 kHashBits = 7, |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 bool GrResourceKey::LT(const GrResourceEntry& a, const GrResourceEntry& b) { | 179 bool GrResourceKey::LT(const GrResourceEntry& a, const GrResourceEntry& b) { |
180 return LT(a.key(), b.key()); | 180 return LT(a.key(), b.key()); |
181 } | 181 } |
182 | 182 |
183 bool GrResourceKey::EQ(const GrResourceEntry& a, const GrResourceEntry& b) { | 183 bool GrResourceKey::EQ(const GrResourceEntry& a, const GrResourceEntry& b) { |
184 return EQ(a.key(), b.key()); | 184 return EQ(a.key(), b.key()); |
185 } | 185 } |
186 | 186 |
187 /////////////////////////////////////////////////////////////////////////////// | 187 /////////////////////////////////////////////////////////////////////////////// |
188 | 188 |
189 #include "GrTHashCache.h" | |
190 | |
191 /** | 189 /** |
192 * Cache of GrResource objects. | 190 * Cache of GrResource objects. |
193 * | 191 * |
194 * These have a corresponding GrResourceKey, built from 128bits identifying the | 192 * These have a corresponding GrResourceKey, built from 128bits identifying the |
195 * resource. | 193 * resource. |
196 * | 194 * |
197 * The cache stores the entries in a double-linked list, which is its LRU. | 195 * The cache stores the entries in a double-linked list, which is its LRU. |
198 * When an entry is "locked" (i.e. given to the caller), it is moved to the | 196 * When an entry is "locked" (i.e. given to the caller), it is moved to the |
199 * head of the list. If/when we must purge some of the entries, we walk the | 197 * head of the list. If/when we must purge some of the entries, we walk the |
200 * list backwards from the tail, since those are the least recently used. | 198 * list backwards from the tail, since those are the least recently used. |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 GrResourceCache* fCache; | 415 GrResourceCache* fCache; |
418 }; | 416 }; |
419 #else | 417 #else |
420 class GrAutoResourceCacheValidate { | 418 class GrAutoResourceCacheValidate { |
421 public: | 419 public: |
422 GrAutoResourceCacheValidate(GrResourceCache*) {} | 420 GrAutoResourceCacheValidate(GrResourceCache*) {} |
423 }; | 421 }; |
424 #endif | 422 #endif |
425 | 423 |
426 #endif | 424 #endif |
OLD | NEW |