Index: src/core/SkTMultiMap.h |
diff --git a/src/core/SkTMultiMap.h b/src/core/SkTMultiMap.h |
index 4c8683cb8c33d1ed407cc361a9019fc7027c05e7..dc521debc9be02c1528d5e6e2ee78f74c0d9f8a3 100644 |
--- a/src/core/SkTMultiMap.h |
+++ b/src/core/SkTMultiMap.h |
@@ -102,6 +102,51 @@ public: |
int count() const { return fCount; } |
#ifdef SK_DEBUG |
+ class ConstIter { |
+ public: |
+ explicit ConstIter(const SkTMultiMap* mmap) |
+ : fIter(&(mmap->fHash)) |
+ , fList(nullptr) { |
+ if (!fIter.done()) { |
+ fList = &(*fIter); |
+ } |
+ } |
+ |
+ bool done() const { |
+ return fIter.done(); |
+ } |
+ |
+ const T* operator*() { |
+ SkASSERT(fList); |
+ return fList->fValue; |
+ } |
+ |
+ void operator++() { |
+ if (fList) { |
+ fList = fList->fNext; |
+ } |
+ if (!fList) { |
+ ++fIter; |
+ if (!fIter.done()) { |
+ fList = &(*fIter); |
+ } |
+ } |
+ } |
+ |
+ private: |
+ typename SkTDynamicHash<ValueList, Key>::ConstIter fIter; |
+ const ValueList* fList; |
+ }; |
+ |
+ bool has(const T* value, const Key& key) const { |
+ for (ValueList* list = fHash.find(key); list; list = list->fNext) { |
+ if (list->fValue == value) { |
+ return true; |
+ } |
+ } |
+ return false; |
+ } |
+ |
// This is not particularly fast and only used for validation, so debug only. |
int countForKey(const Key& key) const { |
int count = 0; |