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

Side by Side Diff: dm/DM.cpp

Issue 1021033002: Some usability ideas around SkTHash. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: minor tweaks Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/core/SkChecksum.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "CrashHandler.h" 1 #include "CrashHandler.h"
2 #include "DMJsonWriter.h" 2 #include "DMJsonWriter.h"
3 #include "DMSrcSink.h" 3 #include "DMSrcSink.h"
4 #include "DMSrcSinkAndroid.h" 4 #include "DMSrcSinkAndroid.h"
5 #include "OverwriteLine.h" 5 #include "OverwriteLine.h"
6 #include "ProcStats.h" 6 #include "ProcStats.h"
7 #include "SkBBHFactory.h" 7 #include "SkBBHFactory.h"
8 #include "SkChecksum.h" 8 #include "SkChecksum.h"
9 #include "SkCommonFlags.h" 9 #include "SkCommonFlags.h"
10 #include "SkForceLinking.h" 10 #include "SkForceLinking.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 97 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
98 98
99 struct Gold : public SkString { 99 struct Gold : public SkString {
100 Gold() : SkString("") {} 100 Gold() : SkString("") {}
101 Gold(ImplicitString sink, ImplicitString src, ImplicitString name, ImplicitS tring md5) 101 Gold(ImplicitString sink, ImplicitString src, ImplicitString name, ImplicitS tring md5)
102 : SkString("") { 102 : SkString("") {
103 this->append(sink); 103 this->append(sink);
104 this->append(src); 104 this->append(src);
105 this->append(name); 105 this->append(name);
106 this->append(md5); 106 this->append(md5);
107 while (this->size() % 4) {
108 this->append("!"); // Pad out if needed so we can pass this to Murm ur3.
109 }
110 } 107 }
111 static uint32_t Hash(const Gold& g) { 108 static uint32_t Hash(const Gold& g) { return SkGoodHash((const SkString&)g); }
112 return SkChecksum::Murmur3((const uint32_t*)g.c_str(), g.size());
113 }
114 }; 109 };
115 static SkTHashSet<Gold, Gold::Hash> gGold; 110 static SkTHashSet<Gold, Gold::Hash> gGold;
116 111
117 static void add_gold(JsonWriter::BitmapResult r) { 112 static void add_gold(JsonWriter::BitmapResult r) {
118 gGold.add(Gold(r.config, r.sourceType, r.name, r.md5)); 113 gGold.add(Gold(r.config, r.sourceType, r.name, r.md5));
119 } 114 }
120 115
121 static void gather_gold() { 116 static void gather_gold() {
122 if (!FLAGS_readPath.isEmpty()) { 117 if (!FLAGS_readPath.isEmpty()) {
123 SkString path(FLAGS_readPath[0]); 118 SkString path(FLAGS_readPath[0]);
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 } 637 }
643 return 0; 638 return 0;
644 } 639 }
645 640
646 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 641 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
647 int main(int argc, char** argv) { 642 int main(int argc, char** argv) {
648 SkCommandLineFlags::Parse(argc, argv); 643 SkCommandLineFlags::Parse(argc, argv);
649 return dm_main(); 644 return dm_main();
650 } 645 }
651 #endif 646 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkChecksum.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698