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

Unified Diff: dm/DM.cpp

Issue 1059363002: Add --uninterestingHashesFile to DM (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Better script 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/get_uploaded_hashes.py » ('j') | 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 256014e5daabc979a0339b36086a230744700216..725d805aa5eb529dd623a86adee6c48f955dea6e 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -17,8 +17,10 @@
#include "SkForceLinking.h"
#include "SkGraphics.h"
#include "SkInstCnt.h"
+#include "SkJSONCPP.h"
mtklein 2015/04/03 20:35:47 Die?
borenet 2015/04/03 20:40:15 Done.
#include "SkMD5.h"
#include "SkOSFile.h"
+#include "SkTDict.h"
mtklein 2015/04/03 20:35:47 Die?
borenet 2015/04/03 20:40:15 Done.
#include "SkTHash.h"
#include "SkTaskGroup.h"
#include "SkThreadUtils.h"
@@ -42,6 +44,10 @@ DEFINE_string(blacklist, "",
DEFINE_string2(readPath, r, "", "If set check for equality with golden results in this directory.");
+DEFINE_string(uninterestingHashesFile, "",
+ "JSON file containing a list of uninteresting hashes. If a result hashes to something in "
mtklein 2015/04/03 20:35:47 Update?
borenet 2015/04/03 20:40:15 Done.
+ "this list, no image is written for that result.");
+
__SK_FORCE_IMAGE_DECODER_LINKING;
using namespace DM;
@@ -137,6 +143,22 @@ static void gather_gold() {
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+static SkTHashSet<SkString> gUninterestingHashes;
+
+static void gather_uninteresting_hashes() {
+ if (!FLAGS_uninterestingHashesFile.isEmpty()) {
+ SkString path(FLAGS_uninterestingHashesFile[0]);
+ SkData* data = SkData::NewFromFileName(path.c_str());
borenet 2015/04/03 20:26:50 Am I leaking this?
mtklein 2015/04/03 20:35:47 Yep. SkAutoTUnref<SkData> data(SkData::NewFromFil
borenet 2015/04/03 20:40:15 Done.
+ SkTArray<SkString> hashes;
+ SkStrSplit((const char*)data->data(), "\n", &hashes);
+ for (const SkString& hash : hashes) {
+ gUninterestingHashes.add(hash);
+ }
+ }
+}
+
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
template <typename T>
struct Tagged : public SkAutoTDelete<T> {
const char* tag;
@@ -435,7 +457,7 @@ struct Task {
FLAGS_readPath[0]));
}
- if (!FLAGS_writePath.isEmpty()) {
+ if (!FLAGS_writePath.isEmpty() && !gUninterestingHashes.contains(md5)) {
const char* ext = task->sink->fileExtension();
if (data->getLength()) {
WriteToDisk(*task, md5, ext, data, data->getLength(), NULL);
@@ -625,6 +647,7 @@ int dm_main() {
start_keepalive();
gather_gold();
+ gather_uninteresting_hashes();
gather_srcs();
gather_sinks();
« no previous file with comments | « no previous file | tools/get_uploaded_hashes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698