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

Unified Diff: experimental/skpdiff/SkDiffContext.cpp

Issue 18648002: add JSONP option to output of skpdiff (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 6 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 | « experimental/skpdiff/SkDiffContext.h ('k') | experimental/skpdiff/main.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/skpdiff/SkDiffContext.cpp
diff --git a/experimental/skpdiff/SkDiffContext.cpp b/experimental/skpdiff/SkDiffContext.cpp
index 951bba0ee82bd66ce23789476faad354fa22c730..78a2384fea7e960f8ee4d60232ed96c80e888354 100644
--- a/experimental/skpdiff/SkDiffContext.cpp
+++ b/experimental/skpdiff/SkDiffContext.cpp
@@ -147,9 +147,15 @@ void SkDiffContext::diffPatterns(const char baselinePattern[], const char testPa
}
}
-void SkDiffContext::outputRecords(SkWStream& stream) {
+void SkDiffContext::outputRecords(SkWStream& stream, bool useJSONP) {
DiffRecord* currentRecord = fRecords;
- stream.writeText("{\n");
+ if (useJSONP) {
+ stream.writeText("var SkPDiffRecords = {\n");
+ }
+ else
+ {
+ stream.writeText("{\n");
+ }
stream.writeText(" \"records\": [\n");
while (NULL != currentRecord) {
stream.writeText(" {\n");
@@ -214,5 +220,11 @@ void SkDiffContext::outputRecords(SkWStream& stream) {
currentRecord = currentRecord->fNext;
}
stream.writeText(" ]\n");
- stream.writeText("}\n");
+ if (useJSONP) {
+ stream.writeText("};\n");
+ }
+ else
+ {
+ stream.writeText("}\n");
+ }
}
« no previous file with comments | « experimental/skpdiff/SkDiffContext.h ('k') | experimental/skpdiff/main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698