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

Unified Diff: dm/DM.cpp

Issue 940283006: use simpler SkTHashSet in DM to store reference gold (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DM.cpp
diff --git a/dm/DM.cpp b/dm/DM.cpp
index b41a77f8ade05aa36a1220d455056f7cbc6759ca..fbfd9188cf01e4761c70da698bb0dbc2cbf7a101 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -11,7 +11,7 @@
#include "SkInstCnt.h"
#include "SkMD5.h"
#include "SkOSFile.h"
-#include "SkTDynamicHash.h"
+#include "SkTHash.h"
#include "SkTaskGroup.h"
#include "Test.h"
#include "Timer.h"
@@ -74,6 +74,7 @@ static void done(double ms,
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
struct Gold : public SkString {
+ Gold() : SkString("") {}
Gold(ImplicitString sink, ImplicitString src, ImplicitString name, ImplicitString md5)
: SkString("") {
this->append(sink);
@@ -84,15 +85,14 @@ struct Gold : public SkString {
this->append("!"); // Pad out if needed so we can pass this to Murmur3.
}
}
- static const Gold& GetKey(const Gold& g) { return g; }
static uint32_t Hash(const Gold& g) {
return SkChecksum::Murmur3((const uint32_t*)g.c_str(), g.size());
}
};
-static SkTDynamicHash<Gold, Gold> gGold;
+static SkTHashSet<Gold, Gold::Hash> gGold;
static void add_gold(JsonWriter::BitmapResult r) {
- gGold.add(new Gold(r.config, r.sourceType, r.name, r.md5)); // We'll let these leak. Lazybones.
+ gGold.add(Gold(r.config, r.sourceType, r.name, r.md5));
}
static void gather_gold() {
@@ -340,7 +340,7 @@ struct Task {
}
if (!FLAGS_readPath.isEmpty() &&
- !gGold.find(Gold(task->sink.tag, task->src.tag, name, md5))) {
+ !gGold.contains(Gold(task->sink.tag, task->src.tag, name, md5))) {
fail(SkStringPrintf("%s not found for %s %s %s in %s",
md5.c_str(),
task->sink.tag,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698