skia2/dm/DMJsonWriter.h
mtklein 748ca3bf2d Sketch DM refactor.
BUG=skia:3255

I think this supports everything DM used to, but has completely refactored how
it works to fit the design in the bug.

Configs like "tiles-gpu" are automatically wired up.

I wouldn't suggest looking at this as a diff.  There's just a bunch of deleted
files, a few new files, and one new file that shares a name with a deleted file
(DM.cpp).

NOTREECHECKS=true

Committed: https://skia.googlesource.com/skia/+/709d2c3e5062c5b57f91273bfc11a751f5b2bb88

Review URL: https://codereview.chromium.org/788243008
2015-01-15 10:56:12 -08:00

51 lines
1.2 KiB
C++

/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef DMJsonWriter_DEFINED
#define DMJsonWriter_DEFINED
#include "SkString.h"
#include "Test.h"
namespace DM {
/**
* Class for collecting results from DM and writing to a json file.
* All methods are thread-safe.
*/
class JsonWriter {
public:
/**
* Info describing a single run.
*/
struct BitmapResult {
SkString name; // E.g. "ninepatch-stretch", "desk_gws.skp"
SkString config; // "gpu", "8888", "serialize", "pipe"
SkString sourceType; // "gm", "skp", "image"
SkString md5; // In ASCII, so 32 bytes long.
SkString ext; // Extension of file we wrote: "png", "pdf", ...
};
/**
* Add a result to the end of the list of results.
*/
static void AddBitmapResult(const BitmapResult&);
/**
* Add a Failure from a Test.
*/
static void AddTestFailure(const skiatest::Failure&);
/**
* Write all collected results to the file FLAGS_writePath[0]/dm.json.
*/
static void DumpJson();
};
} // namespace DM
#endif // DMJsonWriter_DEFINED