Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Unified Diff: src/gpu/GrTMultiMap.h

Issue 222473002: SkTDynamicHash: pick up GetKey(), Hash() from T by default. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrResourceCache.h ('k') | tests/DynamicHashTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTMultiMap.h
diff --git a/src/gpu/GrTMultiMap.h b/src/gpu/GrTMultiMap.h
index dfa7e5ec7d01e9fedb35019f3a67d8e3bdc925cd..0007a04a2adb6c6dd535bbdf3dd2d5f5ac21663e 100644
--- a/src/gpu/GrTMultiMap.h
+++ b/src/gpu/GrTMultiMap.h
@@ -17,14 +17,13 @@
*/
template <typename T,
typename Key,
- const Key& (GetKey)(const T&),
- uint32_t (Hash)(const Key&)>
+ typename HashTraits=T>
class GrTMultiMap {
struct ValueList {
explicit ValueList(T* value) : fValue(value), fNext(NULL) {}
- static const Key& ListGetKey(const ValueList& e) { return GetKey(*e.fValue); }
- static uint32_t ListHash(const Key& key) { return Hash(key); }
+ static const Key& GetKey(const ValueList& e) { return HashTraits::GetKey(*e.fValue); }
+ static uint32_t Hash(const Key& key) { return HashTraits::Hash(key); }
T* fValue;
ValueList* fNext;
};
@@ -104,10 +103,7 @@ public:
int count() const { return fCount; }
private:
- SkTDynamicHash<ValueList,
- Key,
- ValueList::ListGetKey,
- ValueList::ListHash> fHash;
+ SkTDynamicHash<ValueList, Key> fHash;
int fCount;
};
« no previous file with comments | « src/gpu/GrResourceCache.h ('k') | tests/DynamicHashTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698