Revert "Revert "GrContext::dump that produces JSON formatted output""
This reverts commit 0f450acd76fd58a2f7464f99869ed6afbfac303c.
Bug: skia:
Change-Id: I97428fbbc6d82bf8b186ec5fdbf1a939c00e4126
Reviewed-on: https://skia-review.googlesource.com/32726
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/gl/GrGLExtensions.cpp b/src/gpu/gl/GrGLExtensions.cpp
index 29f7799..c4f6475 100644
--- a/src/gpu/gl/GrGLExtensions.cpp
+++ b/src/gpu/gl/GrGLExtensions.cpp
@@ -9,6 +9,7 @@
#include "gl/GrGLDefines.h"
#include "gl/GrGLUtil.h"
+#include "SkJSONWriter.h"
#include "SkMakeUnique.h"
#include "SkTSearch.h"
#include "SkTSort.h"
@@ -146,12 +147,10 @@
}
}
-void GrGLExtensions::print(const char* sep) const {
- if (nullptr == sep) {
- sep = " ";
+void GrGLExtensions::dumpJSON(SkJSONWriter* writer) const {
+ writer->beginArray();
+ for (int i = 0; i < fStrings->count(); ++i) {
+ writer->appendString((*fStrings)[i].c_str());
}
- int cnt = fStrings->count();
- for (int i = 0; i < cnt; ++i) {
- SkDebugf("%s%s", (*fStrings)[i].c_str(), (i < cnt - 1) ? sep : "");
- }
+ writer->endArray();
}