diff options
author | mtklein <mtklein@chromium.org> | 2015-04-06 07:22:05 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-06 07:22:05 -0700 |
commit | 20c1c047e0800385c8729e304a6a511f41fd3cfc (patch) | |
tree | 57982aa2937b0566ab5e6a5ba9d89091e8696071 /dm/DMJsonWriter.cpp | |
parent | 26fc1bf340328401014a67aa5e836be665d48e5d (diff) |
DM: set source options only when non-empty.
BUG=skia:
Review URL: https://codereview.chromium.org/1063713002
Diffstat (limited to 'dm/DMJsonWriter.cpp')
-rw-r--r-- | dm/DMJsonWriter.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/dm/DMJsonWriter.cpp b/dm/DMJsonWriter.cpp index c8334c5cce..4fe6924327 100644 --- a/dm/DMJsonWriter.cpp +++ b/dm/DMJsonWriter.cpp @@ -52,12 +52,17 @@ void JsonWriter::DumpJson() { SkAutoMutexAcquire lock(&gBitmapResultLock); for (int i = 0; i < gBitmapResults.count(); i++) { Json::Value result; - result["key"]["name"] = gBitmapResults[i].name.c_str(); - result["key"]["config"] = gBitmapResults[i].config.c_str(); - result["key"]["source_type"] = gBitmapResults[i].sourceType.c_str(); - result["key"]["source_options"] = gBitmapResults[i].sourceOptions.c_str(); - result["options"]["ext"] = gBitmapResults[i].ext.c_str(); - result["md5"] = gBitmapResults[i].md5.c_str(); + result["key"]["name"] = gBitmapResults[i].name.c_str(); + result["key"]["config"] = gBitmapResults[i].config.c_str(); + result["key"]["source_type"] = gBitmapResults[i].sourceType.c_str(); + result["options"]["ext"] = gBitmapResults[i].ext.c_str(); + result["md5"] = gBitmapResults[i].md5.c_str(); + + // Source options only need to be part of the key if they exist. + // Source type by source type, we either always set options or never set options. + if (!gBitmapResults[i].sourceOptions.isEmpty()) { + result["key"]["source_options"] = gBitmapResults[i].sourceOptions.c_str(); + } root["results"].append(result); } |