| Index: gm/gmmain.cpp | 
| diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp | 
| index 1540960d8f5d483d35d7d3881a9b505d40e7e570..5c91204dfdc484bcc18a4924263d9fd2e7f3594a 100644 | 
| --- a/gm/gmmain.cpp | 
| +++ b/gm/gmmain.cpp | 
| @@ -869,6 +869,7 @@ public: | 
| const GmResultDigest &actualResultDigest, | 
| ErrorCombination errors, | 
| bool ignoreFailure) { | 
| +#ifdef SK_BUILD_JSON_WRITER | 
| Json::Value jsonActualResults = actualResultDigest.asJsonTypeValuePair(); | 
| Json::Value *resultCollection = NULL; | 
|  | 
| @@ -900,6 +901,7 @@ public: | 
| if (resultCollection) { | 
| (*resultCollection)[testName] = jsonActualResults; | 
| } | 
| +#endif | 
| } | 
|  | 
| /** | 
| @@ -907,7 +909,9 @@ public: | 
| */ | 
| void add_expected_results_to_json_summary(const char testName[], | 
| Expectations expectations) { | 
| +#ifdef SK_BUILD_JSON_WRITER | 
| this->fJsonExpectedResults[testName] = expectations.asJsonValue(); | 
| +#endif | 
| } | 
|  | 
| /** | 
| @@ -1267,13 +1271,14 @@ public: | 
| // If unset, we don't do comparisons. | 
| SkAutoTUnref<ExpectationsSource> fExpectationsSource; | 
|  | 
| +#ifdef SK_BUILD_JSON_WRITER | 
| // JSON summaries that we generate as we go (just for output). | 
| Json::Value fJsonExpectedResults; | 
| Json::Value fJsonActualResults_Failed; | 
| Json::Value fJsonActualResults_FailureIgnored; | 
| Json::Value fJsonActualResults_NoComparison; | 
| Json::Value fJsonActualResults_Succeeded; | 
| - | 
| +#endif | 
| }; // end of GMMain class definition | 
|  | 
| #if SK_SUPPORT_GPU | 
| @@ -1473,7 +1478,9 @@ DEFINE_bool2(verbose, v, false, "Give more detail (e.g. list all GMs run, more i | 
| "each test)."); | 
| DEFINE_bool(writeChecksumBasedFilenames, false, "When writing out actual images, use checksum-" | 
| "based filenames, as rebaseline.py will use when downloading them from Google Storage"); | 
| +#ifdef SK_BUILD_JSON_WRITER | 
| DEFINE_string(writeJsonSummaryPath, "", "Write a JSON-formatted result summary to this file."); | 
| +#endif | 
| DEFINE_string2(writePath, w, "",  "Write rendered images into this directory."); | 
| DEFINE_string2(writePicturePath, p, "", "Write .skp files into this directory."); | 
| DEFINE_int32(pdfJpegQuality, -1, "Encodes images in JPEG at quality level N, " | 
| @@ -2198,10 +2205,12 @@ static bool parse_flags_gmmain_paths(GMMain* gmmain) { | 
| gmmain->fExpectationsSource.reset(SkNEW_ARGS( | 
| IndividualImageExpectationsSource, (readPath))); | 
| } else { | 
| +#ifdef SK_BUILD_JSON_WRITER | 
| if (FLAGS_verbose) { | 
| SkDebugf("reading expectations from JSON summary file %s\n", readPath); | 
| } | 
| gmmain->fExpectationsSource.reset(SkNEW_ARGS(JsonExpectationsSource, (readPath))); | 
| +#endif | 
| } | 
| } | 
| return true; | 
| @@ -2408,6 +2417,7 @@ int tool_main(int argc, char** argv) { | 
| } | 
| #endif | 
|  | 
| +#ifdef SK_BUILD_JSON_WRITER | 
| if (FLAGS_writeJsonSummaryPath.count() == 1) { | 
| Json::Value root = CreateJsonTree( | 
| gmmain.fJsonExpectedResults, | 
| @@ -2417,6 +2427,7 @@ int tool_main(int argc, char** argv) { | 
| SkFILEWStream stream(FLAGS_writeJsonSummaryPath[0]); | 
| stream.write(jsonStdString.c_str(), jsonStdString.length()); | 
| } | 
| +#endif | 
|  | 
| #if SK_SUPPORT_GPU | 
|  | 
|  |