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

Unified Diff: dm/DMWriteTask.cpp

Issue 553583004: Remove expectations / -r from DM entirely. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 3 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 | « dm/DMWriteTask.h ('k') | gyp/dm.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMWriteTask.cpp
diff --git a/dm/DMWriteTask.cpp b/dm/DMWriteTask.cpp
index efc1415a1b9c03ace209541fb38af1e42613a37d..f8073e3390734c3a8db643e9676d582172bb5023 100644
--- a/dm/DMWriteTask.cpp
+++ b/dm/DMWriteTask.cpp
@@ -3,6 +3,7 @@
#include "DMUtil.h"
#include "SkColorPriv.h"
#include "SkCommonFlags.h"
+#include "SkData.h"
#include "SkImageEncoder.h"
#include "SkMD5.h"
#include "SkMallocPixelRef.h"
@@ -158,48 +159,6 @@ bool WriteTask::shouldSkip() const {
return FLAGS_writePath.isEmpty();
}
-WriteTask::Expectations* WriteTask::Expectations::Create(const char* path) {
- if (!FLAGS_writePath.isEmpty() && 0 == strcmp(FLAGS_writePath[0], path)) {
- SkDebugf("We seem to be reading and writing %s concurrently. This won't work.\n", path);
- return NULL;
- }
-
- SkString jsonPath;
- if (sk_isdir(path)) {
- jsonPath = SkOSPath::Join(path, "dm.json");
- } else {
- jsonPath.set(path);
- }
-
- SkAutoDataUnref json(SkData::NewFromFileName(jsonPath.c_str()));
- if (NULL == json.get()) {
- SkDebugf("Can't read %s!\n", jsonPath.c_str());
- return NULL;
- }
-
- SkAutoTDelete<Expectations> expectations(SkNEW(Expectations));
- Json::Reader reader;
- const char* begin = (const char*)json->bytes();
- const char* end = begin + json->size();
- if (!reader.parse(begin, end, expectations->fJson)) {
- SkDebugf("Can't read %s as JSON!\n", jsonPath.c_str());
- return NULL;
- }
- return expectations.detach();
-}
-
-bool WriteTask::Expectations::check(const Task& task, SkBitmap bitmap) const {
- const SkString name = task.name();
- if (fJson[name.c_str()].isNull()) {
- return true; // No expectations.
- }
-
- const char* expected = fJson[name.c_str()].asCString();
- SkAutoTDelete<SkStreamAsset> png(encode_to_png(bitmap));
- SkString actual = get_md5(png);
- return actual.equals(expected);
-}
-
void WriteTask::DumpJson() {
if (FLAGS_writePath.isEmpty()) {
return;
« no previous file with comments | « dm/DMWriteTask.h ('k') | gyp/dm.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698