| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef DMJsonWriter_DEFINED | 8 #ifndef DMJsonWriter_DEFINED |
| 9 #define DMJsonWriter_DEFINED | 9 #define DMJsonWriter_DEFINED |
| 10 | 10 |
| 11 #include "SkString.h" | 11 #include "SkString.h" |
| 12 #include "Test.h" |
| 12 | 13 |
| 13 namespace DM { | 14 namespace DM { |
| 14 | 15 |
| 15 /** | 16 /** |
| 16 * Class for collecting results from DM and writing to a json file. | 17 * Class for collecting results from DM and writing to a json file. |
| 17 * All methods are thread-safe. | 18 * All methods are thread-safe. |
| 18 */ | 19 */ |
| 19 class JsonWriter { | 20 class JsonWriter { |
| 20 public: | 21 public: |
| 21 /** | 22 /** |
| 22 * Info describing a single run. | 23 * Info describing a single run. |
| 23 */ | 24 */ |
| 24 struct BitmapResult { | 25 struct BitmapResult { |
| 25 SkString name; // E.g. "ninepatch-stretch", "desk-gws_skp" | 26 SkString name; // E.g. "ninepatch-stretch", "desk-gws_skp" |
| 26 SkString config; // "gpu", "8888" | 27 SkString config; // "gpu", "8888" |
| 27 SkString mode; // "direct", "default-tilegrid", "pipe" | 28 SkString mode; // "direct", "default-tilegrid", "pipe" |
| 28 SkString sourceType; // "GM", "SKP" | 29 SkString sourceType; // "GM", "SKP" |
| 29 SkString md5; // In ASCII, so 32 bytes long. | 30 SkString md5; // In ASCII, so 32 bytes long. |
| 30 }; | 31 }; |
| 31 | 32 |
| 32 /** | 33 /** |
| 33 * Add a result to the end of the list of results. | 34 * Add a result to the end of the list of results. |
| 34 */ | 35 */ |
| 35 static void AddBitmapResult(const BitmapResult&); | 36 static void AddBitmapResult(const BitmapResult&); |
| 36 | 37 |
| 37 /** | 38 /** |
| 39 * Add a Failure from a Test. |
| 40 */ |
| 41 static void AddTestFailure(const skiatest::Failure&); |
| 42 |
| 43 /** |
| 38 * Write all collected results to the file FLAGS_writePath[0]/dm.json. | 44 * Write all collected results to the file FLAGS_writePath[0]/dm.json. |
| 39 */ | 45 */ |
| 40 static void DumpJson(); | 46 static void DumpJson(); |
| 41 }; | 47 }; |
| 42 | 48 |
| 43 } // namespace DM | 49 } // namespace DM |
| 44 #endif // DMJsonWriter_DEFINED | 50 #endif // DMJsonWriter_DEFINED |
| OLD | NEW |