| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 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 GrTHashCache_DEFINED | 11 #ifndef GrTHashCache_DEFINED |
| 12 #define GrTHashCache_DEFINED | 12 #define GrTHashCache_DEFINED |
| 13 | 13 |
| 14 #include "GrTypes.h" | 14 #include "GrTypes.h" |
| 15 #include "SkTDArray.h" | 15 #include "SkTDArray.h" |
| 16 | 16 |
| 17 // GrTDefaultFindFunctor implements the default find behavior for | 17 // GrTDefaultFindFunctor implements the default find behavior for |
| 18 // GrTHashTable (i.e., return the first resource that matches the | 18 // GrTHashTable (i.e., return the first resource that matches the |
| 19 // provided key) | 19 // provided key) |
| 20 template <typename T> class GrTDefaultFindFunctor { | 20 template <typename T> class GrTDefaultFindFunctor { |
| 21 public: | 21 public: |
| 22 // always accept the first element examined | 22 // always accept the first element examined |
| 23 bool operator()(const T* elem) const { return true; } | 23 bool operator()(const T*) const { return true; } |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * Key needs | 27 * Key needs |
| 28 * static bool EQ(const Entry&, const HashKey&); | 28 * static bool EQ(const Entry&, const HashKey&); |
| 29 * static bool LT(const Entry&, const HashKey&); | 29 * static bool LT(const Entry&, const HashKey&); |
| 30 * uint32_t getHash() const; | 30 * uint32_t getHash() const; |
| 31 * | 31 * |
| 32 * Allows duplicate key entries but on find you may get | 32 * Allows duplicate key entries but on find you may get |
| 33 * any of the duplicate entries returned. | 33 * any of the duplicate entries returned. |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 237 |
| 238 template <typename T, typename Key, size_t kHashBits> | 238 template <typename T, typename Key, size_t kHashBits> |
| 239 bool GrTHashTable<T, Key, kHashBits>::contains(T* elem) const { | 239 bool GrTHashTable<T, Key, kHashBits>::contains(T* elem) const { |
| 240 int index = fSorted.find(elem); | 240 int index = fSorted.find(elem); |
| 241 return index >= 0; | 241 return index >= 0; |
| 242 } | 242 } |
| 243 | 243 |
| 244 #endif | 244 #endif |
| 245 | 245 |
| 246 #endif | 246 #endif |
| OLD | NEW |