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 #include "DMJsonWriter.h" | 8 #include "DMJsonWriter.h" |
9 | 9 |
10 #include "ProcStats.h" | 10 #include "ProcStats.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 root[FLAGS_properties[i-1]] = FLAGS_properties[i]; | 45 root[FLAGS_properties[i-1]] = FLAGS_properties[i]; |
46 } | 46 } |
47 for (int i = 1; i < FLAGS_key.count(); i += 2) { | 47 for (int i = 1; i < FLAGS_key.count(); i += 2) { |
48 root["key"][FLAGS_key[i-1]] = FLAGS_key[i]; | 48 root["key"][FLAGS_key[i-1]] = FLAGS_key[i]; |
49 } | 49 } |
50 | 50 |
51 { | 51 { |
52 SkAutoMutexAcquire lock(&gBitmapResultLock); | 52 SkAutoMutexAcquire lock(&gBitmapResultLock); |
53 for (int i = 0; i < gBitmapResults.count(); i++) { | 53 for (int i = 0; i < gBitmapResults.count(); i++) { |
54 Json::Value result; | 54 Json::Value result; |
55 result["key"]["name"] = gBitmapResults[i].name.c_str(); | 55 result["key"]["name"] = gBitmapResults[i].name.c_str(); |
56 result["key"]["config"] = gBitmapResults[i].config.c_str(); | 56 result["key"]["config"] = gBitmapResults[i].config.c_str(); |
57 result["key"]["source_type"] = gBitmapResults[i].sourceType.c_str
(); | 57 result["key"]["source_type"] = gBitmapResults[i].sourceType.c_str(); |
58 result["key"]["source_options"] = gBitmapResults[i].sourceOptions.c_
str(); | 58 result["options"]["ext"] = gBitmapResults[i].ext.c_str(); |
59 result["options"]["ext"] = gBitmapResults[i].ext.c_str(); | 59 result["md5"] = gBitmapResults[i].md5.c_str(); |
60 result["md5"] = gBitmapResults[i].md5.c_str(); | 60 |
| 61 // Source options only need to be part of the key if they exist. |
| 62 // Source type by source type, we either always set options or never
set options. |
| 63 if (!gBitmapResults[i].sourceOptions.isEmpty()) { |
| 64 result["key"]["source_options"] = gBitmapResults[i].sourceOption
s.c_str(); |
| 65 } |
61 | 66 |
62 root["results"].append(result); | 67 root["results"].append(result); |
63 } | 68 } |
64 } | 69 } |
65 | 70 |
66 { | 71 { |
67 SkAutoMutexAcquire lock(gFailureLock); | 72 SkAutoMutexAcquire lock(gFailureLock); |
68 for (int i = 0; i < gFailures.count(); i++) { | 73 for (int i = 0; i < gFailures.count(); i++) { |
69 Json::Value result; | 74 Json::Value result; |
70 result["file_name"] = gFailures[i].fileName; | 75 result["file_name"] = gFailures[i].fileName; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 br.sourceType = r["key"]["source_type"].asCString(); | 115 br.sourceType = r["key"]["source_type"].asCString(); |
111 br.sourceOptions = r["key"]["source_options"].asCString(); | 116 br.sourceOptions = r["key"]["source_options"].asCString(); |
112 br.ext = r["options"]["ext"].asCString(); | 117 br.ext = r["options"]["ext"].asCString(); |
113 br.md5 = r["md5"].asCString(); | 118 br.md5 = r["md5"].asCString(); |
114 callback(br); | 119 callback(br); |
115 } | 120 } |
116 return true; | 121 return true; |
117 } | 122 } |
118 | 123 |
119 } // namespace DM | 124 } // namespace DM |
OLD | NEW |