OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 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 #ifndef SkTMultiMap_DEFINED | 9 #ifndef SkTMultiMap_DEFINED |
10 #define SkTMultiMap_DEFINED | 10 #define SkTMultiMap_DEFINED |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 if (f(list->fValue)){ | 95 if (f(list->fValue)){ |
96 return list->fValue; | 96 return list->fValue; |
97 } | 97 } |
98 list = list->fNext; | 98 list = list->fNext; |
99 } | 99 } |
100 return NULL; | 100 return NULL; |
101 } | 101 } |
102 | 102 |
103 int count() const { return fCount; } | 103 int count() const { return fCount; } |
104 | 104 |
| 105 #ifdef SK_DEBUG |
| 106 // This is not particularly fast and only used for validation, so debug only
. |
| 107 int countForKey(const Key& key) const { |
| 108 int count = 0; |
| 109 ValueList* list = fHash.find(key); |
| 110 while (list) { |
| 111 list = list->fNext; |
| 112 ++count; |
| 113 } |
| 114 return count; |
| 115 } |
| 116 #endif |
| 117 |
105 private: | 118 private: |
106 SkTDynamicHash<ValueList, Key> fHash; | 119 SkTDynamicHash<ValueList, Key> fHash; |
107 int fCount; | 120 int fCount; |
108 }; | 121 }; |
109 | 122 |
110 #endif | 123 #endif |
OLD | NEW |