OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "GrAuditTrail.h" | 8 #include "GrAuditTrail.h" |
9 | 9 |
10 SkString GrAuditTrail::toJson() const { | 10 SkString GrAuditTrail::toJson() const { |
11 SkString json; | 11 SkString json; |
12 json.append("{\n"); | 12 json.append("{\n"); |
13 json.append("Ops: [\n"); | 13 json.append("\"Ops\": [\n"); |
14 for (int i = 0; i < fOps.count(); i++) { | 14 for (int i = 0; i < fOps.count(); i++) { |
15 json.append(fOps[i].toJson()); | 15 json.append(fOps[i].toJson()); |
16 if (i < fOps.count() - 1) { | 16 if (i < fOps.count() - 1) { |
17 json.append(",\n"); | 17 json.append(",\n"); |
18 } | 18 } |
19 } | 19 } |
20 json.append("]\n"); | 20 json.append("]\n"); |
21 json.append("}\n"); | 21 json.append("}\n"); |
22 return json; | 22 return json; |
23 } | 23 } |
24 | 24 |
25 SkString GrAuditTrail::Op::toJson() const { | 25 SkString GrAuditTrail::Op::toJson() const { |
26 SkString json; | 26 SkString json; |
27 json.append("{\n"); | 27 json.append("{\n"); |
28 json.appendf("%s\n", fName.c_str()); | 28 json.appendf("\"Name\": \"%s\"\n", fName.c_str()); |
29 json.append("}\n"); | 29 json.append("}\n"); |
30 return json; | 30 return json; |
31 } | 31 } |
32 | 32 |
OLD | NEW |