Move dumpJSON behind the SK_ENABLE_DUMP_GPU flag

This should trim the code size of a WASM CanvasKit by 10-20KB.

Bug: skia:
Change-Id: Ibf0f8596c04e891e8f7cbc2fa4f1d1852f7cb462
Reviewed-on: https://skia-review.googlesource.com/c/159261
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index c3ce355..c0d3886 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -30,7 +30,6 @@
 #include "SkDeferredDisplayList.h"
 #include "SkGr.h"
 #include "SkImageInfoPriv.h"
-#include "SkJSONWriter.h"
 #include "SkMakeUnique.h"
 #include "SkSurface_Gpu.h"
 #include "SkTaskGroup.h"
@@ -1113,7 +1112,8 @@
 }
 
 //////////////////////////////////////////////////////////////////////////////
-
+#ifdef SK_ENABLE_DUMP_GPU
+#include "SkJSONWriter.h"
 SkString GrContextPriv::dump() const {
     SkDynamicMemoryWStream stream;
     SkJSONWriter writer(&stream, SkJSONWriter::Mode::kPretty);
@@ -1149,3 +1149,4 @@
     stream.copyToAndReset(result.writable_str());
     return result;
 }
+#endif