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

Unified Diff: src/core/SkTDynamicHash.h

Issue 222343002: SkTDynamicHash: remove need for Equals(const T&, const Key&) param. (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/core/SkScaledImageCache.cpp ('k') | src/gpu/GrResourceCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTDynamicHash.h
diff --git a/src/core/SkTDynamicHash.h b/src/core/SkTDynamicHash.h
index 80570ae0acb9b4d86f373ad85230da63e571b09e..0e34270e0b459765f705405e85106706c48a9a9d 100644
--- a/src/core/SkTDynamicHash.h
+++ b/src/core/SkTDynamicHash.h
@@ -16,7 +16,6 @@ template <typename T,
typename Key,
const Key& (GetKey)(const T&),
uint32_t (Hash)(const Key&),
- bool (Equal)(const T&, const Key&),
int kGrowPercent = 75> // Larger -> more memory efficient, but slower.
class SkTDynamicHash {
public:
@@ -65,7 +64,7 @@ public:
if (Empty() == candidate) {
return NULL;
}
- if (Deleted() != candidate && Equal(*candidate, key)) {
+ if (Deleted() != candidate && GetKey(*candidate) == key) {
return candidate;
}
index = this->nextIndex(index, round);
@@ -99,7 +98,7 @@ protected:
int index = this->firstIndex(key);
for (int round = 0; round < fCapacity; round++) {
const T* candidate = fArray[index];
- if (Empty() == candidate || Deleted() == candidate || Equal(*candidate, key)) {
+ if (Empty() == candidate || Deleted() == candidate || GetKey(*candidate) == key) {
return round;
}
index = this->nextIndex(index, round);
@@ -149,8 +148,7 @@ private:
continue;
}
SKTDYNAMICHASH_CHECK(fArray[i] != fArray[j]);
- SKTDYNAMICHASH_CHECK(!Equal(*fArray[i], GetKey(*fArray[j])));
- SKTDYNAMICHASH_CHECK(!Equal(*fArray[j], GetKey(*fArray[i])));
+ SKTDYNAMICHASH_CHECK(!(GetKey(*fArray[i]) == GetKey(*fArray[j])));
}
}
}
@@ -181,7 +179,7 @@ private:
int index = firstIndex;
for (int round = 0; round < fCapacity; round++) {
const T* candidate = fArray[index];
- if (Deleted() != candidate && Equal(*candidate, key)) {
+ if (Deleted() != candidate && GetKey(*candidate) == key) {
fDeleted++;
fCount--;
fArray[index] = Deleted();
« no previous file with comments | « src/core/SkScaledImageCache.cpp ('k') | src/gpu/GrResourceCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698