Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Unified Diff: src/gpu/GrAuditTrail.cpp

Issue 1704133002: fix comma in GrAuditTrail json (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/private/GrAuditTrail.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAuditTrail.cpp
diff --git a/src/gpu/GrAuditTrail.cpp b/src/gpu/GrAuditTrail.cpp
index 4329cbe062f505ff2a08e15fe1a0ed9a47e97bda..aa527fb4b0a1d078b71a4caa7864ebc41632da0f 100644
--- a/src/gpu/GrAuditTrail.cpp
+++ b/src/gpu/GrAuditTrail.cpp
@@ -7,8 +7,12 @@
#include "GrAuditTrail.h"
-void GrAuditTrail::JsonifyTArray(SkString* json, const char* name, const FrameArray& array) {
+void GrAuditTrail::JsonifyTArray(SkString* json, const char* name, const FrameArray& array,
+ bool addComma) {
if (array.count()) {
+ if (addComma) {
+ json->appendf(",");
+ }
json->appendf("\"%s\": [", name);
for (int i = 0; i < array.count(); i++) {
json->append(array[i]->toJson());
@@ -90,7 +94,7 @@ static SkString pretty_print_json(SkString json) {
SkString GrAuditTrail::toJson(bool prettyPrint) const {
SkString json;
json.append("{");
- JsonifyTArray(&json, "Stacks", fFrames);
+ JsonifyTArray(&json, "Stacks", fFrames, false);
json.append("}");
if (prettyPrint) {
@@ -103,8 +107,8 @@ SkString GrAuditTrail::toJson(bool prettyPrint) const {
SkString GrAuditTrail::Frame::toJson() const {
SkString json;
json.append("{");
- json.appendf("\"Name\": \"%s\",", fName);
- JsonifyTArray(&json, "Frames", fChildren);
+ json.appendf("\"Name\": \"%s\"", fName);
+ JsonifyTArray(&json, "Frames", fChildren, true);
json.append("}");
return json;
}
« no previous file with comments | « include/private/GrAuditTrail.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698