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["options"]["ext"] = gBitmapResults[i].ext.c_str(); | 58 result["key"]["source_options"] = gBitmapResults[i].sourceOptions.c_
str(); |
59 result["md5"] = gBitmapResults[i].md5.c_str(); | 59 result["options"]["ext"] = gBitmapResults[i].ext.c_str(); |
| 60 result["md5"] = gBitmapResults[i].md5.c_str(); |
60 | 61 |
61 root["results"].append(result); | 62 root["results"].append(result); |
62 } | 63 } |
63 } | 64 } |
64 | 65 |
65 { | 66 { |
66 SkAutoMutexAcquire lock(gFailureLock); | 67 SkAutoMutexAcquire lock(gFailureLock); |
67 for (int i = 0; i < gFailures.count(); i++) { | 68 for (int i = 0; i < gFailures.count(); i++) { |
68 Json::Value result; | 69 Json::Value result; |
69 result["file_name"] = gFailures[i].fileName; | 70 result["file_name"] = gFailures[i].fileName; |
(...skipping 27 matching lines...) Expand all Loading... |
97 Json::Value root; | 98 Json::Value root; |
98 const char* data = (const char*)json->data(); | 99 const char* data = (const char*)json->data(); |
99 if (!reader.parse(data, data+json->size(), root)) { | 100 if (!reader.parse(data, data+json->size(), root)) { |
100 return false; | 101 return false; |
101 } | 102 } |
102 | 103 |
103 const Json::Value& results = root["results"]; | 104 const Json::Value& results = root["results"]; |
104 BitmapResult br; | 105 BitmapResult br; |
105 for (unsigned i = 0; i < results.size(); i++) { | 106 for (unsigned i = 0; i < results.size(); i++) { |
106 const Json::Value& r = results[i]; | 107 const Json::Value& r = results[i]; |
107 br.name = r["key"]["name"].asCString(); | 108 br.name = r["key"]["name"].asCString(); |
108 br.config = r["key"]["config"].asCString(); | 109 br.config = r["key"]["config"].asCString(); |
109 br.sourceType = r["key"]["source_type"].asCString(); | 110 br.sourceType = r["key"]["source_type"].asCString(); |
110 br.ext = r["options"]["ext"].asCString(); | 111 br.sourceOptions = r["key"]["source_options"].asCString(); |
111 br.md5 = r["md5"].asCString(); | 112 br.ext = r["options"]["ext"].asCString(); |
| 113 br.md5 = r["md5"].asCString(); |
112 callback(br); | 114 callback(br); |
113 } | 115 } |
114 return true; | 116 return true; |
115 } | 117 } |
116 | 118 |
117 } // namespace DM | 119 } // namespace DM |
OLD | NEW |